If raster contains a single NaN Linear() works but Cubic() returns all NaNs
alex-s-gardner opened this issue · comments
I'm seeing issues when using Cubic interpoaltion of data that contains NaN values. Here's what I see:
using Interpolations
A = rand(100,100);
x = 1:100;
y = 1:100;
interp = Cubic();
itp = Interpolations.extrapolate(Interpolations.scale(Interpolations.interpolate(A, BSpline(interp)), x, y), NaN);
itp has no NaN values
julia> sum(isnan.(itp.itp))
0
add a NaN value
A[1,1] = NaN
itp = Interpolations.extrapolate(Interpolations.scale(Interpolations.interpolate(A, BSpline(interp)), x, y), NaN);
now all itp values are NaNs
julia> sum(isnan.(itp.itp))
10000
change interp to Linear
interp = Linear();
itp = Interpolations.extrapolate(Interpolations.scale(Interpolations.interpolate(A, BSpline(interp)), x, y), NaN);
now itp contains only a single NaN
julia> sum(isnan.(itp.itp))
1
What behavior would you expect if there are NaN
values?
I would expect something similar to the behavior of when using Linear()... , if any point included within the footprint of the interpolation kernel (5x5 for Cubic) is a NaN then I would expect interpolations to return a NaN. I did not expect the existence of a single NaN in a 100x100 matrix to create NaNs everywhere