Skip to content

Bounds is not working on 2d linear interpolator #537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rkube opened this issue Dec 15, 2022 · 0 comments
Open

Bounds is not working on 2d linear interpolator #537

rkube opened this issue Dec 15, 2022 · 0 comments

Comments

@rkube
Copy link

rkube commented Dec 15, 2022

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


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant