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

Fix issue when cannot write GRIB based array field to disk #555

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

sandorkertesz
Copy link
Collaborator

@sandorkertesz sandorkertesz commented Dec 8, 2024

When calling GribMetadata.override() with headers_only_clone=True a new GRIB handle is generated with all the data values (and some related information) removed. With this the resulting object can be significantly smaller, especially if the data section is large.

Unfortunately, using this technique resulted in problems when ArrayFields were derived from GRIB data. These fields contain a GribMetadata object created with calling GribMetadata.override(headers_only_clone=True) on the original GRIB metadata.

  • Problem 1: for ArrayFields with GRIB1 reduced Gaussian grid e.g. to_numpy() fails
  • Problem 2: ArrayFields cannot always be written to disk with save(), write() or GribOutput

As a temporary solution, this PR enforces the use of headers_only_clone=False in GribMetadata.override(). With this the problems above are fixed, but ArrayFields will use more memory than before.

The aim is to sort out the problems related to cloning GRIB handles with the headers only option (this possibly requires changes in ecCodes) and enable using headers_only_clone=True again.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@5946e2b). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #555   +/-   ##
=======================================
  Coverage        ?   90.20%           
=======================================
  Files           ?      149           
  Lines           ?    10915           
  Branches        ?      516           
=======================================
  Hits            ?     9846           
  Misses          ?      904           
  Partials        ?      165           

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

@sandorkertesz sandorkertesz merged commit e03e1d1 into main Dec 9, 2024
106 checks passed
@sandorkertesz sandorkertesz deleted the bugfix/cannot-write-gaussian-array-field branch December 9, 2024 10:17
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