A recurring task in this project is to interpolate scattered data on a grid. The function griddata returns nan for the locations being outside the convex hull of the input data, for all but the nearest neighbor interpolant. A brute-force method to obtain interpolated values at those external points too is to perform two interpolations: one with the requested interpolant (linear, cubic, etc.) and one with the nearest neighbor. Then use the nearest neighbour interpolated values for the data points where the other interpolants return nan. A possibly faster way could be to perform the nearest neighbor interpolation only at the external points. Two approaches in mind:
A recurring task in this project is to interpolate scattered data on a grid. The function griddata returns
nan
for the locations being outside the convex hull of the input data, for all but the nearest neighbor interpolant. A brute-force method to obtain interpolated values at those external points too is to perform two interpolations: one with the requested interpolant (linear, cubic, etc.) and one with the nearest neighbor. Then use the nearest neighbour interpolated values for the data points where the other interpolants returnnan
. A possibly faster way could be to perform the nearest neighbor interpolation only at the external points. Two approaches in mind: