BUFR has two different ways of encoding information in the data section

compressed

uncompressed

BUFR has two different ways of encoding information in the data section:

The key compressedData indicates whether the data are compressed (value is 1) or uncompressed (value is 0).

When the BUFR data are compressed each element in the data section is an array with:

When the BUFR data are uncompressed a key subsetNumber is made available by ecCodes to search the elements belonging to a specific subset by condition.

The following Python code is an example of getting the airTemperature from the third subset of a SYNOP message:

compressed = codes_get(bufr, 'compressedData')
if compressed:
    t = codes_get(bufr, 'airTemperature')
    t3 = t[3]
else:
    t3 = codes_get(bufr, '/subsetNumber=3/airTemperature')



Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.