[SciPy-User] 2D interpolation on random points of a function defined on a regular grid

Zachary Pincus zachary.pincus at yale.edu
Tue Apr 23 21:41:28 EDT 2013


> I'm trying (with no success) to compute the interpolated values of a 2D function that is known on a regular grid X,Y.  Although the function is defined on a regular grid I want to compute the interpolation on arbitrary positions.

scipy.ndimage.map_coordinates() is precisely what you're looking for. It offers spline interpolation of various orders (0 = nearest neighbor, 1 = linear, etc.), various boundary conditions, and so forth. The inputs are a bit tricky to explain, but the examples in the docstring give the general gist.

Zach




More information about the SciPy-User mailing list