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?

1 Answer 1


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:

wgrib2 data.grb2 -new_grid latlon -179.75:720:0.5 -89.75:360:0.5 data_halfdeg.grb2

Then, you can convert the regridded file to netCDF with

wgrib2 data_halfdeg.grb -netcdf data_halfdeg.nc

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:

ncrename -dlatitude,lat -dlongitude,lon \
         -vlatitude,lat -vlongitude,lon data_halfdeg.nc

where the -d and -v flags are used to rename the dimensions and their associated coordinate variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.