DataInterpolations.jl icon indicating copy to clipboard operation
DataInterpolations.jl copied to clipboard

What methods does a type need to define to work with DataInterpolations?

Open asinghvi17 opened this issue 2 years ago • 1 comments

I recently tried to use Rasters.jl rasters (basically AbstractArrays) with DataInterpolations, only for it to fail.

This turned out to be because it essentially called typeof(input_array)(multiplied_array), which wasn't defined for Rasters in such exactness (Raster(::Raster) was defined, but not with all the type parameters written out).

I defined it and it worked perfectly, but I wanted to understand why this method is called in the first place.
Wouldn't multiplication give you the correct type anyway, or is this for e.g. Float64-Float32 conversion concerns? If so, since AbstractArrays are typed as AbstractArray{N, T}, would it be possible to just run T.(multiplied_array)?

asinghvi17 avatar Mar 24 '23 15:03 asinghvi17

This could probably be improved to use a smaller subset of the interfaces, yes. That likely comes down to Rasters missing an ArrayInterface overload and having to use a fallback.

ChrisRackauckas avatar Mar 25 '23 10:03 ChrisRackauckas