ARPA-SIMC / wreport

C++ library and applications to work with weather reports. The library provides featureful BUFR and CREX encoding and decoding.
Other
9 stars 9 forks source link

Quality information value out of range #52

Closed dcesari closed 2 years ago

dcesari commented 2 years ago

This issue vaguely reminds #48: the attached aircraft report qinfo_overflow.bufr.gz fails with

Value 127 is outside the range [0,2] for 033002 (Quality information) at offset 0.

the only clue is given by wrep -t which ends with

...
   011105 EDR algorithm version[NUMERIC]
           -
    204007 7 bits of associated field
    011076 Peak turbulence intensity (eddy dissipation rate)[M2/3 S-1]
qinfo_overflow.bufr:0:Value 127 is outside the range [0,2] for 033002 (Quality information)

does it mean that 33002 has been resized to 7 bits and the missing value (127) is not recognized?

spanezz commented 2 years ago

I added the test case to the library. With a bit more tracing I see that the BUFR declares 7 bits of associated field, with associated field significance 8.

Associated field significance values are defined in B31021. Value 8 is described as:

0 = Not suspected
1 = Suspected
2 = Reserved
3 = Information not required

I assumed that this implies that the value is never described in more than 4 bits, but perhaps the decoder needs to be changed to consider all bits set to one as missing value, whatever the number of bits is going to be.

With that change, the BUFR decodes correctly, and the rest of the test suite does not break. It is anybody's guess why the generation of that BUFR chose to add 7 bits per value for something that can only go from 0 to 3, but I'm happy to be liberal in what I accept

dcesari commented 2 years ago

Thanks, great! I noticed it's an aircraft report on New Delhi airport, so I do not really know who to ask.

dcesari commented 2 years ago

@brancomat can we have a new release with this fix?

brancomat commented 2 years ago

v3.35 released now