pyinterp.backends.xarray.Grid4D

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

Bases: pyinterp.grid.Grid4D

Builds a Grid4D from the Xarray data provided.

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

Initialize a new 4D Cartesian Grid.

Parameters
  • data_array (xarray.DataArray) – Provided data array

  • 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 4.

Methods

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

Evaluate the interpolation defined for the given coordinates

Grid4D.quadrivariate(coords, *args, **kwargs)

Evaluate the interpolation defined for the given coordinates

Attributes

Grid4D.array

Gets the values handled by this instance.

Grid4D.u

Gets the U-Axis handled by this instance.

Grid4D.x

Gets the X-Axis handled by this instance.

Grid4D.y

Gets the Y-Axis handled by this instance

Grid4D.z

Gets the Z-Axis handled by this instance.