timholy / Grid.jl

Interpolation and related operations on grids
MIT License
47 stars 26 forks source link

CoordInterpGrid does not work with InterpCubic in 2 dimensions #47

Open mathtd opened 9 years ago

mathtd commented 9 years ago

I used the example provided on the main page:

x = -1.0:0.1:1.0
y = 2.0:0.5:10.0
z_2d = Float64[sin(i+j) for i in x, j in y]

With these variables, InterpQuadratic works fine but if I try

z_2di = CoordInterpGrid((x,y), z_2d, BCnil, InterpCubic)

I get:

ERROR: DimensionMismatch("Coordinate lengths do not match grid size.")
 in CoordInterpGrid at /Users/mathieu/.julia/Grid/src/coord.jl:7
 in CoordInterpGrid at /Users/mathieu/.julia/Grid/src/coord.jl:13
 in CoordInterpGrid at /Users/mathieu/.julia/Grid/src/coord.jl:21
tomasaschan commented 9 years ago

We've seen something similar before (maybe #29?) and I thought we fixed it. It seems every time I try to fix one broken thing with InterpCubic, I break something else... =(

The problem is very likely to be somewhere around here - I unfortunately don't have time to take a deeper look at it at the moment, but if you're able to fix it a pull request is most welcome! =) Most likely, something similar to the specialization for BCfill, but specializing for InterpCubic with BCnil, is needed.