ft: add gridded interpolation to DimensionalData #1126
Closed
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.
This pull request adds support for gridded interpolation of
AbstractDimArrays usingInterpolations.jl, while ensuring that the new functionality is only available whenInterpolations.jlis loaded. The main changes introduce a new extension module, user-facing API, and integration points.New gridded interpolation support:
DimensionalDataInterpolationsExtextension module (ext/DimensionalDataInterpolationsExt.jl) that defines aDimGriddedInterpolationtype for gridded interpolation ofAbstractDimArrays, agridded_interpolateconstructor, and aninterpolate!method for in-place interpolation. This module also includes comprehensive documentation and a custom display method.This PR is inspired by previous efforts and discussions to support interpolation in
DimensionalData, includingInterpolations.jlas an extension.DimensionalDataInterpolationsExt.jlforAbstractDimVectors #1091, adds an extension for 1D interpolation ofDimVectors usingDataInterpolations.jl.I'm very open to discussing the API, bikeshed names and details, etc.
This is very much a first draft that hopefully can stimulate some discussion and feedback before I put in the additional effort to add docs, tests, and clean up the interface and edge-cases. That said, I have used a version of this for a while for an ongoing project, including a variant that works for
DimStacks, but haven't gotten around to trying to get it merged intoDimensionalDataitself.There's a few caveats to this draft, including:
UnrolledUtilities, to ensure that out-of-place interpolation is type-stable. Notably, it is used to move scalar-like dimensions torefdimsso that the returnedDimArrayonly contains vector-like dimensions. Unfortunately, I think this means end-users would have to explicitly load both packages for the extension to load.UnrolledUtilitiesas an ordinary dependency (it's quite light, after all and potentially useful elsewhere).