Skip to end of metadata
Go to start of metadata


Convert a GRIB file to netCDF format.
Note: The GRIB geometry should be a regular lat/lon grid or a regular Gaussian grid (the key "typeOfGrid" should be "regular_ll" or "regular_gg")


grib_to_netcdf [options] grib_file grib_file ...


-I key1,key2,...

Ignore keys. Default method,type,stream,refdate,hdate

-S key1,key2,...

Split according to keys. Default param,expver

-R date

Reference date in the format YYYYMMDD. Default value 19000101.


Type of data. Possible values NC_BYTE, NC_SHORT, NC_INT, NC_FLOAT, NC_DOUBLE. Default NC_SHORT


Don't use time of validity.


Force. Force the execution not to fail on error.

-o output file

The name of the netcdf file.




Multi-field support off. Turn off support for multiple fields in single GRIB message.

-k kind

Specifies the kind of file to be created. Possible values are: 1 -> netCDF classic file format 2 -> netCDF 64 bit classic file format (Default) 3 -> netCDF-4 file format 4 -> netCDF-4 classic model file format

-d level

Deflate data (compression level). Only for netCDF-4 output format. Possible values [0,9]. Default None. Chunking strategy based on GRIB message.


Shuffle data before deflation compression.

-u dimension

Set dimension to be an unlimited dimension.

grib_to_netcdf examples

    1. Produce a NetCDF file from grib edition 1

      > grib_to_netcdf -o input.grib1

    1. If your grib file has analysis and 6-hour forecast, then ignore keys 'type' and 'step'. Thus type=an/fc and step=00/06 will not be considered as netcdf dimensions.

      > grib_to_netcdf -I type,step -o input.grib

    1. Do not use time of validity. If time of validity is used, it means the 1D time coordinate is considered as date+time+step, otherwise 3 different dimensions are created. The default behaviour is to use the time of validity.

      > grib_to_netcdf -T -o input.grib

    1. Produce NetCDF with data type of FLOAT (32bit floating-point, for higher precision). Note these types were chosen to provide a reasonably wide range of trade-offs between data precision and number of bits required for each value

      > grib_to_netcdf -D NC_FLOAT -o input.grib

    1. Set the netcdf dimension 'time' to be unlimited i.e. time can have unlimited length so variables using this dimension can grow along this dimension.

      > grib_to_netcdf -u time -o input.grib

  • No labels