-
Notifications
You must be signed in to change notification settings - Fork 17
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
Unstructured Scheme - Extra Dims #55
Unstructured Scheme - Extra Dims #55
Conversation
Codecov Report
@@ Coverage Diff @@
## unstructured_scheme #55 +/- ##
=======================================================
+ Coverage 98.58% 98.71% +0.13%
=======================================================
Files 16 16
Lines 707 779 +72
=======================================================
+ Hits 697 769 +72
Misses 10 10
Continue to review full report at Codecov.
|
9cd1d92
to
8000f86
Compare
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.
Looking good 👍 , a few comments inline
# | ||
# result = regridder.regrid(data, mdtol=mdtol) | ||
# return result | ||
def _regrid_along_dims(regridder, data, src_dim, mdtol): |
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.
Is the name of this function as clear as it could be? what do we mean by "along dims"? is src_dim
the same as mesh_dim
name used elsewhere?
|
||
# Lenient check for data. | ||
expected_data = np.zeros([t, n_lats, n_lons, h]) | ||
assert np.allclose(expected_data, result.data) |
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.
Would it be better to do these tests with ones rather than zeros? Would we catch more errors?
|
||
# Lenient check for data. | ||
expected_data = np.empty([t, n_lats, n_lons, h]) | ||
expected_data[:] = np.arange(t * h).reshape(t, h)[:, np.newaxis, np.newaxis, :] |
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.
What is the purpose of the empty -> fill with arange construction?
This test and the MeshToGridESMFRegridder
test are very similar, is there a reason we're using different test data for each? Should we have a test that compares both the object and the function return the same thing?
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.
The idea here is that each horizontal level is a unique constant. I do this by broadcasting an array filled with different numbers from np.arange
.
The purpose here is to ensure that each horizontal level is mapped to the appropriate place in the final array. Having each level being constant makes this straightforward to check that this calculation is correct. I've changed the other test in MeshToGridESMFRegridder
to be equivalent.
* extend support to extra dimensions * clarify comment * add test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * simplify function * remove import * simplify function * address review comments * fix test Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* unstructured_scheme: Add grid to mesh scheme (SciTools#96) Unstructured scheme integration test (SciTools#66) Updated lockfiles according to branch requirement spec. Update Version to v0.1.dev2 (SciTools#59) Update version to v0.1.dev1 (SciTools#58) Unstructured Scheme - Extra Dims (SciTools#55) add __init__ to tests (SciTools#56) Unstructured Scheme - Additional Polish (docstrings and test coverage) (SciTools#53) Unstructured Scheme - Cube Creation 3D (SciTools#47) fix test (SciTools#52) Update unstructured_scheme Feature Branch (SciTools#51) # Conflicts: # esmf_regrid/__init__.py # requirements/nox.lock/py36-linux-64.lock # requirements/nox.lock/py37-linux-64.lock # requirements/nox.lock/py38-linux-64.lock
* unstructured_scheme: (22 commits) Check mesh equality on MeshToGridESMFRegridder call (SciTools#138) Formalise regridder file format (SciTools#137) Fix issue 135 (mesh to grid chunking problems) (SciTools#136) Add load/save benchmarks (SciTools#132) Regridder load/saving (SciTools#130) Update dependencies (SciTools#128) Perform scalability for larger grids (SciTools#122) Add performance tests (SciTools#117) change iris source (SciTools#115) Unstructured scheme lazy regridding (with performance tests) (SciTools#111) Updating feature branch unstructured_scheme from 44d6048 to head of main, e528cbf Add grid to mesh scheme (SciTools#96) Unstructured scheme integration test (SciTools#66) Updated lockfiles according to branch requirement spec. Update Version to v0.1.dev2 (SciTools#59) Update version to v0.1.dev1 (SciTools#58) Unstructured Scheme - Extra Dims (SciTools#55) add __init__ to tests (SciTools#56) Unstructured Scheme - Additional Polish (docstrings and test coverage) (SciTools#53) Unstructured Scheme - Cube Creation 3D (SciTools#47) ... # Conflicts: # benchmarks/benchmarks/ci/esmf_regridder.py # benchmarks/benchmarks/generate_data.py # requirements/nox.lock/py36-linux-64.lock # requirements/nox.lock/py37-linux-64.lock # requirements/nox.lock/py38-linux-64.lock # requirements/py36.yml
* unstructured_scheme: (24 commits) reset flag (SciTools#145) Use more stable version of connectivity indices (SciTools#144) Check mesh equality on MeshToGridESMFRegridder call (SciTools#138) Formalise regridder file format (SciTools#137) Fix issue 135 (mesh to grid chunking problems) (SciTools#136) Add load/save benchmarks (SciTools#132) Regridder load/saving (SciTools#130) Update dependencies (SciTools#128) Perform scalability for larger grids (SciTools#122) Add performance tests (SciTools#117) change iris source (SciTools#115) Unstructured scheme lazy regridding (with performance tests) (SciTools#111) Updating feature branch unstructured_scheme from 44d6048 to head of main, e528cbf Add grid to mesh scheme (SciTools#96) Unstructured scheme integration test (SciTools#66) Updated lockfiles according to branch requirement spec. Update Version to v0.1.dev2 (SciTools#59) Update version to v0.1.dev1 (SciTools#58) Unstructured Scheme - Extra Dims (SciTools#55) add __init__ to tests (SciTools#56) ... # Conflicts: # benchmarks/benchmarks/ci/esmf_regridder.py # benchmarks/benchmarks/generate_data.py # requirements/nox.lock/py36-linux-64.lock # requirements/nox.lock/py37-linux-64.lock # requirements/nox.lock/py38-linux-64.lock # requirements/py36.yml # requirements/py37.yml
Provide support for cubes with extra dimensions. This change allows the regridding of cubes whose
mesh_dim
is any dimension. This is done by transposing the data before and after the regridding opperation. In future, this may be handled by the regridder itself (as opposed to the regridding scheme), however, keeping this functionality in a helper function allows the feature branch to stay more closely aligned with main.