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

Extend conservative regridding to additional dimensions (Previously: Add conservative interpolation scheme) #5035

Open
2 tasks
stephenworsley opened this issue Oct 26, 2022 · 10 comments
Assignees
Labels
Dragon 🐉 https://github.com/orgs/SciTools/projects/19?pane=info Feature: Regridding Status: Decision Required

Comments

@stephenworsley
Copy link
Contributor

stephenworsley commented Oct 26, 2022

✨ Feature Request

In the same way that AreaWeighted offers conservative regridding for horizontal coordinates, there should also be a scheme for conservative interpolation of non-horizontal coordinates. At the moment there is only a scheme for Linear and Nearest. A conservative scheme would require the altering of the existing pattern for interpolation since bounds are required for this calculation and not just points. We could consider adding bounds as a keyword argument to cube.interpolate(). It might also be worth considering the possibility of having target coordinates be an optional alternative argument to call interpolation with as a convenience.

Rather than providing conservative regridding via the interpolate method, it may make more sense to extend regridding directly by allowing regridding to work on non-horizontal coordinates.

Motivation

The way data is located on a cell, or the type of data it represents, can mean that different interpolation methods are more proper. If the data represents the measurement at a point then a linear method is likely to be more appropriate, but if it represents the average of some quantity between some bounds then a conservative method which uses these bounds may be more appropriate.

Additional context

Click to expand this section...
Please add additional verbose information in this section e.g., references, screenshots, listings etc

Tasks

  1. Dragon Sub-Task 🦎
  2. Dragon Sub-Task 🦎 Status: Blocked
@pletzer
Copy link

pletzer commented Oct 26, 2022

Thanks @stephenworsley . This greatly captures the need to add conservative, length-weighted interpolation. Fields that require this are:

  • Any cell-centred W3 fields (e.g. densities)
  • Any W2h field, e.g. the u, v velocities in LFRic or UM.

@trexfeathers
Copy link
Contributor

@pp-mo notes that anything involving bounds probably shouldn't be called 'interpolation'.

@trexfeathers
Copy link
Contributor

@SciTools/iris-devs please comment with your most controversial opinions! Open season!

@zklaus
Copy link

zklaus commented Nov 16, 2022

Are you thinking 1D, e.g. different heights, full 3D, different 2D, e.g. transects, or something else entirely? Perhaps we can add one or two concrete examples with phenomenon, source grid, and target grid.

@stephenworsley
Copy link
Contributor Author

@zklaus I was thinking of 1D interpolation though I could imagine there being a also case for 3D interpolation for something like altitude which varies over latitude/longitude. The example I had in mind was of a 1D height coordinate with bounds (representing other stagger points in an Arakawa grid). Interpolating from one height coordinate to another would involve each target point representing the interval between its bounds, the value at that point would be an average of all the values associated with source intervals which overlap with that target interval. This would be a weighted average based on the proportion of overlap.

Doing this with 3D coords would be more complicated and would require that the bounds were of shape (x, y, z, 2) and were specifically associated with the height dimension.

@bouweandela
Copy link
Member

What are you planning in terms of computational performance? In the past, I've been advised by @bjlittle to avoid the Linear scheme because it is slow. It would be nice if any new scheme could be made in such a way that it is fast and supports lazy data (at least along cube dimensions that are not being interpolated) so we can actually use it with the ESMValTool.

@stephenworsley
Copy link
Contributor Author

@bouweandela I'm in the process of improving the regridding code as part of #4754, you'll be pleased to learn I've already improved the performance of the PointInCell scheme in #4807 . One of the ideas here is to move towards a common backend for regridding with the same improved performance and lazy support. At any rate, we've learnt lessons about regridding performance which ought to carry over to any new regridders.

@stephenworsley stephenworsley self-assigned this Mar 8, 2023
@pp-mo
Copy link
Member

pp-mo commented May 17, 2023

@SciTools/peloton @trexfeathers suggested that this has been seen as sort-of blocked by the above comment

@pp-mo
Copy link
Member

pp-mo commented May 17, 2023

@pp-mo my view is that there basically is no agreed, distinctive terminology to describe what "interpolation" + "regridding" should be and the difference/commonalities between them.

Specifically, I think that in Iris ...

  • regridding means calculations which take account of cells + bounds (source + target),
  • .. whereas interpolation refers only to calculations involving "values at points".
  • Within Iris specifically, regrid + interpolate operate exclusively over horizontal coords -- but think this is not actually clearly stated anywhere (!)
  • In Iris features, a "regridder" takes a target "grid_cube" + operates exclusively on coordinate information.
    Whereas, an "interpolator" has target (output) locations specified as a lists of point values (not a coordinate).

@ESadek-MO ESadek-MO added the Dragon 🐉 https://github.com/orgs/SciTools/projects/19?pane=info label Aug 30, 2023
@ESadek-MO
Copy link
Contributor

Step One: Proof of concept code
Step Two: API and Docstrings

@stephenworsley stephenworsley changed the title Add conservative interpolation scheme Extend conservative regridding to additional dimensions (Previously: Add conservative interpolation scheme) Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dragon 🐉 https://github.com/orgs/SciTools/projects/19?pane=info Feature: Regridding Status: Decision Required
Projects
Status: 🦎 Tamed
Status: No status
Development

No branches or pull requests

7 participants