NOAA-MDL / grib2io

Python interface to the NCEP G2C Library for reading and writing GRIB2 messages.
https://noaa-mdl.github.io/grib2io
MIT License
30 stars 11 forks source link

Problem in bitmap test ? #144

Closed alcoat closed 4 months ago

alcoat commented 5 months ago

https://github.com/NOAA-MDL/grib2io/blob/f1643e3a84bc8d740481fd72ccef9a440c64220a/src/grib2io/_grib2io.py#L922 Shouldn't this line check that bitmap attribute is None ? The bitmap attribute may always exists as it is set to None in the __post_init__ function https://github.com/NOAA-MDL/grib2io/blob/f1643e3a84bc8d740481fd72ccef9a440c64220a/src/grib2io/_grib2io.py#L716

alcoat commented 5 months ago

The fix remove the bitmap attribute assignment and delete it when flush is called if it has been assigned

EricEngle-NOAA commented 4 months ago

Thanks for reporting. It is the desire to always have bitmap attribute to exist. It was an oversight to still use hasattr() for the bitmap.

alcoat commented 4 months ago

The file has been changed since my first patch : now, the line to change is : https://github.com/NOAA-MDL/grib2io/blob/master/src/grib2io/_grib2io.py#L928 with a check to None of the bitmap attribute.