JuliaMath / JuliaMath/Interpolations.jl
Can get Gridded() object at vector, why not scaled one?
- Dominant language
- Julia
- Stars
- 575
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
I can get values at a vector of points from a gridded interp object, but not from a scaled version of that same object. intended, not, or my mistake?
this is related to #128 .
```
julia> xy = [3z+2y for z in linspace(0.0,1,10),y in 0:0.2:1]
julia> itp = interpolate((1:10,1:6),xy,(Gridded(Linear()),NoInterp()
))
10×6 Interpolations.GriddedInterpolation{Float64,2,Float64,Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Tuple{Array{Int64,1},Array{Int64,1}},0}:
0.0 0.4 0.8 1.2 1.6 2.0
0.333333 0.733333 1.13333 1.53333 1.93333 2.33333
0.666667 1.06667 1.46667 1.86667 2.26667 2.66667
1.0 1.4 1.8 2.2 2.6 3.0
1.33333 1.73333 2.13333 2.53333 2.93333 3.33333
1.66667 2.06667 2.46667 2.86667 3.26667 3.66667
2.0 2.4 2.8 3.2 3.6 4.0
2.33333 2.73333 3.13333 3.53333 3.93333 4.33333
2.66667 3.06667 3.46667 3.86667 4.26667 4.66667
3.0 3.4 3.8 4.2 4.6 5.0
julia> itp[3.3,1:6]
1×6 Array{Float64,2}:
0.766667 1.16667 1.56667 1.96667 2.36667 2.76667
julia> sitp =scale( itp ,linspace(0.0,1.0,10),1:6)
10×6 Interpolations.ScaledInterpolation{Float64,2,Interpolations.GriddedInterpolation{Float64,2,Float64,Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Tuple{Array{Int64,1},Array{Int64,1}},0},Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Interpolations.OnGrid,Tuple{LinSpace{Float64},UnitRange{Int64}}}:
3.0 3.4 3.8 4.2 4.6 5.0
6.0 6.4 6.8 7.2 7.6 8.0
9.0 9.4 9.8 10.2 10.6 11.0
12.0 12.4 12.8 13.2 13.6 14.0
15.0 15.4 15.8 16.2 16.6 17.0
18.0 18.4 18.8 19.2 19.6 20.0
21.0 21.4 21.8 22.2 22.6 23.0
24.0 24.4 24.8 25.2 25.6 26.0
27.0 27.4 27.8 28.2 28.6 29.0
30.0 30.4 30.8 31.2 31.6 32.0
julia> sitp[0.3,1:6]
ERROR: BoundsError: attempt to access 10×6 Interpolations.ScaledInterpolation{Float64,2,Interpolations.GriddedInterpolation{Float64,2,Float64,Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Tuple{Array{Int64,1},Array{Int64,1}},0},Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Interpolations.OnGrid,Tuple{LinSpace{Float64},UnitRange{Int64}}} at index [0.3,1:6]
in throw_boundserror(::Interpolations.ScaledInterpolation{Float64,2,Interpolations.GriddedInterpolation{Float64,2,Float64,Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Tuple{Array{Int64,1},Array{Int64,1}},0},Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Interpolations.OnGrid,Tuple{LinSpace{Float64},UnitRange{Int64}}}, ::Tuple{Float64,UnitRange{Int64}}) at ./abstractarray.jl:355
in checkbounds at ./abstractarray.jl:284 [inlined]
in _getindex at ./multidimensional.jl:270 [inlined]
in getindex(::Interpolations.ScaledInterpolation{Float64,2,Interpolations.GriddedInterpolation{Float64,2,Float64,Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Tuple{Array{Int64,1},Array{Int64,1}},0},Tuple{Interpolations.Gridded{Interpolations.Linear},Interpolations.NoInterp},Interpolations.OnGrid,Tuple{LinSpace{Float64},UnitRange{Int64}}}, ::Float64, ::UnitRange{Int64}) at ./abstractarray.jl:752
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.