scipy.interpolate.RegularGridInterpolator.gradient

RegularGridInterpolator.gradient(xi, method=None)[source]

Return the computed gradients at the specified point.

The gradients are computed as the interpolation itself is performed, but are cached and returned separately by this method.

If the point for evaluation differs from the point used to produce the currently cached gradient, the interpolation is re-performed in order to return the correct gradient.

Parameters:

xi : ndarray of shape (…, ndim)

The coordinates to sample the gridded data at

method : str, optional

The method of interpolation to perform. Supported are slinear’, ‘cubic’, and ‘quintic’. Default is None, which will use the method defined at the construction of the interpolation object instance.

Returns:

gradient : ndarray of shape (…, ndim)

gradient vector of the gradients of the interpolated values with respect to each value in xi