gribtocdl (1) - Linux Manuals

gribtocdl: create netCDF CDL-file from GRIB dataset


gribtocdl - create netCDF CDL-file from GRIB dataset


gribtocdl [-v] [-g tabfile] [-q qspecs] gribfiles


This program decodes GRIB products and generates to stdout the corresponding CDL code that can be used in gribtonc(1) to convert the GRIB products to netCDF format. The default parameter translation is made according to a definition by UCAR, but the user may supply specific translations in a separate file by the -g tabfile option. The user-supplied translations will override the default ones.


Verbose, reports decoding steps to stderr.
-g tabfile
Use GRIB-netcdf translation defined in this file. The format of this file is described below.
-q qspecs
Specification for how to expand so-called quasi-regular or thinned grids into rectangular grids. This argument is a comma-delimited text string that specifies the method of interpolation used (currently lin for linear or cub for cubic), and the latitude and longitude increments in degrees for the resulting grid (e.g. dlat=2.5,dlon=5.0).


The format of the translation table is as follows: Each line contains

GRIB parameter number
netCDF parameter name (cannot start with digit, [A-Za-z0-9_] only )
netCDF long description
netCDF units
An optional comment

These are all separated by semicolon (";"). To comment a whole line, put any letter or special character (i.e. not a digit) in front of it. Trailing spaces are ignored before each semicolon, but not after. The GRIB number may have spaces in front. Parameters found in the separate file take presidence over the default parameter table, those not listed in the separate file are unchanged. All parameters will be named with a level suffix in addition to the name assigned in the separate file.


The command
gribtocdl -v -g sst.grib > sst.cdl

will decode the products in sst.grib and generate the corresponding CDL code into file sst.cdl. The file contains a specific conversion table to be used when naming a parameter from GRIB. Later the GRIB file may be converted to netCDF by using gribtonc:

gribtonc -v -g sst.cdl < sst.grib

The file looks like this:

Grib;netCDF;long name               ;units;comments
 31 ;CI    ;Sea-ice cover           ;none ;(0-1)
 34 ;SSTK  ;Sea surface temperature ;K    ;
151 ;MSL   ;Mean sea-level pressure ;Pa   ;
167 ;T2M   ;2 metre temperature     ;K    ;


Error messages and log messages are written to stderr.


gribdump(1), gribtonc(1), netcdf(3), udunits(3)