...
- First of all get the handles for the input and output messages:
fin
=
open
(inputFileName,
"rb"
)
ibid
=
codes_bufr_new_from_file(fin)
obid
=
codes_bufr_new_from_samples(
"BUFR4")
- Get the
unexpandedDescriptors
of the input message - Ensure the master tables version number >= 28. This is necessary because only in this version have the WMO provided the new sequence
- Now add the special WIGOS sequence (301150) at the beginning of your new set of descriptors
- Set the new descriptors
- Fill in the values of the new keys for the wigos identifiers e.g.
wigosIdentifierSeries
,wigosIssuerOfIdentifier
,wigosIssueNumber
andwigosLocalIdentifierCharacter
- Call the function:
codes_bufr_copy_data(ibid, obid)
This will copy all the values in the data section that are present in the same position in the data tree and with the same number of values to the output handle - Write out the output
- Once finished, do a bufr_dump -p on the output and check the wigos keys are correctly set
Here is a sample Python program:
...