You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to write a cononical datasset and got the errors error failed to set key "'endStep:int' to 0" and "failed to set key 'stepUnits:int' to 1". The error seems to that eccodes does not recognize the keywords "endStep:int" and "stepUnits:int". The problem was solved when adding a line that removed ":int" from the message item this in message.py definition message_set:
def message_set(self, item: str, value: T.Any) -> None:
arr = isinstance(value, (np.ndarray, T.Sequence)) and not isinstance(value, str)
if arr:
eccodes.codes_set_array(self.codes_id, item, value)
else:
if ":int" in item:
newItem = item.split(":")[0]
else:
newItem=item
eccodes.codes_set(self.codes_id, newItem, value)
My suggestion is to add a similar piece of code to the next update of cfgrib.
What are the steps to reproduce the bug?
Read a canonical grib message and try to print write it out again with:
from cfgrib.xarray_to_grib import to_grib
to_grib(ds, 'test.grib')
I used hybrid level data on regular lat-lon from ECMWF web API. To write model level data one needs to make a template for that grid in eccodes/samples-library, e.g. by change the template for regular_ll_sfc_grib2.tmpl with e.g. grib_set -s typeOfLevel=hybrid,level=137 regular_ll_sfc_grib2.tmpl regular_ll_ml_grib2.tmpl.
Version
cfgrib v0.9.14.1. eccodes 2.38.3
Platform (OS and architecture)
Ubuntu 20.04.6 LTS
Relevant log output
Accompanying data
No response
Organisation
No response
The text was updated successfully, but these errors were encountered:
What happened?
I tried to write a cononical datasset and got the errors error failed to set key "'endStep:int' to 0" and "failed to set key 'stepUnits:int' to 1". The error seems to that eccodes does not recognize the keywords "endStep:int" and "stepUnits:int". The problem was solved when adding a line that removed ":int" from the message item this in message.py definition message_set:
My suggestion is to add a similar piece of code to the next update of cfgrib.
What are the steps to reproduce the bug?
Read a canonical grib message and try to print write it out again with:
I used hybrid level data on regular lat-lon from ECMWF web API. To write model level data one needs to make a template for that grid in eccodes/samples-library, e.g. by change the template for regular_ll_sfc_grib2.tmpl with e.g.
grib_set -s typeOfLevel=hybrid,level=137 regular_ll_sfc_grib2.tmpl regular_ll_ml_grib2.tmpl
.Version
cfgrib v0.9.14.1. eccodes 2.38.3
Platform (OS and architecture)
Ubuntu 20.04.6 LTS
Relevant log output
Accompanying data
No response
Organisation
No response
The text was updated successfully, but these errors were encountered: