I have a ndarray (Z) with some 500000 elements on a rectangular grid (X, Y).
Now I want to interpolate values at some 100 locations in x,y which are not necessarily on the grid.
I have some code working in Matlab:
data = interp2(X,Y,Z, x,y);
However, when I try to use the same approach with scipy.interpolate I get various errors depending on the method. For example interp2d fails with MemoryError if i specify kind = 'linear'
and "OverflowError: Too many data points to interpolate" if I specify kind='cubic'
. I also tried Rbf
and bisplev
but they also fail.
So the question is: Is there an interpolation function which allows for interpolations of large matrices? Is there another solution to the problem? (Or do I have to code a function which picks the suitable area around the points to interpolate and calls then interp2d?)
In addition: How to do this with complex numbers?