-
Notifications
You must be signed in to change notification settings - Fork 44
Generic regridding preprocessor #1448
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1448 +/- ##
==========================================
+ Coverage 90.75% 90.76% +0.01%
==========================================
Files 197 197
Lines 10552 10568 +16
==========================================
+ Hits 9576 9592 +16
Misses 976 976
Continue to review full report at Codecov.
|
|
Nice! I really like the idea of this generic loading mechanism! By doing this we offer the user a large amount of flexibility in terms of module used, scheme used, keywords used, etc. I will give it a try tomorrow 👍 |
|
I just successfully tested this PR with a couple if Three small comments:
regrid:
regrid:
target_grid: 0.5x0.5
scheme:
name/module/method: iris.analysis.Linear
extrapolation_mode: mask |
valeriupredoi
left a comment
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.
nice idea, I likes! One quick prelim suggestion from me, and of course, as Lenin used to say - tests, tests and tests again 😁 (lemme know I can help with the tests)
|
Alright, thanks @schlunma and @valeriupredoi. I'll take that as an initial go-ahead and will come back with a more fleshed out version. |
|
@zklaus You think this will be ready in time for v2.5.0? I think it would be nice to include this. |
Cheers 😄
Done. Ok like this?
Ditto. Ok?
Agree completely. In fact, I had been thinking about it, but |
|
Now on to writing some tests. |
|
Sounds good @zklaus ! You think you can finish this by the end of this week? Would be great to include this in the (hopfully) last rc5, so we can run the recipes with theses changes. |
|
The main purpose of this PR is to allow the use of iris-esmf-regrid to enable faster, lazy regridding all around and to facilitate regridding of unstructured grids with the new iris mesh support. However, the mechanism introduced here is more general, and hence I introduce neither iris-esmf-regrid as a dependency, nor extensive specific documentation. For documentation we rely on the documentation of iris-esmf-regrid itself; as a dependency this should be introduced alongside the recipe that makes use of it. Of course, this can be debated. If you prefer to integrate things more tightly here, we can take this now, or in a later PR for the next version. That would still allow us to do more experimentation with the released core in the next development cycle of the tool. |
|
Great, thanks Klaus! I think it would have been nice to already include the Will have a look at this PR now! |
|
One further thought about this after reading the doc: I noticed that you use Would it make sense to include it as a dependency, add a very small test, e.g., def test_regrid_generic_regridding(self):
regrid(self.src_cube, '1x1', {"reference": "esmf_regrid.schemes:ESMFAreaWeighted"})and add a note to the doc that this feature is still "experimental"? |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Actually forget my last comment (that I have now hidden). The package is there. I'll investigate. I will say that I got a response of "currently the PyPI servers are overloaded" when trying |
|
can't find it, man - use the web based search https://pypi.org/search/?q=iris-esmf-regrid |
|
this one maybe? Says it's the bridge between Iris and ESMF (A Bridge Too Far, if you asked me 😆 ) https://pypi.org/project/esmf-regrid/ |
|
Yeah, of course that's the one. As named in setup.py. But what are you trying to say? |
|
nothing, I basically just landed in this discussion and still need to figure my way around - maybe I should not comment until then 😆 |
|
Hm. Seems iris-esmf-regrid limits itself to Python 3.8 at the moment. |
|
Ahh...well that's bad. I don't think there is an easy way to solve this apart from dropping support for python 3.7, right? In that case it's probably best to remove it from the environment again (and also remove the test) and explicitly mention in the doc that it needs to be installed manually and requires python 3.8. |
|
Klaus opened an issue here SciTools/iris-esmf-regrid#161 - I've been snooping around (mostly looking at their conda lock file) and it's not obvious to me at all why Python<3.9 - all deps seem to be at their latest versions but built specifically against Python=3.8 |
|
Ahh, it's python=3.8, not python>=3.8, misunderstood that 😬 |
|
🐍 < 3️⃣ 9️⃣ Manu |
|
I think in any case it is reasonable to remove it from the environment. After all, it really is only an example (from the point of view of the generic regridder). |
|
Agreed, but then we need to make it crystal clear in the documentation that |
|
I have removed the dependency and improved the tests. I am not so sure we need to be very forceful about how to install iris-esmf-regrid. First, it really is only an example. If you want to use a different regridder or advanced features of the Iris regridders (perhaps some that will be added in the future), this works just as well, so I don't want to focus too much on this particular package. So imho it's better to have simple, accessible documentation and to refer to the iris-esmf-regrid documentation for further details. Now on to writing the extended documentation requested by @schlunma. |
|
Done. One last round of reviews, @schlunma? @valeriupredoi do you want to have a look too and see if your blocking change request is sufficiently addressed? |
|
cheers, Klaus! I'll uncork meself in a minute 👍 |
valeriupredoi
left a comment
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.
very nice, great work, Klaus! Juat a couple typos from me, all good 🍻
Co-authored-by: Valeriu Predoi <valeriu.predoi@gmail.com>
schlunma
left a comment
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.
Cheers Klaus, very nice work!
I tested this with actual data and it seems to work fine.
One very tiny comment on the doc.
Description
This adds the long-promised iris-esmf-regrid based regridding to the regrid preprocessor.
It does so in a generic way, meaning the preprocessor is not actually adapted to the iris-esmf-regrid package, but rather gets the ability to load any kind of Iris regridding scheme by specifying the corresponding factory, also allowing for the passing of arbitrary arguments.
I'd like to solicit some early feedback!
Do you think this is feasible, i.e. using a generic loading mechanism?
If you want to try it out, don't forget to create a new environment that contains the iris-esmf-regrid conda package as mentioned in the environment.yml in this PR (of course you can also just install it in your environment).
You can use the corresponding branch iris-esmf-regrid and the
recipe_ocean_multimap.ymlin it to try things out.Documentation:
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.
To help with the number pull requests: