Grid Structures#

Xarray Backends#

High-level grid containers compatible with xarray.

These classes provide a convenient interface for creating interpolators directly from xarray.DataArray objects. They automatically handle coordinate systems, including temporal axes and geodetic units.

Grid2D(data_array)

Build a Grid2D from Xarray data.

Grid3D(data_array)

Build a Grid3D from Xarray data.

Grid4D(data_array)

Build a Grid4D from Xarray data.

Xarray Accessors#

Once both pyinterp and xarray are imported, in either order, xarray.DataArray and xarray.Dataset objects have a pyinterp accessor. Importing pyinterp does not import xarray: the accessor is registered when xarray is imported. Its interp method follows xarray.DataArray.interp() and returns labelled results:

import pyinterp

result = ds.mss.pyinterp.interp(lon=lons, lat=lats, method="bicubic")

DataArrayAccessor(data_array)

Interpolate a data array with da.pyinterp.

DatasetAccessor(dataset)

Interpolate the variables of a dataset with ds.pyinterp.

Core Grids#

The fundamental grid structure used internally by the library.

Grid(...)

Overloaded function.

GridHolder

N-dimensional Cartesian grid with runtime dtype detection.

Core Grids Aliases#

Aliases of pyinterp.Grid used in type hints; they are the same class at runtime.

Grid1D

Alias for pyinterp.Grid with one axis.

Grid2D

Alias for pyinterp.Grid with two axes.

Grid3D

Alias for pyinterp.Grid with three axes; the third one may be a pyinterp.TemporalAxis.

Grid4D

Alias for pyinterp.Grid with four axes; the third one may be a pyinterp.TemporalAxis.