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

Request that `uvRelativeToGrid` GRIB key be read by default #378

Closed blaylockbk closed 4 months ago

blaylockbk commented 6 months ago

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 https://github.com/ecmwf/cfgrib/blob/eacde4c3fbf2eae4fa0ca2b1070c0f77481c7045/cfgrib/dataset.py#L40-L48

Describe alternatives you've considered

No response

Additional context

No response

Organisation

No response