# [SciPy-Dev] Problem with N-dimensional interpolation using a new griddata function for N>=3

Robert Kern robert.kern@gmail....
Tue Sep 21 13:52:13 CDT 2010

```On Tue, Sep 21, 2010 at 13:35, Adam Machnik <amachnik@gmail.com> wrote:
> Thank you very much for your explanations. Indeed, I would like to use
> the n-linear
> interpolation.The problem is that I cannot find any python package that
> can do this on N-D dimension on the incomplete and irregular set of points.
> For regular grids I use "scipy.ndimage.interpolation.map_coordinates" and it
> works perfectly.

"Trilinear interpolation" is a very specific kind of interpolation. It
is only defined on regular grids. map_coordinates() is a
generalization, I believe. Trilinear interpolation is not a general
term for linear interpolation methods on 3D points.

> I use also "scipy.interpolate.Rbf " to perform interpolation
> on irregular set of points using radial basis functions and it works
> also great.
> But when using Rbf the interpolation is nonlinear, and often inconsistent.
> The only package that I have found up to now is this new griddata() function.
> I hope that it will work for me when fixed these issues with the
> handling of degenerated
> zero volume cases on interpolation level.
> Pauli Vitranen, who wrote this function, says that it should be
> possible, so I wait with impatience
> to test it when available.

Regardless of whether it is possible to fix the Delaunay
triangularization for these cases, I am trying to convey that the
interpolation scheme is still not appropriate for rectilinear grids.
If I have a point roughly in the middle of a grid cell, it will only
get information from the simplex it happens to fall in rather than
from all of the surrounding grid points. Which simplex it happens to
fall in will be arbitrary because of the degeneracy. This will create
inconsistencies across your grid as some grid cells will be broken up
one way and other grid cells will be broken up others.

There is no single interpolation method that works well for all
inputs. The properties of the data are intimately associated with the
interpolation technique that is best for it. For rectilinear grids,
map_coordinates is the better choice. For scattered point clouds,
griddata will work fine. Natural neighbors would be better, but we'll
have to wait until someone implements that for 3D.

--
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
```