Skip to content

scan_grib doesn't store vertical levels with two surfaces #559

@krlor17

Description

@krlor17

Hi! I ran into an issue when scanning GEFS A files filtered for parameters having "depthBelowLandLayer" as the vertical coordinate.

"depthBelowLandLayer" typically represents slices between a "topLevel" surface and a "bottomLevel" surface.
For the current GEFS A files there is only one such slice at 0.0 m and 0.1 m.

When message_keys are read from the CFMessage at line 185

message_keys = set(m.message_grib_keys())

"level" is not explicitly included in message_keys although m["level"] still will evaluate to the "topLevel" value. Consequently, the vertical level will not be included due to not clearing the check at line 250

if "typeOfLevel" in message_keys and "level" in message_keys:
                name = m["typeOfLevel"]
                coordinates.append(name)
                data = np.array(m["level"], dtype=float)[()]

A quick and dirty fix would be to check for either "level" or "topLevel" in message_keys viz.

if "typeOfLevel" in message_keys and ("level" in message_keys or "topLevel" in message_keys):

I am however unsure if this misses some unfortunate edge case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions