Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eccodes>=2.33.0 breaks loading cubes using iris/iris-grib #498

Closed
lidiyaKhalil opened this issue Jun 27, 2024 · 1 comment · Fixed by #504
Closed

eccodes>=2.33.0 breaks loading cubes using iris/iris-grib #498

lidiyaKhalil opened this issue Jun 27, 2024 · 1 comment · Fixed by #504
Assignees

Comments

@lidiyaKhalil
Copy link

ecCodes version 2.33.0 introduced a change to rename indicatorOfUnitOfTimeRange to indicatorOfUnitForForecastTime: https://confluence.ecmwf.int/display/ECC/ecCodes+version+2.33.0+released

This breaks iris-grib as it specifically looks for the old indicatorOfUnitOfTimeRange key within grib files, leading to the error KeyError: 'indicatorOfUnitOfTimeRange not defined in section 4'

Relevant traceback snippet:

File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/__init__.py", line 354, in load_cube
    cubes = _load_collection(uris, constraints, callback).cubes()
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/__init__.py", line 294, in _load_collection
    result = _CubeFilterCollection.from_cubes(cubes, constraints)
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/cube.py", line 97, in from_cubes
    for cube in cubes:
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/__init__.py", line 275, in _generate_cubes
    for cube in iris.io.load_files(part_names, callback, constraints):
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/io/__init__.py", line 222, in load_files
    for cube in handling_format_spec.handler(fnames, callback):
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/fileformats/rules.py", line 433, in load_cubes
    for cube, field in _load_pairs_from_fields_and_filenames(
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/fileformats/rules.py", line 358, in _load_pairs_from_fields_and_filenames
    cube, factories, references = _make_cube(field, converter)
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris/fileformats/rules.py", line 293, in _make_cube
    metadata = converter(field)
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris_grib/_load_convert.py", line 2646, in convert
    grib2_convert(field, metadata)
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris_grib/_load_convert.py", line 2598, in grib2_convert
    product_definition_section(field.sections[4], metadata,
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris_grib/_load_convert.py", line 2453, in product_definition_section
    product_definition_template_0(section, metadata, rt_coord)
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris_grib/_load_convert.py", line 2044, in product_definition_template_0
    time_coords(section, metadata, rt_coord)
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris_grib/_load_convert.py", line 1879, in time_coords
    fp_coord = forecast_period_coord(section['indicatorOfUnitOfTimeRange'],
  File "/opt/conda-lambda/envs/ads310/lib/python3.10/site-packages/iris_grib/message.py", line 436, in __getitem__
    raise KeyError(emsg)

Workaround:
Only use iris-grib with eccodes==2.32.1

@pp-mo pp-mo linked a pull request Jul 15, 2024 that will close this issue
@pp-mo
Copy link
Member

pp-mo commented Jul 15, 2024

#504 fixes, hopefully ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants