ecmwf / cfgrib

A Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request that `uvRelativeToGrid` GRIB key be read by default

blaylockbk opened this issue · comments

Is your feature request related to a problem? Please describe.

When working with wind vector data, it is important to know if the vectors represented are grid- or earth-relative vectors. To get this information, a user currently needs to explicitly read this GRIB key.

import xarray as xr

xr.open_dataset(
    "/path/to/file.grib2",
    engine="cfgrib",
    backend_kwargs={"read_keys": ["uvRelativeToGrid"]},
)

Since this detail is necessary when interpreting wind vectors (i.e., comparing modeled wind to an observation), I suggest this GRIB key be included in the DataArray attrs by default.

Describe the solution you'd like

If I'm right, I think this key can be simply added in the list here

cfgrib/cfgrib/dataset.py

Lines 40 to 48 in eacde4c

DATA_ATTRIBUTES_KEYS = [
"paramId",
"dataType",
"numberOfPoints",
"typeOfLevel",
"stepUnits",
"stepType",
"gridType",
]

Describe alternatives you've considered

No response

Additional context

No response

Organisation

No response