[R-sig-Geo] GDAL Error - .grd not recognised as a supported file
mdsumner at gmail.com
Tue Aug 25 14:37:27 CEST 2009
(I was trying to send this last night, so it's been covered by Barry
and Roger, but I'm now sending it as a test of this email address
Unfortunately you won't be able to read NetCDF with the CRAN version
of Windows rgdal. If you build the package yourself against FWTools,
or a source build of GDAL you can include NetCDF.
For now probably the easiest way is just to use FWTools directly on
the file - the Windows build of FWTools includes NetCDF, but building
rgdal to include that is not simple, especially if you are not
experienced with building software. You can discover the structure of
the file using this at the command line
If you want to post the output of that command we can probably help more.
There may be subdatasets in the file (I don't think so, but let us
know if you have problems). If that seems fine then you can convert to
GeoTIFF with the following:
gdal_translate ETOPO1_Ice_g_gdal.grd ETOPO1_Ice_g_gdal.tif
Then you should be able to read it with readGDAL with the GeoTIFF driver.
(If there are subdatasets you need the full string, something like
this: gdal_translate NETCDF:"ETOPO1_Ice_g_gdal.grd":Etopo
BTW, I've been using the downloaded ice/cell version of the TIFF (but
I do remember problems and I may have converted it from the .grd)
I usually find there is something missing from datasets like this,
either the source NetCDF assumes Matlab orientation and this
information is not explicit, or therthe pixel registration will be
slightly out - so it's not uncommon to need some manual workarounds
before getting it right.
Finally, I think you could read from the file using one of the R
NetCDF packages if that seems more promising - but you'll still have
to manually create sp objects from the data. I use RNetCDF a lot -
which will install simply on Windows with install.packages.
More information about the R-sig-Geo