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
400 stars 77 forks source link

Get "raw" typeOfLevel in addition to the one translated via eccodes #194

Closed maxhollmann closed 3 years ago

maxhollmann commented 3 years ago

The issue I have is that some level types from GFS grib2 files end up as unknown in GRIB_typeOfLevel. Is it possible to get at the underlying id or whatever it is that eccodes translates into the typeOfLevel?

I'm almost certain I've seen an option to disable translation of some attributes somewhere, but can't find it anymore. Is this possible?

shahramn commented 3 years ago

ecCodes computes the "typeOfLevel" key from two underlying coded keys: typeOfFirstFixedSurface typeOfSecondFixedSurface

So for example when the input GRIB message has typeOfFirstFixedSurface=1 typeOfSecondFixedSurface=255 (i.e. missing) The typeOfLevel key returns 'surface'

See https://github.com/ecmwf/eccodes/blob/develop/definitions/grib2/typeOfLevelConcept.def

maxhollmann commented 3 years ago

That's it. Thank you so much :)