Gridded Interplation with NoInterp fails when specifying nodes

I have a function f(z,k) where I am trying to interpolate along k. Both z and k may be non-uniform. I do not want any interpolation along z. I am using Interpolations.jl and trying out the following:

julia> interpolate((1:2:9, 1:5), ones(5,5), (NoInterp(), Gridded(Linear())))
ERROR: for NoInterp knot vector should be Base.OneTo(5), got 1:2:9

I’m not sure what’s going on here, is it not possible to specify nodes alongside NoInterp()? This works as expected using any other interpolation specifier, eg.

julia> interpolate((1:2:9, 1:5), ones(5,5), (Gridded(Constant()), Gridded(Linear())))
5×5 interpolate((1:2:9,1:5), ::Array{Float64,2}, (Gridded(Constant()), Gridded(Linear()))) 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

From what I saw digging through Interpolations’ code I believe the reason is that NoInterp is not on grid, which means you can only specify a UnitRange as acceptable knots.
Internally the code checks that axes(ones(5,5)) is the same as the supplied knots. However, in this case axes returns an object of type Base.OneTo(5) != 1:2:9.

I’m not sure what is the rationale behind this but I can see two approaches to bypassing the problem:

  1. Specify the knots along the first dimensions to be 1:5 as well (not sure if you actually need the spacing to be different than 1)
  2. Define a new function that re-adjusts your indices and use that instead: itp(x, y) = interpolate((1:5, 1:5), ones(5,5), (NoInterp(), Gridded(Linear())))(Int((1 + x)/2), y)