cf_xarray.vertices_to_bounds#

cf_xarray.vertices_to_bounds(vertices, out_dims=('bounds', 'x', 'y'))[source]#

Convert vertices to CF-compliant bounds.

There are 2 covered cases:
  • 1D coordinates, with vertices of shape (N+1,), converted to bounds of shape (N, 2)

  • 2D coordinates, with vertices of shape (N+1, M+1). converted to bounds of shape (N, M, 4).

Parameters:
verticesDataArray

The vertices to convert. Must be of shape (N + 1) or (N + 1, M + 1).

out_dimsSequence[str],

The name of the dimension in the output. The first is the ‘bounds’ dimension and the following are the coordinate dimensions.

Returns:
DataArray

Either of shape (2, N) or (4, N, M).

References

Please refer to the CF conventions document : http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#cell-boundaries.