Skip to content
Prev 24085 / 29559 Next

adapting spatial points and wrld_smpl to a reference system implicit in a .nc file

Agus,

sorry for the addon but I think I have to provide a correction of the 
corner coordinates (e.g. the extent values):

In the example that you have posted below I did calculate the extent 
using the domain center coordinate and the WRF grid resolution in meter 
and the number of rows and cols.

Since Dominik provides a link to the file description of the netcdf file 
I think it is more accurate to reproject the  corner coordinates  as 
given by the netcdf header variables (NC_GLOBAL#corner_lats, 
NC_GLOBAL#corner_lons). Assuming that your variable "dctmx" (which I can 
not identfy it in the nc file)  is of type "Mass" (staggered = M) the 
correct corner coordinates are stored as the first 4 entrys of the dump 
snippet below:

lats<-" 
NC_GLOBAL#corner_lats={12.355667,50.26619,50.26619,12.355667,12.308136,50.18787,50.18787,12.308136,12.210785,50.403816,50.403816,12.210785,12.163345,50.325382,50.325382,12.163345}" 

lons<-" 
NC_GLOBAL#corner_lons={-131.43678,-151.29639,-48.703613,-68.563232,-131.5851,-151.51157,-48.488434,-68.414917,-131.38828,-151.41891,-48.581085,-68.611725,-131.53641,-151.63441,-48.36557,-68.463593}"

after cleaning and converting the strings you may calculate the corner 
coordinates:


library(proj4)
## project mass corner coordinates to lambertian
llMass <- ptransform(cbind(clon[1],clat[1])/180*pi,'+proj=longlat 
+datum=WGS84 +no_defs',proj)
ulMass <- ptransform(cbind(clon[2],clat[2])/180*pi,'+proj=longlat 
+datum=WGS84 +no_defs',proj)
lrMass <- ptransform(cbind(clon[3],clat[3])/180*pi,'+proj=longlat 
+datum=WGS84 +no_defs',proj)
urMass <- ptransform(cbind(clon[4],clat[4])/180*pi,'+proj=longlat 
+datum=WGS84 +no_defs',proj)
wrfLccExtMass<-extent(ulMass[1],lrMass[1],llMass[2],ulMass[2])


According to this the correct extent for mass variables should be:

extent(wrfLccExtMass)
class       : Extent
xmin        : -3575343
xmax        : 3575342
ymin        : -2293058
ymax        : 2306330


hope this is correct now

cheers Chris

Am 24.02.2016 um 05:12 schrieb Agus Camacho:

Thread (18 messages)

Alex Mandel adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 22 Roger Bivand adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Michael Sumner adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Agus Camacho adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Roger Bivand adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Dominik Schneider adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Agus Camacho adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Chris Reudenbach adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Agus Camacho adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Chris Reudenbach adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Agus Camacho adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Michael Sumner adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Agus Camacho adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Dominik Schneider adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Agus Camacho adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 23 Chris Reudenbach adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 24 Jonathan Greenberg adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 26 Jonathan Greenberg adapting spatial points and wrld_smpl to a reference system implicit in a .nc file Feb 26