[SciPy-User] interpolation with CloughTocher2DInterpolator

Pauli Virtanen pav at iki.fi
Fri Apr 1 13:31:29 EDT 2011


Fri, 01 Apr 2011 16:06:33 +0000, Evan Mason wrote:
[clip]
> But this approach doesn't seem to be possible with
> CloughTocher2DInterpolator, as every call needs x, y, z:
> 
> CloughTocher2DInterpolator(points, values, tol=1e-6)

You can in the meantime do this:

import numpy as np
import scipy.interpolate.interpnd as interpnd

class MyInterpolator(interpnd.CloughTocher2DInterpolator):
    def __init__(self, tri, values, fill_value=np.nan,
                 tol=1e-6, maxiter=400):
        interpnd.NDInterpolatorBase.__init__(self, tri.points, values, ndim=2,
                                             fill_value=fill_value)
        self.tri = tri
        self.grad = interpnd.estimate_gradients_2d_global(self.tri, self.values,
                                                          tol=tol, maxiter=maxiter)

tri = Delaunay(points)
ip = MyInterpolator(tri, values)

> My question is whether this functionality could be built into future
> releases of CloughTocher2DInterpolator?

Certainly. If you want to make sure about this, file an enhancement 
request at http://projects.scipy.org/scipy/

	Pauli




More information about the SciPy-User mailing list