SciTools / iris-esmf-regrid

A collection of structured and unstructured ESMF regridding schemes for Iris.
https://iris-esmf-regrid.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
19 stars 17 forks source link

Unify unstructured and rectilinear schemes (curvilinear support) #175

Closed stephenworsley closed 2 years ago

stephenworsley commented 2 years ago

Generalises the helper functions (_cube_to_GridInfo and _create_cube) so that one of each type of function can be used for all regridding schemes. This reduces code copying and begins to unify the behaviour of the regridders.

This adds curvilinear support to the unstructured regridders.

codecov[bot] commented 2 years ago

Codecov Report

Merging #175 (d2e22bc) into main (90ac73a) will decrease coverage by 0.01%. The diff coverage is 99.54%.

@@            Coverage Diff             @@
##             main     #175      +/-   ##
==========================================
- Coverage   99.40%   99.38%   -0.02%     
==========================================
  Files          28       28              
  Lines        2703     2785      +82     
==========================================
+ Hits         2687     2768      +81     
- Misses         16       17       +1     
Impacted Files Coverage Δ
esmf_regrid/schemes.py 97.65% <96.15%> (-0.59%) :arrow_down:
esmf_regrid/experimental/io.py 100.00% <100.00%> (ø)
esmf_regrid/experimental/unstructured_scheme.py 99.00% <100.00%> (-0.17%) :arrow_down:
.../tests/unit/experimental/io/test_round_tripping.py 100.00% <100.00%> (ø)
...nstructured_scheme/test_GridToMeshESMFRegridder.py 100.00% <100.00%> (ø)
...nstructured_scheme/test_MeshToGridESMFRegridder.py 100.00% <100.00%> (ø)
...erimental/unstructured_scheme/test__create_cube.py 100.00% <100.00%> (ø)

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

stephenworsley commented 2 years ago

We then wouldn't need the if/else here too

Actually, I think we can get rid of this anyway because it seems like the bug in iris it's trying to work around has been fixed.

I'm hesitant to organise the cubes by being mesh_cube and grid_cube because I plan on extending the saving to the grid-to-grid regridder, where there will be two grid cubes. I think the only consistent way to distinguish them is by being source and target.