UsageΒΆ
The class Bufr provides methods for decoding and encoding BUFR with different strategies:
- Decode BUFR meta-data from BUFR section 0, 1, and 3.
- Decode data section 4 only.
- Load tables corresponding to BUFR section 1.
- Do all three steps in one go.
- Encode a JSON formatted file as BUFR and write this to a file.
Decoding the data section can be done descriptor by descriptor via a generator, or decode it in one step, creating a JSON-like data structure. The second will have better performance with BUFR using the internal compression.
Usually follow these first steps to decode a BUFR:
- Instantiate class Bufr
- Load BUFR data in string
- Decode BUFR meta-data
- Load tables
To retrieve the descriptor/value pairs from a generator:
- Get iterator over subsets
- Get iterator over data elements and iterate
Repeat 5+6 for each subset.
To decode a BUFR and retrieve all values as a JSON-like structure:
- Decode all values from all subsets, and get a dict object.
Repeat 2-6 for new BUFR, re-using already loaded tables.