Interpolate: BoundsError thrown in the interior


I am using version 1.0.0.
When using Interpolations, I am thrown a BoundsError for an evaluation inside the domain of the grid. I saw there were some already opened issues such as #244) #245 but I could not see the solution error. I would be very grateful if someone could help me. It works for some interior values (0.2) or (0.6898956231658479641) but not for some others (0.09697441557910233) as you can see below - with no clear pattern for me.
Many thanks!

using Interpolations D_row = ([0.1, 1.05, 2.0],) Sb= [0.006167227715362695, 0.03223397506618452, 0.052729713214987387] Sb_func = interpolate(D_row, Sb, Gridded(Linear())) Sb_func(0.09697441557910233)
BoundsError: attempt to access 3-element interpolate((::Array{Float64,1},), ::Array{Float64,1}, Gridded(Linear())) with element type Float64 at index [0.09697441557910233]

[1] throw_boundserror(::Interpolations.GriddedInterpolation{Float64,1,Float64,Gridded{Linear},Tuple{Array{Float64,1}}}, ::Tuple{Float64}) at .\abstractarray.jl:484
[2] (::Interpolations.GriddedInterpolation{Float64,1,Float64,Gridded{Linear},Tuple{Array{Float64,1}}})(::Float64) at C:\Users\arquie.julia\packages\Interpolations\gioj0\src\gridded\indexing.jl:3
[3] top-level scope at In[8]:5

WhereaseSb_func(0.2) or Sb_func(0.6898956231658479641) works perfectly.


The BoundsError occurs because you are trying to interpolate outside the domain. In your example, the domain is taken from D_row so Sb_func(x) can be evaluated for 0.1 <= x <= 2.0. Since 0.09697441557910233 < 0.1 you get a BoundsError.

If you want to extrapolate, you can do that with Sb_ext = extrapolate(Sb_fun, Flat()) for example. See the Interpolations.jl README for more info.


Thanks a lot. You are right, it was indeed outside of the domain, sorry about that. And thanks for the extrapolate syntax.