[R-sig-Geo] SpatialGridDataFrame to netcdf grid

Sebastian P. Luque spluque at gmail.com
Tue Nov 13 15:42:25 CET 2007


On Mon, 12 Nov 2007 23:29:59 +0100 (CET),
Roger Bivand <Roger.Bivand at nhh.no> wrote:

[...]

> Then the fallback is to write a GTiff, and use gdal_translate to convert
> it (one of the gdal utilities that build with the GDAL shared
> object). If the same problem occurs, you may need to install netCDF and
> GDAL from source. If that doesn't resolve it, then you'll need to
> reshape the data to the required format and use functions in the ncdf
> package to create and write to the file.

I found out that the Debian packages with the gdal_translate binary is
gdal-bin, and trying to writeGDAL() to GTiff and then gdal_translate as
suggested earlier gives the same error message about cdfid not being
valid.

Just so I understand how the SpatialGridDataFrame object is structured:

R> gridparameters(locs.sub.ts)
  cellcentre.offset cellsize cells.dim
1            -69.12  0.06109       113
2             63.64  0.03424       122
R> bbox(locs.sub.ts)
             min    max
coords.x1 -69.15 -62.25
coords.x2  63.62  67.80

How are the data (e.g. z values) aligned with respect to these values?  I
would like to know what as.data.frame(locs.sub.ts) returns: the
coordinates and data for the midpoint of the cell, or the data for some
other reference point in the cell.  Thanks again for any help.


-- 
Seb




More information about the R-sig-Geo mailing list