-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add interpolators based on scipy's RegularGridInterpolator #44
Conversation
geotiepoints/interpolator.py
Outdated
Args: | ||
method: the method to use for interpolation as described in RegularGridInterpolator's documentation. | ||
Default is "linear". | ||
chunks: If not None, a lazy (dask-based) interpolation will be performed using the chunk sizes specified. | ||
The result will be a dask array in this case. Defaults to None. |
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.
This seems to be missing fine_points
.
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.
Thanks, fixed
This all looks good to me, but I'm not sure I should be the one to really judge it as I don't think I use the existing interpolators. Should the old interpolators be deprecated or changed to use the new classes underneath? |
We could deprecate them, however we should look at the extrapolation feature of the new interpolators first to make sure they are good enough for us. |
Codecov Report
@@ Coverage Diff @@
## main #44 +/- ##
==========================================
+ Coverage 86.90% 88.03% +1.13%
==========================================
Files 21 21
Lines 1313 1438 +125
==========================================
+ Hits 1141 1266 +125
Misses 172 172
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This PR adds interpolators based on scipy's RegularGridInterpolator.
One of the motivations is that the RegularGridInterpolator seems to be prefered to the RectBivariateSpline interpolator according to the interp2d migration instructions, as it does not depend on fitpack.
Performancewise, I could not see any significant difference, with maybe the new interpolator being slightly faster.
Another reason for adding this interpolator is that it has builtin support for extrapolation, although I haven't tested this extensively.
Lastly, the new interpolators have a different API for interpolation. Where we were providing the result grid already at instanciation time for the legacy interpolator, the new ones will only take this information when the interpolation method is called. This allows for more flexible interpolation, in particular we can build a lazy interpolation routine that work chunkwise with dask (supported in the proposed implementation).
git diff origin/main **/*py | flake8 --diff