I have a GRIB2 file on a Gaussian grid. I'd like to convert it to a netCDF file with to an equally-spaced 0.5-degree grid. How can I do this?
[GIS] Regrid a GRIB2 file and convert to netCDF
grib-2netcdfwgrib2
grib-2netcdfwgrib2
I have a GRIB2 file on a Gaussian grid. I'd like to convert it to a netCDF file with to an equally-spaced 0.5-degree grid. How can I do this?
Best Answer
This can easily be done with with the wgrib2 utility. However, the version of wgrib2 that is included in some Linux distributions does not have the ability to interpolate, so you may need to compile it yourself.
Once you have a suitable version of wgrib2, you can regrid a file to a half-degree grid as follows:
Then, you can convert the regridded file to netCDF with
The dimensions in the netCDF file will be named "latitude" and "longitude". If your application is anticipating "lat" and "lon", you can rename these with the NetCDF operators:
where the
-d
and-v
flags are used to rename the dimensions and their associated coordinate variables.