- Due to important bug fixes in the NetCDF driver, it is strongly recommended to use GDAL version 1.9 or newer.
The important key to importing NetCDF raster file via r.in.gdal is to specify the correct data subset in the input argument. NetCDF subset specifiers can be obtained from the output of gdalinfo.
For a file named sst.nc...
...will produce a lot of output, including lines that look like this:
The input argument to r.in.gdal must contain all the information after the "=" in the format NETCDF:"[path to file in double quotes]":[variable name]. To import the time_bnds data from NetCDF file sst.nc into GRASS, you need to specify the input as follows:
r.in.gdal input=NETCDF:"sst.nc":time_bnds output=sst
The time_bnds subset may contain multiple data bands. Information about the bands in a subset can be obtained by running gdalinfo on just the subset
...will produce output like this:
Band 22 Block=180x1 Type=Float32, ColorInterp=Undefined NoData Value=1e+20 Metadata: NETCDF_VARNAME=tos NETCDF_DIMENSION_time=645 NETCDF_time_units=days since 2001-1-1
You can specify the bands you want to extract using the bands= argument of r.in.gdal
- also see the GMT page and
- As part of a Google Summer of Code 2009 project Andrea Antonello has put together a GUI controlled GRASS raster timeseries to netCDF export tool using uDig.
Sample datasets and mini-tutorial
Including conversion from global grid-registration to cell-center registration by cropping off northern, southern, and western rows of cells, then using r.region to set remaining in-bounds cell outer boundaries.
- (contributions welcome)