Skip to content

Fix crash when getting the gridSpec GRIB metadata key#719

Merged
sandorkertesz merged 2 commits into
mainfrom
bugfix/gridspec-key-crash
Jun 6, 2025
Merged

Fix crash when getting the gridSpec GRIB metadata key#719
sandorkertesz merged 2 commits into
mainfrom
bugfix/gridspec-key-crash

Conversation

@sandorkertesz

@sandorkertesz sandorkertesz commented Jun 6, 2025

Copy link
Copy Markdown
Collaborator

With ecCodes 2.41.0 when we get the gridSpec key with a default value an exception not caught in the high-level ecCodes Python API is raised.

ds[0].metadata("gridSpec", default=None)
...

... python3.11/site-packages/eccodes/highlevel/message.py:68: in get
    return self._get(name, ktype=ktype)

 gribapi.errors.FunctionNotImplementedError: Function not yet implemented

Previously, the code above returned None, because ecCodes raised a different exception that was handled in the high level ecCodes Python API. It is already fixed in eccodes-python "develop" but not yet released (ecmwf/eccodes-python@5ce7762)

This PR provides a fix for it in the earthkit-data GRIB interface ensuring that:

ds[0].metadata("gridSpec", default=None)

works with all ecCodes versions.

@codecov-commenter

codecov-commenter commented Jun 6, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.53%. Comparing base (66cddef) to head (8c1394d).
⚠️ Report is 257 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #719      +/-   ##
==========================================
+ Coverage   90.02%   90.53%   +0.50%     
==========================================
  Files         158      164       +6     
  Lines       12086    12458     +372     
  Branches      593      609      +16     
==========================================
+ Hits        10881    11279     +398     
+ Misses       1023      998      -25     
+ Partials      182      181       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sandorkertesz sandorkertesz merged commit 9068e2f into main Jun 6, 2025
125 of 126 checks passed
@sandorkertesz sandorkertesz deleted the bugfix/gridspec-key-crash branch June 6, 2025 16:58
@sandorkertesz sandorkertesz changed the title Fix crash when getting gridSpec GRIB metadata key Fix crash when getting the gridSpec GRIB metadata key Jun 6, 2025
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 this pull request may close these issues.

2 participants