I am trying to interpolate data from an unstructured mesh M1 to another unstructured mesh M2. For this, scipy.interpolate.griddata
A solution is to use the LinearNDInterpolator Scipy function with a pre-computed Delaunay triangulation:
from scipy.spatial import Delaunay
from scipy.interpolate import LinearNDInterpolator
tri = Delaunay(mesh1) # Compute the triangulation
# Perform the interpolation with the given values:
interpolator = LinearNDInterpolator(tri, values_mesh1)
values_mesh2 = interpolator(mesh2)
mesh1
is a (number of points * dim) array.
Note: CloughTocher2DInterpolator could be used for non-linear interpolation. griddata
uses either LinearNDInterpolator
or CloughTocher2DInterpolator
.