SpatialGridDataFrame to netcdf grid
On Mon, 12 Nov 2007, Sebastian P. Luque wrote:
On Mon, 12 Nov 2007 22:21:08 +0100 (CET), Roger Bivand <Roger.Bivand at nhh.no> wrote: [...]
No, see the example in the help file. Use this function to create a dataset that can be created:
xx <- create2GDAL(locs.sub.ts, drivername="GTiff")
then copy xx:
xxx <- copyDataset(xx, drivername="netCDF")
Thanks Roger, I understand the process a little better. However, R simply crashes at this copying stage with: ---<---------------cut here---------------start-------------->--- netcdf: 4 is not a valid cdfid Process R exited abnormally with code 3 at Mon Nov 12 16:00:27 2007 ---<---------------cut here---------------end---------------->--- without leaving any other trace. It seems as if this is an issue with gdal netcdf driver. Googling turns up a couple of hits with this message, but they all indicate the problem should already be fixed with the current version of gdal in Debian unstable (the system this happens on).
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. Roger
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no