JuliaMath / Interpolations.jl

Fast, continuous interpolation of discrete datasets in Julia
http://juliamath.github.io/Interpolations.jl/
Other
518 stars 110 forks source link

Documentation: what exactly is meant by "irregular grid"? #558

Open scheidan opened 1 year ago

scheidan commented 1 year ago

Maybe this is just a problem of wording

The Readme and the documentation tells me that "Currently this package supports [...] irregular grids." I interpreted this (wrongly as it turns out) that I can interpolate points arbitrarily scattered. It seems I'm not alone with this: this issue #552 clarifies that "irregular" means "rectilinear", and not arbitrary irregular.

Writing explicitly: "Currently this package supports interpolation on Cartesian and rectilinear grids" would have helped a lot.

For reference: Wikipedia for Regular grids Wikipedia for Unstructured grid or irregular grid

sob727 commented 1 year ago

Unclear to me what is supported. On v0.14.7 this happens:

julia> cubic_spline_interpolation([1,2,5],[4,2,4])
ERROR: MethodError: no method matching cubic_spline_interpolation(::Vector{Int64}, ::Vector{Int64})

Closest candidates are:
  cubic_spline_interpolation(::AbstractRange, ::AbstractVector; bc, extrapolation_bc)
   @ Interpolations ~/.julia/packages/Interpolations/nDwIa/src/convenience-constructors.jl:12
  cubic_spline_interpolation(::Tuple{Vararg{AbstractRange, N}}, ::AbstractArray{T, N}; bc, extrapolation_bc) where {N, T}
   @ Interpolations ~/.julia/packages/Interpolations/nDwIa/src/convenience-constructors.jl:29

Stacktrace:
 [1] top-level scope
   @ REPL[17]:1

julia> linear_interpolation([1,2,5],[4,2,4])
3-element extrapolate(interpolate((::Vector{Int64},), ::Vector{Int64}, Gridded(Linear())), Throw()) with element type Float64:
 Ratios.SimpleRatio{Int64}(4, 1)
 Ratios.SimpleRatio{Int64}(2, 1)
 Ratios.SimpleRatio{Int64}(12, 3)