-
Notifications
You must be signed in to change notification settings - Fork 19
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
Handle the renaming of ESMF Python module #639
Handle the renaming of ESMF Python module #639
Conversation
The CI test suite jobs are failing on setup, namely package dependency conflicts RE cf and cfdm ( |
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.
Hi Sadie - very thorough job. Thanks. I have tested the new code with both 8.2.0 and 8.4.0, and both work just fine. I have one minor question about nested try/except clauses, which you should resolve in anyway you like (including ignoring it).
Please merge whenever you're ready.
@davidhassell thanks for the review. What do you see with regards to my comment under 'Other issues flagged' in #639 (comment)? |
Co-authored-by: David Hassell <[email protected]>
Hi Sadie - I've run |
Thanks David. Indeed, I was not being patient enough, having not noticed that that one test method takes quite a while relative to the others. Hence assuming it was hanging. I just got: $ time py test_regrid.py
Run date: 2023-04-26 14:20:19.667060
Platform: Linux-4.15.0-54-generic-x86_64-with-glibc2.10
HDF5 library: 1.14.0
netcdf library: 4.9.2
udunits2 library: /home/sadie/anaconda3/envs/cf-env/lib/libudunits2.so.0
esmpy/ESMF: 8.4.1 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/esmpy/__init__.py
Python: 3.8.16 /home/sadie/anaconda3/envs/cf-env/bin/python
dask: 2023.1.0 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/dask/__init__.py
netCDF4: 1.6.3 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/netCDF4/__init__.py
psutil: 5.9.4 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/psutil/__init__.py
packaging: 23.0 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/packaging/__init__.py
numpy: 1.24.2 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/numpy/__init__.py
scipy: 1.10.1 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/scipy/__init__.py
matplotlib: 3.4.3 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/matplotlib/__init__.py
cftime: 1.6.0 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/cftime/__init__.py
cfunits: 3.3.5 /home/sadie/cfunits/cfunits/__init__.py
cfplot: 3.1.18 /home/sadie/anaconda3/envs/cf-env/lib/python3.8/site-packages/cfplot/__init__.py
cfdm: 1.10.1.0 /home/sadie/cfdm/cfdm/__init__.py
cf: 3.14.1 /home/sadie/cf-python/cf/__init__.py
test_Field_regrid_2d_field (__main__.RegridTest)
2-d regridding with Field destination grid. ... ok
test_Field_regridc_1d_field (__main__.RegridTest)
1-d Cartesian regridding with Field destination grid. ... ok
test_Field_regridc_2d_coords (__main__.RegridTest)
2-d Cartesian regridding with coords destination grid. ... ok
test_Field_regridc_3d_field (__main__.RegridTest)
3-d Cartesian regridding with Field destination grid. ... ok
test_Field_regridc_domain (__main__.RegridTest)
Spherical regridding with Domain destination grid. ... ok
test_Field_regrids_bad_dst (__main__.RegridTest)
Disallowed destination grid types raise an exception. ... ok
test_Field_regrids_coords (__main__.RegridTest)
Spherical regridding with coords destination grid. ... ok
test_Field_regrids_domain (__main__.RegridTest)
Spherical regridding with Domain destination grid. ... ok
test_Field_regrids_field_operator (__main__.RegridTest)
Spherical regridding with operator destination grid. ... ok
test_Field_regrids_non_coordinates (__main__.RegridTest)
Check setting of non-coordinate metadata. ... ok
----------------------------------------------------------------------
Ran 10 tests in 109.699s
OK
real 1m51.548s
user 1m52.335s
sys 0m2.182s So that was a non-issue in the end. Thanks for your help there. All good. I'll respond to your feedback and let you know once that's done. Should be 15 minutes or so. Then I think we're ready to merge unless you feel otherwise. |
All good! |
Hang on! conda install -c conda-forge "esmpy>=8.0.0" ought to do it, I think. |
... and the conda command appears twice in that file. |
Oh, another good spot. One moment, I'll add a further commit. For now note I've resolved, I believe, the try/except nest conversion. |
Hi David, I should have addressed everything you have raised, now, so ready for re-review. Thanks. |
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.
Great. I've re-tested with both versions, and everything works. Good to go, I think.
Close #633. Note the following:
esmpy
(new name) oresmf
(old) to be imported for backwards compatibility, for now, as advertised on the new change log entry._get_module_info
function to cater for a possible alternative module name, since that might occur for other modules, but even if not it allows that method to be re-used for this case as it was before. Nowcf.environment
picks up the module under either name, so is listed asesmpy/ESMF
rather thanESMF
in the output dict.ESMF_*
methods (e.g. ) have becomeesmpy_*
methods (nowesmpy_regrid_1d
), i.e. the name conversion has also been made on method names. This makes sense to me, because the capitalised old name was defying naming conventions for methods and was ugly and weird in that way, plus now we use the newer name going forward. But please do confirm that this is OK, since it is an API change. (ON a related note, very few of those methods seem to be documented - is that something that needs addressing?)Other issues flagged
I don't think this is related to this PR, but I need to investigate further...
test_Field_regrid_2d_field
is currently hanging for me locally (I can't test this onmain
without downgrading my ESMPy and conda hates downgrading anything so it will be a bit tricky to check quickly...). With the PR, all othertest_regrid.py
methods pass and in fact the whole test suite passes other than that when I skip it to stop to hanging, indicating things are fine otherwise.Please let me know if you see this too! I suspect it could be to do with the newer ESMPy version and I will bump this to a new issue if we see further evidence of that!
Specifically, it hangs (I waited 5 mins or so before assuming that) so I apply:
to skip the hanging test and everything passes: