Closed jimwatt closed 8 years ago
No :) If you have a cartesian grid (equal spacing) then you can calculate the index to jump to easily.
If you really have a bottleneck you can try adapting https://github.com/JohannesBuchner/npyinterp
But first have a close look at https://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.ndimage.interpolation.map_coordinates.html#scipy.ndimage.interpolation.map_coordinates and check if it might solve your problem. Check https://github.com/JohannesBuchner/regulargrid/blob/master/regulargrid/cartesiangrid.py ; there are also a lot of stackoverflow questions about it if you have troubles applying it.
I would like to interpolate a vector field defined on R^3. For each point (x,y,z) on a regular grid, I have a data value (u,v,w). I would like to then find the interpolated value (ui,vi,wi) at the new point (xi,yi,zi). I can use scipy.interpolate.RegularGridInterpolator to interpolate each component of the vector field separately, but this seems to be wasteful. If I do interpolation for one component, then determining the component for the other two components should be very easy, and should use the same interpolation coefficients. The flavor of behavior can be attained using scipy.interpolate.interp1d, for instance. Is it possible to use regulargrid to do fast interpolation of vector fields?