Skip to content
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 skeleton #31

Conversation

stephenworsley
Copy link
Contributor

Introduces the structure of the unstructured regridding scheme with some minimal code. Further tasks are separable and are described by TODO comments.

Copy link
Contributor

@abooton abooton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starter comments :)

Summary of out "comment styling":

  • Code that is future assumptions/ideas are commented out
  • Copied code could have references to Iris code, to remind us where we were looking at
  • Lines of code are the "simplest" functionality, that we are reviewing and concentrating on here

# Before regridding, data is transposed to a standard form.
# This will be done either with something like the following code
# or else done within the regridder by specifying args.
new_axes = list(range(len(data.shape)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are an assumption that this will be needed and what it will be like. Maybe we can comment it out for now, and then we know it isn't part of the "definite" review here, but a reminder as to our thoughts

)

# Store regrid info.
self.grid_x, self.grid_y, self.regridder = partial_regrid_info
Copy link
Contributor

@abooton abooton Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From our helpful discussion I think we will return more variables (to avoid loading the cube twice in the function interface. So this will end up something like,
_, _, self.grid_x, self.grid_y, self.regridder = regrid_info

@codecov
Copy link

codecov bot commented Feb 26, 2021

Codecov Report

Merging #31 (60578f2) into unstructured_scheme (142a8dd) will decrease coverage by 7.62%.
The diff coverage is 31.70%.

Impacted file tree graph

@@                   Coverage Diff                   @@
##           unstructured_scheme      #31      +/-   ##
=======================================================
- Coverage                96.06%   88.43%   -7.63%     
=======================================================
  Files                        9       10       +1     
  Lines                      305      346      +41     
=======================================================
+ Hits                       293      306      +13     
- Misses                      12       40      +28     
Impacted Files Coverage Δ
esmf_regrid/experimental/unstructured_scheme.py 31.70% <31.70%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 142a8dd...60578f2. Read the comment docs.


def _create_cube(data, src_cube, mesh_dim, mesh, grid_x, grid_y):
# Here we expect the args to be as follows:
# data: a masked array containing the redult of the regridding operation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redult should be result

# src_cube: the source cube which data is regrid from
# mesh_dim: the dimension on src_cube which the mesh belongs to
# mesh: the Mesh (or MeshCoord) object belonging to src_cube
# grid_x: the coordinateon the target cube representing the x axis
Copy link
Contributor

@abooton abooton Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coordinateon => coordinate on
also on line below


mesh, mesh_dim = _get_mesh_and_dim(src_mesh_cube)

regrid_info = (mesh, mesh_dim, grid_x, grid_y, regridder)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own understanding, there is a possibility that the exact variables in this list are altered once we continue the implementation. However, they are good for now.

@abooton
Copy link
Contributor

abooton commented Feb 26, 2021

This looks good as a first "skeleton outline" for the scheme.
It is noted that the tests are failing because we haven't tested anything yet! This will come when each section is developed and does something!

@abooton abooton merged commit bddb48e into SciTools:unstructured_scheme Feb 26, 2021
jamesp pushed a commit that referenced this pull request Apr 8, 2021
* Unstructured scheme skeleton (#31)

* create skeleton of unstructured regridding code
This code is primarily based on Iris's current Area weighted regridding scheme, with the required adaptions for accepting unstructred UGRID data.

* Unstructured Scheme - Basic GridInfo Handling (#32)

Add basic `GridInfo` function and associated tests.  It returns an ESMF regridding object for gridded data.

* Unstructured scheme iris source (#33)

* refresh cirrus-ci and nox

* add iris artifact support

* deal with special-case cirrus-ci quoting

* review actions

* Unstructured Scheme - Basic MeshInfo Handling (#36)

* provide iris Mesh to MeshInfo conversion

* test against iris feature branch

* lint fixes and documentation

* fix typo

* address review comments.

* change tests to better reflect UGRID orientation

* address review comments.

* address review comments

* ASCII art fix

* Unstructured Scheme - Cube Creation 2D (#39)

* support creation of 2D cubes

* lint fixes

* rewrite test

* remove mesh from _create_cube arguments

* add TODO

* add TODO

* Unstructured Scheme - Mesh Fetching (#46)

* support mesh fetching

* fix docstring

* lint fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add docstrings

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add and restructure tests

* fix test

* fix test

* address review comments

* address review comments

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Co-authored-by: Bill Little <bill.little@metoffice.gov.uk>
Co-authored-by: Anna Booton <anna.booton@metoffice.gov.uk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
stephenworsley added a commit to stephenworsley/iris-esmf-regrid that referenced this pull request Jun 2, 2021
* Unstructured scheme skeleton (SciTools#31)

* create skeleton of unstructured regridding code
This code is primarily based on Iris's current Area weighted regridding scheme, with the required adaptions for accepting unstructred UGRID data.

* Unstructured Scheme - Basic GridInfo Handling (SciTools#32)

Add basic `GridInfo` function and associated tests.  It returns an ESMF regridding object for gridded data.

* Unstructured scheme iris source (SciTools#33)

* refresh cirrus-ci and nox

* add iris artifact support

* deal with special-case cirrus-ci quoting

* review actions

* Unstructured Scheme - Basic MeshInfo Handling (SciTools#36)

* provide iris Mesh to MeshInfo conversion

* test against iris feature branch

* lint fixes and documentation

* fix typo

* address review comments.

* change tests to better reflect UGRID orientation

* address review comments.

* address review comments

* ASCII art fix

* Unstructured Scheme - Cube Creation 2D (SciTools#39)

* support creation of 2D cubes

* lint fixes

* rewrite test

* remove mesh from _create_cube arguments

* add TODO

* add TODO

* Unstructured Scheme - Mesh Fetching (SciTools#46)

* support mesh fetching

* fix docstring

* lint fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add docstrings

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add and restructure tests

* fix test

* fix test

* address review comments

* address review comments

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Co-authored-by: Bill Little <bill.little@metoffice.gov.uk>
Co-authored-by: Anna Booton <anna.booton@metoffice.gov.uk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@trexfeathers trexfeathers mentioned this pull request Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants