pyinterp.backends.xarray.RegularGridInterpolator

class pyinterp.backends.xarray.RegularGridInterpolator(array: xr.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.

Parameters:
  • array – The array defining the regular grid in n dimensions.

  • increasing_axes – 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

    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.

Attributes

grid

Gets the instance of handling the regular grid for interpolations.

ndim

Gets the number of array dimensions.

Special Methods

__call__(coords[, method, bounds_error, ...])

Interpolation at coordinates.

__getstate__()

Helper for pickle.

__setstate__(state)