-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Patch to fix esmpy import for esmpy >= 8.4.0 #89
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Patch to fix esmpy import for esmpy >= 8.4.0
Add a test to make sure `regrid2.ESMFREgrid` is available.
- Loading branch information
commit d41db31f6d87c27301bdfcb8b7e6eb04f2332388
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
diff -ruN cdms-3.1.5/regrid2/Lib/esmf.py cdms-3.1.5-patch/regrid2/Lib/esmf.py | ||
--- cdms-3.1.5/regrid2/Lib/esmf.py 2020-07-31 03:01:33.000000000 +0200 | ||
+++ cdms-3.1.5-patch/regrid2/Lib/esmf.py 2023-08-01 09:02:26.554853011 +0200 | ||
@@ -15,7 +15,10 @@ | ||
import time | ||
import numpy | ||
from regrid2 import RegridError | ||
-import ESMF | ||
+try: | ||
+ import esmpy as ESMF | ||
+except ImportError: | ||
+ import ESMF | ||
from functools import reduce | ||
|
||
# constants | ||
diff -ruN cdms-3.1.5/regrid2/Lib/__init__.py cdms-3.1.5-patch/regrid2/Lib/__init__.py | ||
--- cdms-3.1.5/regrid2/Lib/__init__.py 2020-07-31 03:01:33.000000000 +0200 | ||
+++ cdms-3.1.5-patch/regrid2/Lib/__init__.py 2023-08-01 09:01:50.815080096 +0200 | ||
@@ -14,7 +14,10 @@ | ||
from .mvGenericRegrid import GenericRegrid # noqa | ||
from .mvLibCFRegrid import LibCFRegrid # noqa | ||
try: | ||
- import ESMF | ||
+ try: | ||
+ import esmpy as ESMF | ||
+ except ImportError: | ||
+ import ESMF | ||
ESMF.deprecated.__globals__[ | ||
'warnings'].warn_explicit = ESMF.deprecated.__globals__['warnings'].formatwarning | ||
from .mvESMFRegrid import ESMFRegrid # noqa | ||
@@ -24,7 +27,10 @@ | ||
ESMF_HAS_BEEN_INITIALIZED = False | ||
if not ESMF_HAS_BEEN_INITIALIZED: | ||
try: | ||
- import ESMF | ||
+ try: | ||
+ import esmpy as ESMF | ||
+ except ImportError: | ||
+ import ESMF | ||
ESMF.deprecated.__globals__[ | ||
'warnings'].warn_explicit = ESMF.deprecated.__globals__['warnings'].formatwarning | ||
ESMF.Manager(debug=False) | ||
diff -ruN cdms-3.1.5/regrid2/Lib/mvESMFRegrid.py cdms-3.1.5-patch/regrid2/Lib/mvESMFRegrid.py | ||
--- cdms-3.1.5/regrid2/Lib/mvESMFRegrid.py 2020-07-31 03:01:33.000000000 +0200 | ||
+++ cdms-3.1.5-patch/regrid2/Lib/mvESMFRegrid.py 2023-08-01 09:02:26.538853112 +0200 | ||
@@ -12,7 +12,10 @@ | ||
import socket | ||
import numpy | ||
|
||
-import ESMF | ||
+try: | ||
+ import esmpy as ESMF | ||
+except ImportError: | ||
+ import ESMF | ||
from . import esmf | ||
from . import RegridError | ||
from .mvGenericRegrid import GenericRegrid | ||
diff -ruN cdms-3.1.5/regrid2/Lib/mytest.py cdms-3.1.5-patch/regrid2/Lib/mytest.py | ||
--- cdms-3.1.5/regrid2/Lib/mytest.py 2020-07-31 03:01:33.000000000 +0200 | ||
+++ cdms-3.1.5-patch/regrid2/Lib/mytest.py 2023-08-01 09:04:07.634210699 +0200 | ||
@@ -1,2 +1,6 @@ | ||
-import ESMF # noqa | ||
+try: | ||
+ import esmpy as ESMF # noqa | ||
+except ImportError: | ||
+ import ESMF # noqa | ||
+ | ||
from .mvESMFRegrid import ESMFRegrid # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chengzhuzhang, hopefully this check will prevent issues like E3SM-Project/e3sm_diags#711 from happening in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like regridding behavior gets back to normal with this fix!