Please note:
According to the WMO, the use of local tables in messages intended for non-local or international exchange is strongly discouraged.

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 is an example of the contents for the above files in order to handle the ECMWF parameter 'Potential temperature gradient' in GRIB edition 2:

/usr/local/share/eccodes/definitions/grib2/localConcepts/ecmf/name.def
#Potential temperature gradient
'Potential temperature gradient' = {
    discipline = 192 ;
    parameterCategory = 129 ;
    parameterNumber = 3 ;
}
/usr/local/share/eccodes/definitions/grib2/localConcepts/ecmf/paramId.def
#Potential temperature gradient
'129003' = {
    discipline = 192 ;
    parameterCategory = 129 ;
    parameterNumber = 3 ;
}
/usr/local/share/eccodes/definitions/grib2/localConcepts/ecmf/shortName.def
#Potential temperature gradient
'ptgrd' = {
    discipline = 192 ;
    parameterCategory = 129 ;
    parameterNumber = 3 ;
}
/usr/local/share/eccodes/definitions/grib2/localConcepts/ecmf/units.def
#Potential temperature gradient
'K' = {
    discipline = 192 ;
    parameterCategory = 129 ;
    parameterNumber = 3 ;
}

Note: It is important that you override only the files necessary to add your own local parameters. Do not copy the entire contents of the definitions directory!


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

You should get something like this:

{
  "centre": "ecmf",
  "paramId": 129003,
  "shortName": "ptgrd",
  "units": "K",
  "name": "Potential temperature gradient"
}


(smile)


Also please study the slides here:  Training course presentation.
And the How-To Article GRIB: Converting edition 1 to 2 (The "Local configuration" section)