JuliaMath / JuliaMath/Interpolations.jl

If raster contains a single NaN Linear() works but Cubic() returns all NaNs

Open
#587 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
575
Forks
117
PR merge metrics
No merged PRs in 30d

Description

I'm seeing issues when using Cubic interpoaltion of data that contains NaN values. Here's what I see:

```julia
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
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
julia> sum(isnan.(itp.itp))
10000
```

change interp to Linear
```julia
interp = Linear();
itp = Interpolations.extrapolate(Interpolations.scale(Interpolations.interpolate(A, BSpline(interp)), x, y), NaN);
```

now itp contains only a single NaN
```julia
julia> sum(isnan.(itp.itp))
1
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.