Skip to content
Prev 24077 / 29559 Next

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

Augustin

just quick and dirty if you run gdalinfo("geo_em.d01.nc") your are 
getting the information about the corner coordinates the subdatasets and 
so on. Together with Dominiks suggestion you can do something like this:

library(gdalUtils)
library(raster)
Sys.setenv(GDAL_NETCDF_BOTTOMUP="YES")
wrffake<- "+proj=longlat +ellps=sphere +a=6370000 +b=6370000 +units=m 
+no_defs"
x<-gdal_translate('NETCDF:"geo_em.d01.nc":LANDMASK', 'landmask.tif',
                   of="GTiff",
                   ot="Byte",
                   output_Raster=TRUE,
                   verbose=TRUE)
wrfExt<-extent(-151.29639,-48.703613,12.355667,50.26619)
extent(x) <- extent(wrfExt)
projection(x) <- wrffake
plot(x)

Some remarks:
(1) I just took the first pair of  coordinates as derived from 
gdalinfo("geo_em.d01.nc")
you will find 4 different coordinate pairs (i did not proof which one is 
right

The data is staggered (as outlined by Dominik) So some of the corner 
coordinates belongs to the staggered data and the others coordinates  to 
the unstaggered ones. You will find them marked

If you have installed the netcdf libs you easily can use ncview 
geo_em.d01.nc or ncdump -h geo_em.d01.nc to view the data or get more 
information of the header.

Hope this helps

cheers Chris



Am 23.02.2016 um 21:11 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