[SciPy-user] 2-D interpolation of irregularly spaced data

Robert Kern robert.kern@gmail....
Mon Sep 15 01:31:41 CDT 2008

On Sun, Sep 14, 2008 at 09:02, Emmanuelle Gouillart
<emmanuelle.gouillart@normalesup.org> wrote:
>        Hello,
>        I have an irregular 2-D mesh, and 1-D data measured at the
> vertices of the mesh (the mesh is finer where the data vary more
> rapidly), and I need to interpolate the data at other (also irregularly
> spaced) points. To do so, I use the delaunay scikit and its
> NNInterpolator which can take an iregular mesh. The problem is that I
> cannot call the interpolator with irregularly spaced points, so that my
> code is running very slowly now. Here is a minimal example of what I do
> now (with regular grids and few points for clarity):
> ***
> import scikits.delaunay as d
> def evolve(positions, mesh, values):
>    tri = d.Triangulation(mesh[0], mesh[1])
>    interpolator = d.NNInterpolator(tri, values)
>    return  array([interpolator(x,y) for (x,y) in positions.T]).ravel()

NNInterpolator.__call__() can take arrays, not just scalars. For the
greatest efficiency, try to make sure adjacent points are close to
each other.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the SciPy-user mailing list