scipy.interpolate.interp2d

class scipy.interpolate.interp2d(x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=nan)

Interpolate over a 2D grid.

Parameters :

x, y : 1D arrays

Arrays defining the coordinates of a 2D grid. If the points lie on a regular grid, x can specify the column coordinates and y the row coordinates, e.g.:

x = [0,1,2];  y = [0,3,7]

otherwise x and y must specify the full coordinates, i.e.:

x = [0,1,2,0,1,2,0,1,2];  y = [0,0,0,3,3,3,7,7,7]

If x and y are multi-dimensional, they are flattened before use.

z : 1D array

The values of the interpolated function on the grid points. If z is a multi-dimensional array, it is flattened before use.

kind : {‘linear’, ‘cubic’, ‘quintic’}

The kind of interpolation to use.

copy : bool

If True, then data is copied, otherwise only a reference is held.

bounds_error : bool

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

fill_value : number

If provided, the value to use for points outside of the interpolation domain. Defaults to NaN.

Raises :

ValueError when inputs are invalid. :

See also

bisplrep, bisplev

BivariateSpline
a more recent wrapper of the FITPACK routines

Previous topic

scipy.interpolate.piecewise_polynomial_interpolate

Next topic

scipy.interpolate.Rbf

This Page