Tools and interfaces to work with DIVA interpolation software tool.
Re-gridding is the action of interpolation a field from a grid to another grid, usually with a higher resolution.
nco provides a tool ncremap
for this purpose.
- Download and compile ESMF
- Download a recent version of nco.
ncremap -i data.nc -d grid.nc -o data_regridded.nc
where:
- data.nc is the original file containing the fields,
- grid.nc is another file containing the new grid
- data_regridded.nc is the final output file with the fields interpolated onto the new grid.
The grid file looks like:
dimensions:
longitude = 851 ;
latitude = 321 ;
variables:
float longitude(longitude) ;
longitude:units = "degrees east" ;
float latitude(latitude) ;
latitude:units = "degrees north" ;
}
Note that the input file needs to have lon and lat as coordinates. If that's not te case, one can always use ncrename
, for instance:
ncrename -d x,lon -v x,lon in.nc
- the dimension x is renamed lon
- the variable x is renamed lon
If you get errors related to netCDF, define the environment variables as in:
http://www.earthsystemmodeling.org/esmf_releases/last_built/ESMF_usrdoc/node9.html#SECTION00093200000000000000
It seems that the dimensions should be named longitude and latitude, otherwise the result is strange.