Users can define their own local BUFR tables to adapt ecCodes to their own needs e.g. to use a local descriptor.
According to the WMO, the use of local tables in messages intended for non-local or international exchange is strongly discouraged.
The local BUFR tables are stored in the following definitions directories:
definitions/bufr/tables/0/local/101/98/0/ (98 is for ecmwf)
The environment variable
ECCODES_DEFINITION_PATH can be set to locate local BUFR tables. This is similar to how the PATH environment variable works in Unix, it is a list of directories separated by colons (":"):
The library searches for each required definition file first in
/path/to/local/defs and then in
/path/to/default/defs. If the file is found in
/path/to/local/defs then it used by the decoding engine.
In order to find out where the default definitions are stored, use the tool codes_info. E.g.
On this platform, ecCodes is installed in
/usr/local/apps/eccodes/2.2.0 and the definitions are in
To get just the definition path above, you can run codes_info with the "-d" option:
This is useful for embedding in Shell scripts.
If you have a BUFR message and want to know which files/directories are being accessed by ecCodes during the decoding, you can use the Unix "strace" command:
This will create a new file called "trace.txt" which records the system calls made. Search this for strings like "definitions/bufr/tables" and you can see which files ecCodes is trying to access and open.
Download an example here.
This tarball contains a BUFR file which uses local descriptors as well as the definition files needed to decode the tables.
- Try decoding the BUFR file "
ikco_217.local.bufr" using bufr_dump. This file uses a local table version (localTablesVersionNumber=66).
Decoding should fail as ecCodes does not know about these descriptors.
- Run the
codes_infotool to find the location of the default definitions.
- Now set
ECCODES_DEFINITION_PATHto include the provided "
export ECCODES_DEFINITION_PATH=`pwd`/mydefs:`codes_info -d`
- Now see if ecCodes can decode the BUFR file.
- Search the output of bufr_dump for the overridden unit "
This was added as an example of a centre defining its own parameter attributes