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

Pauli Virtanen pav@iki...
Wed Apr 24 14:58:22 CDT 2013

24.04.2013 22:49, Antonio kirjoitti:
> In the meanwhile I also tried to use
> scipy.interpolate.LinearNDInterpolator. The documentation is scarce
> but I managed to make it work. The only caveat is that it requires a
> meshgrid of the coordinates in which data is computed (I don't know if
> is possible to avoid this). However the interpolation on 1e6 points
> runs in 414ms in this case.
> Here I attach the complete example that perform the same interpolation
> with RectBivariateSpline, map_coordinates and LinearNDInterpolator.

Yeah, the LinearNDInterpolator (and griddata) are for scattered data
interpolation, and using them for data that's already on a grid is
wasteful --- the algorithm doesn't know the data is on a grid and has to
compute a triangulation on which to perform the interpolation.

Pauli Virtanen

More information about the SciPy-User mailing list