Versions Compared

Key

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

...

        numberOfSubsets    needed after to allocate space for the data in the output message

        masterTablesVersionNumber  this key is needed, if the masterTablesVersionNumber is below 28 ( does not contain the WIGOS sequence) then is set to 28 to make sure ecCodes finds the WIGOS sequence.

2) Once the unexpandedDescriptors sequence is updated with the WIGOS sequence, we open an output file, create a BUFR handle from a BUFR4 sample and set the information ( masterTablesVersionNumber, numberOfSubets) and  ( WIGOS information that comes  from the WIGOS_IDENTIFIERS.csv csv see below Important Notes  ).

This WIGOS information is read at the beginning from a CSV file (WIGOS_IDENTIFIERS.csv) and stored in a pandas dataframe dfWigosInfo, then for each station read from the input file, we query the dfWigosInfo for that particular

station and retrieve the different WIGOS fields needed for the output BUFR. The column "wigosLocalIdentifierCharacter" must be of type TEXT , so that the python function that reads the csv forces this column to be of type object and

can show the leading 0 ( 01027 for instance) otherwise, this column is treated as integer and the leading zero is removed.


The rest of the information is copied from the input BUFR to the output BUFR by using codes_bufr_copy_data(ibid,The rest of the information is copied from the input BUFR to the output BUFR by using codes_bufr_copy_data(ibid,obid) that copies the common keys from the ibid to obid.

3) once the common keys are copied and the new WIGOS keys populated properly, we just write the obid handle to the output file and release the handles ibid,obid to avoid exhausting the system's memory.'s memory.

Important notes

1) The masterTablesVersionNumber must be above 28 otherwise no WIGOS sequence is available

2) The file  WIGOS_IDENTIFIERS.csv contains individual keys for the WIGOS , as mentioned before the WigosLocalIdentifierCharacter has to be encoded as TEXT  when creating the CSV file, any other

keys that contain 0 leading values, should be encoded as TEXT as well to prevent the non leading 0 being removed as they would be treated as numeric fields.

Image Added


The files used are attached here, the testthe  out_mutisubsets.bufr contains the resulting output ( with WIGOS identifiers) for the synop_multi_subset.bufr.

The file test out_singlesubset.bufr contains the  resulting output for the synop.bufr file



Italian test case


View file
nameWIGOS_IDENTIFIERS.csv
height150
View file
namesynop.bufr
height150
View file
namesynop_multi_subset.bufr
height150

...

View file
nameout_synop.bufr
height150

View file
View file
nameout_synop_multisubset.bufr
height150

SWISS case:

View file
nameISID63.LSSD.190900.CCA.580
height150

Brasil case:

nameSBBR_ISAI99-SBBR_2019091106.bfr
height150



The output of out_synop.bufr  contains the WIGOS information

...