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

Tue Sep 21 15:18:14 CDT 2010

```On Tue, Sep 21, 2010 at 8:52 PM, Robert Kern <robert.kern@gmail.com> wrote:
> 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.

Thanks again for explanations. I think that I understand now the problem
of using Delaunay triangularization for my rectilinear grids.
Unfortunately it looks that I
have a problem: my grids are rectilinear, but non-uniform (not equally
spaced) and
often incomplete (some points are missing). And to make things worse:
they are often in 6D or more...
And the facts are: Delaunay seems inappriopriate, the map_coordinates
require equally spaced grids,
Rbf method produces smooth but non-linear interpolation, and nobody
implemented natural neighbors in N-dimensions...

I think that I will stay with RbF interpolation...I wonder if it is
possible to tune RbF basis functions to perform linear interpolation
on my weird N-D grids... ?

Thanks,