ecmwf / cfgrib

A Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes
Apache License 2.0
407 stars 77 forks source link

Better support for typed attributes, like level:float #273

Closed b8raoult closed 2 years ago

alexamici commented 2 years ago

@b8raoult the proposed change breaks GRIB files with float levels, because eccodes accesses level as an int by default and drops the fractional part.

The proper fix should probably be to try accessing with the "level:float" and only in the case of a KeyError using the "level" key plus a type conversion.

What we want to support is like field["level:float"] == 5.5