pyinterp.regrid.cells

Contents

pyinterp.regrid.cells#

pyinterp.regrid.cells(value, kind='cartesian', name='the axis')[source]#

Return the centers and the bounds of the cells of an axis.

Parameters:
  • value (ArrayLike) – Centers of the cells, a 1D array of at least two values, or their bounds, an (n, 2) array as the CF bounds variables.

  • kind (AxisKind) – Kind of the axis.

  • name (str) – Name of the axis, used in the error messages.

Returns:

The centers, shape (n,), and the bounds, shape (n, 2), of the cells. The centers of cells given by their bounds are their midpoints.

Raises:

ValueError – If the bounds of the cells cannot be inferred from their centers, because there is only one, or if the shape of the array is invalid.

Return type:

tuple[NDArray[np.float64], NDArray[np.float64]]