What happened?
Some types of global attributes specifications in the to_xarray method (global_attrs kwarg) are ignored.
What are the steps to reproduce the bug?
import earthkit.data as ekd
ds_fl = ekd.from_source("sample", "pl.grib")
ds = ds_fl.to_xarray(
attrs_mode="fixed",
global_attrs=[
{"centre_fixed": "_ecmf_"},
lambda md: {"centre_callable": md.get("centre")},
"centre",
"key=centreDescription",
{"centre_key": "key=centre"},
],
)
ds.attrs
The current output is:
{'centre_callable': 'ecmf', 'centre_fixed': '_ecmf_'}
The excepted output is:
{'centre_callable': 'ecmf',
'centre': 'ecmf',
'centreDescription': 'European Centre for Medium-Range Weather Forecasts',
'centre_key': 'ecmf',
'centre_fixed': '_ecmf_'}
Version
main, latest (v0.16.1)
Platform (OS and architecture)
all
Relevant log output
Accompanying data
No response
Organisation
No response
What happened?
Some types of global attributes specifications in the
to_xarraymethod (global_attrskwarg) are ignored.What are the steps to reproduce the bug?
The current output is:
{'centre_callable': 'ecmf', 'centre_fixed': '_ecmf_'}The excepted output is:
{'centre_callable': 'ecmf', 'centre': 'ecmf', 'centreDescription': 'European Centre for Medium-Range Weather Forecasts', 'centre_key': 'ecmf', 'centre_fixed': '_ecmf_'}Version
main, latest (v0.16.1)
Platform (OS and architecture)
all
Relevant log output
Accompanying data
No response
Organisation
No response