scipy.interpolate.interpn

scipy.interpolate.interpn(points, values, xi, method='linear', bounds_error=True, fill_value=nan, spline_dim_error=True)[source]

Multidimensional interpolation on regular grids.

Parameters:

points : tuple of ndarray of float, with shapes (m1, ), …, (mn, )

The points defining the regular grid in n dimensions.

values : array_like, shape (m1, …, mn, …)

The data on the regular grid in n dimensions.

xi : ndarray of shape (…, ndim)

The coordinates to sample the gridded data at

method : str, optional

The method of interpolation to perform. Supported are “nearest”, “linear”, “slinear”, “cubic”, “quintic”, and “splinef2d”. “splinef2d” is only supported for 2-dimensional data.

bounds_error : bool, optional

If True, when interpolated values are requested outside of the domain of the input data, a ValueError is raised. If False, then fill_value is used.

fill_value : number, optional

If provided, the value to use for points outside of the interpolation domain. If None, values outside the domain are extrapolated. Extrapolation is not supported by the “splinef2d” method.

spline_dim_error : bool, optional

If spline_dim_error=True and an order k spline interpolation method is used, then if any dimension has fewer points than k + 1, an error will be raised. If spline_dim_error=False, then the spline interpolant order will be reduced as needed on a per-dimension basis. Default is True (raise an error).

Returns:

values_x : ndarray, shape xi.shape[:-1] + values.shape[ndim:]

Interpolated values at input coordinates.

See also

NearestNDInterpolator
Nearest neighbour interpolation on unstructured data in N dimensions
LinearNDInterpolator
Piecewise linear interpolant on unstructured data in N dimensions
RegularGridInterpolator
Linear and nearest-neighbor Interpolation on a regular grid in arbitrary dimensions
RectBivariateSpline
Bivariate spline approximation over a rectangular mesh

Notes

New in version 0.14.