Please note:
According to the WMO, the use of local tables in messages intended for non-local or international exchange is strongly discouraged.
First of all ask the data provider for any local tables/definitions which they used in their GRIB messages.
Step-by-step guide
Local tables for parameters
A common candidate for local adaptation is the handling of local parameters. The standard parameter descriptions are contained in the files:
name.def paramId.def shortName.def units.def
which are placed in directories:
/usr/local/share/eccodes/definitions/grib[edition]
The parameter descriptions for a given centre
are contained in the directories:
/usr/local/share/eccodes/definitions/grib[edition]/localConcepts/[centre:s]
So for example the GRIB edition 2 local parameters for DWD (centre=edzw) are defined in definitions/grib2/localConcepts/edzw
and GRIB edition 1 local parameters for SMHI (centre=eswi) are in definitions/grib1/localConcepts/eswi
.
The following in an example of the contents for the above files in order to handle ECMWF parameter Geopotential
in GRIB edition 1:
#Geopotential 'Geopotential' = { table2Version = 128 ; indicatorOfParameter = 129 ; }
#Geopotential '129' = { table2Version = 128 ; indicatorOfParameter = 129 ; }
#Geopotential 'z' = { table2Version = 128 ; indicatorOfParameter = 129 ; }
#Geopotential 'm**2 s**-2' = { table2Version = 128 ; indicatorOfParameter = 129 ; }
And for GRIB edition 2, the contents of the same files for parameter Potential temperature gradient
are:
#Potential temperature gradient 'Potential temperature gradient' = { discipline = 192 ; parameterCategory = 129 ; parameterNumber = 3 ; }
#Potential temperature gradient '129003' = { discipline = 192 ; parameterCategory = 129 ; parameterNumber = 3 ; }
#Potential temperature gradient 'ptgrd' = { discipline = 192 ; parameterCategory = 129 ; parameterNumber = 3 ; }
#Potential temperature gradient 'K' = { discipline = 192 ; parameterCategory = 129 ; parameterNumber = 3 ; }
Install and test your changes
ecCodes can be instructed to search for definition files in one or more directory trees with environment variable ECCODES_DEFINITION_PATH
. All the site specific files have to be stored in a sub-directory tree similar to the hierarchy of the ecCodes distribution. Then, the site specific directory has to be included first in the search path. For example:
ECCODES_DEFINITION_PATH=/usr/site/eccodes/definitions:/usr/local/share/eccodes/definitions
The tool codes_info will tell you if you are using this environment variable or using the standard location for definitions.
To test the local parameter we added earlier, you can take a GRIB2 sample file and change its paramId:
% grib_set -s centre=ecmf,paramId=129003 samples/GRIB2.tmpl out.grib2
Now check the parameter info in the output file:
% grib_ls -jn parameter out.grib2
Also please study the slides here: Training course presentation.
And the How-To Article GRIB: Converting edition 1 to 2 (The "Local configuration" section)