Closed
Conversation
| # Cache the linear interpolator | ||
| scheme = iris.analysis.Linear() | ||
| coords, points = zip(*sample_points) | ||
| interpolator = scheme.interpolator(cube, coords) |
Member
There was a problem hiding this comment.
These lines need to be protected by if method in ('linear', None) - partly because it's wasted effort otherwise, but mostly because they will fail when trying to do nearest-neighbour interpolation over multi-dimensional coordinates.
NB. The docstring for iris.analysis.trajectory.interpolate is a little ambiguous about the default value of method, but it turns out that the default is not just simply "linear", but switches to "nearest" when using multi-dimensional coordinates. 👎 I definitely don't propose to change that behaviour in this PR, but it would be nice to clarify the docstring (again, possibly in a separate PR - small is beautiful).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@rhattersley @pp-mo @pelson
This is the first change that I implemented under PR #1946 which achieves a 25% increase in efficiency of nearest neighbour interpolation.
Richard suggested that I make this change in the original PR, but I would like to split up the issues brought up in that conversation and so I have made a fresh PR for this.
I would like to be involved in more changes to these routines (and I would like to do this soon, please don't let it all be forgotten about...) but I think this is a solid start. Let's not run before we can walk, and all that.