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

A particular originating centre may wish to store extra meta-data in their own BUFR files (NOT meant for international exchange!)

  1. First of all go to the ecCodes definitions directory (use codes_info).  Look in the following file (assuming you are using BUFR edition 4):

    definitions/bufr/boot_edition_4.def
  2. If the local section is present, which is when the key "localSectionPresent" equals 1, we load the file:

    definitions/bufr/section.2.def
  3. Then this file looks to see if the centre is ECMWF (i.e. centre==98). If so we load in a definitions file called:

    bufr/rdb_key.def or bufr/rdb_key_28.def
  4. The details of why we have two such files is not important. The main thing is that the user can load his/her own local definition file here with a statement like this:

    if (bufrHeaderCentre == code) {
        template localSect  "bufr/my.local.section.def";
    }

    Here the code is the centre's code e.g. For Turkey it might be 91 (=Ankara).

  5. Then in the file definitions/bufr/my.local.section.def define your local keys. Have a look at our one i.e. rdb_key.def to get an idea of how we have added keys there.

    To test things: Take a BUFR message whose centre==91 and then add the local section via:

    % bufr_set -s section2Present=1 in.bufr out.bufr

    You can also use the key "localSectionPresent" (these two keys are the same)

    (smile)