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 precomputed regridder save bug #462

Merged
merged 10 commits into from
Feb 26, 2025

Conversation

stephenworsley
Copy link
Contributor

@stephenworsley stephenworsley commented Feb 14, 2025

Addresses #433.

@bjlittle bjlittle self-assigned this Feb 21, 2025
@bjlittle bjlittle self-requested a review February 21, 2025 15:37
Copy link
Member

@bjlittle bjlittle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephenworsley This looks ideal 👍

The only thing I'd ask you to consider is pushing the defensive esmf_version logic up into the regridder instance, such that it defaults to a known "unknown" string value (defined by a suitable module constant e.g., ESMF_VERSION_DEFAULT: str = "unknown".

You can then control setting the esmf_version to an actual esmf version or nullify it for appropriate operations (like the user providing pre-computed weights). But in essence, it's always a string and never None.

So esmf_version will always be a string, thus loading/saving should always "just work"™️.

Perhaps also consider (not necessarily in this PR) what matadata on a regridder is read-only or mutable. I'd guess that esmf_version is read-only 🤔

Anyways, have a ponder and I'm happy to go with whatever you recommend 💯

@bjlittle
Copy link
Member

bjlittle commented Feb 24, 2025

pre-commit.ci autofix

Copy link
Member

@bjlittle bjlittle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephenworsley LGTM 🎉

@bjlittle bjlittle merged commit 6286dc3 into SciTools:main Feb 26, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants