pyinterp.regrid.cell_bounds

Contents

pyinterp.regrid.cell_bounds#

pyinterp.regrid.cell_bounds(centers, kind='cartesian')[source]#

Compute the bounds of the cells of an axis from their centers.

The inner bounds are the midpoints between consecutive centers; the outer bounds are extrapolated by half a step. Latitude bounds are clamped to [-90, 90]. A longitude axis whose cells cover the whole circle gets the midpoint between its last and first centers (modulo 360) as outer bounds, so that the cells cover exactly 360 degrees.

Parameters:
  • centers (ArrayLike) – Centers of the cells, monotonic.

  • kind (AxisKind) – Kind of the axis.

Returns:

The bounds of the cells, shape (n, 2), in the CF convention.

Return type:

NDArray[np.float64]