Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt
hiddentrue

A BUFR message is made of some headers and a data section. The structure of the data section is defined in the headers by a sequence of BUFR descriptors, which are sequences of six digit numbers having a particular meaning (see  BUFR tables). To modify this sequence of descriptors ecCodes provides the key unexpandedDescriptors. As an example to change the structure of a message to obtain an upper air report (TEMP) the unexpanded descriptors have to be set as

Step-by-step guide

A BUFR message is made of some headers and a data section. The structure of the data section is defined in the headers by a sequence of BUFR descriptors, which are sequences of six digit numbers having a particular meaning (see  BUFR tables). To modify this sequence of descriptors ecCodes provides the key unexpandedDescriptors. As an example to change the structure of a message to obtain an upper air report (TEMP) the unexpanded descriptors have to be set as:

...

This can be done using any of the language interfaces (Fortran 90, python Python or C), and also using the command line tools.

In particular using the bufr_filter tool, we can write the following simple instructions in the change_structure.filter file

Code Block
languagebashpowershell
titlechange_structure.filter
set unexpandedDescriptors=309052;
write;

and execute the filter instructions with bufr_filter:

Code Block
languagephppowershell
% bufr_filter -o temp.bufr change_structure.filter seed.bufr

...

The output file temp.bufr will be significantly different from the input message seed.bufr because it will have a data structure defined by the sequence 309052. The values in the new data structure will be all missing and the structure will be ready to accept values from the user.

The key unexpandeDescriptors unexpandedDescriptors can be set to an array of integers representing a sequence of BUFR descriptors. If we need to set a sequence which is a variation from a standard sequence or is not included in the table of official WMO sequences, we can explicitly set unexpandedDescriptors with the full sequence. As an example a sequence for aircraft reports including the seconds and pressure as non-coordinate parameter can be obtained by slightly modifying the sequence 311001–> 301051, 007002, 012001, 011001, 011002, 011031, 011032, 011033, 020041 and introducing the elements 004006 (second) and 10004 (pressure non-coordinate) in the sequence of descriptors.

The following filter rules will generate the required message (note the difference between the sequence 311001 and this newly defined sequence):

Code Block
languageapplescriptpowershell
linenumberstrue
set unexpandedDescriptors={301051, 4006,7002, 10004,12001, 11001, 11002, 11031, 11032, 11033, 20041};
write;

...

This key can be set to a string representing the template. The filter rules above can be replaced by

Code Block
languageapplescriptpowershell
linenumberstrue
set bufrTemplate="aircraftReportWithSecondsAndPressure";
write;

...

A list of all the available values for the bufrTemplate key is provided in BUFR templates


Content by Label
showLabelsfalse
max5
spaces~usa
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = in ("kb-how-to-article","eccbufr-faqs","structure","bufr","bufr_filter") and label in ("bufr","encode","bufr_filter") and type = "page" and space = "UDOC"
labelskb-how-to-article

...