pyinterp.backends.xarray.RegularGridInterpolator

class pyinterp.backends.xarray.RegularGridInterpolator(array: xarray.core.dataarray.DataArray, increasing_axes: bool = True, geodetic: bool = True)[source]

Bases: object

Interpolation on a regular grid in arbitrary dimensions

The data must be defined on a regular grid; the grid spacing however may be uneven. Linear, nearest neighbors, inverse distance weighting and bicubic interpolation are supported.

__init__(array: xarray.core.dataarray.DataArray, increasing_axes: bool = True, geodetic: bool = True)[source]

Initialize a new RegularGridInterpolator.

Parameters
  • array (xarray.DataArray) – The array defining the regular grid in n dimensions.

  • increasing_axes (bool, optional) – If this is true, check that the grid axes are increasing: the decreasing axes and the supplied grid will be flipped. Default to False.

  • geodetic (bool, optional) –

    True, if the axes of the grid represent longitudes and latitudes. In this case, the constructor will try to determine the axes of longitudes and latitudes according to the value of the attribute units using the following algorithm:

    • if the axis unit is one of the values of the set degrees_east, degree_east, degree_E, degrees_E, degreeE or degreesE the axis represents a longitude,

    • if the axis unit is one of the values of the set degrees_north, degree_north, degree_N, degrees_N or degreesN the axis represents a latitude.

    If this option is false, the axes will be considered Cartesian. Default to True.

Raises
  • ValueError – if the provided data array doesn’t define a longitude/latitude axis if geodetic is True

  • NotImplementedError – if the number of dimensions in the array is less than 2 or more than 4.

Methods

RegularGridInterpolator.__call__(coords[, ...])

Interpolation at coordinates

Attributes

RegularGridInterpolator.grid

Gets the instance of handling the regular grid for interpolations.

RegularGridInterpolator.ndim

Gets the number of array dimensions