JuliaMath / JuliaMath/Interpolations.jl

Bounds is not working on 2d linear interpolator

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

Description

Hi,
calling `Interpolations.bound` fails on a 2d interpolator:

```
ulia> x_rg = 1:10
1:10

julia> y_rg = 1:10
1:10

julia> ip = linear_interpolation((x_rg, y_rg), vals)
10×10 extrapolate(scale(interpolate(::Matrix{Float64}, BSpline(Linear())), (1:10, 1:10)), Throw()) with element type Float64:
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

julia> Interpolations.bounds(ip)
ERROR: MethodError: no method matching lbounds(::Interpolations.Extrapolation{Float64, 2, ScaledInterpolation{Float64, 2, Interpolations.BSplineInterpolation{Float64, 2, Matrix{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, BSpline{Linear{Throw{OnGrid}}}, Tuple{UnitRange{Int64}, UnitRange{Int64}}}, BSpline{Linear{Throw{OnGrid}}}, Throw{Nothing}})
Closest candidates are:
lbounds(::Interpolations.BSplineInterpolation) at ~/.julia/packages/Interpolations/nDwIa/src/b-splines/b-splines.jl:138
lbounds(::Interpolations.GriddedInterpolation) at ~/.julia/packages/Interpolations/nDwIa/src/gridded/gridded.jl:175
lbounds(::Interpolations.MonotonicInterpolation) at ~/.julia/packages/Interpolations/nDwIa/src/monotonic/monotonic.jl:423
...
Stacktrace:
[1] bounds(itp::Interpolations.Extrapolation{Float64, 2, ScaledInterpolation{Float64, 2, Interpolations.BSplineInterpolation{Float64, 2, Matrix{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, BSpline{Linear{Throw{OnGrid}}}, Tuple{UnitRange{Int64}, UnitRange{Int64}}}, BSpline{Linear{Throw{OnGrid}}}, Throw{Nothing}})
@ Interpolations ~/.julia/packages/Interpolations/nDwIa/src/Interpolations.jl:147
[2] top-level scope
@ REPL[13]: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.