Skip to content
Prev 9884 / 29559 Next

netCDF to raster

How about this? Requires raster, ncdf, rgdal, and sp packages at least
so they must be installed.

library(raster)
## you will need to set some options here, but there are prompts
r <- raster("ncfile.nc")

sgdf <- as(r, "SpatialGridDataFrame")

writeGDAL(sgdf, "geotiff.tif")

See gdalDrivers() for the available formats, which can be set using
options to writeGDAL.

No doubt there will be variations and extra digging for you particular
data, but not far from this. Can you share the file?

Cheers, Mike.
On Sun, Nov 7, 2010 at 1:19 AM, Advait Godbole <advaitgodbole at gmail.com> wrote: