pyinterp.backends.xarray.Grid2D

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

Bases: pyinterp.grid.Grid2D

Builds a Grid2D from the Xarray data provided.

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

Initialize a new 2D Cartesian Grid.

Parameters
  • data_array (xarray.DataArray) – Provided data

  • 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

  • ValueError – if the number of dimensions is different of 2.

Methods

Grid2D.bicubic(coords, *args, **kwargs)

Evaluate the interpolation defined for the given coordinates

Grid2D.bivariate(coords, *args, **kwargs)

Evaluate the interpolation defined for the given coordinates

Attributes

Grid2D.array

Gets the values handled by this instance.

Grid2D.x

Gets the X-Axis handled by this instance.

Grid2D.y

Gets the Y-Axis handled by this instance