cf_xarray.bounds_to_vertices(bounds, bounds_dim, core_dims=None, order='counterclockwise')[source]#
Convert bounds variable to vertices. There are 2 covered cases:
  • 1D coordinates, with bounds of shape (N, 2), converted to vertices of shape (N+1,)

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


The bounds to convert.


The name of the bounds dimension of bounds (the one of length 2 or 4).

order{‘counterclockwise’, ‘clockwise’, None}

Valid for 2D coordinates only (i.e. bounds of shape (…, N, M, 4), ignored otherwise. Order the bounds are given in, assuming that ax0-ax1-upward is a right handed coordinate system, where ax0 and ax1 are the two first dimensions of bounds. If None, the counterclockwise version is computed and then verified. If the check fails the clockwise version is returned. See Notes for more details.

core_dimslist, optional

List of core dimensions for apply_ufunc. This must not include bounds_dims. The shape of (*core_dims, bounds_dim) must be (N, 2) or (N, M, 4).


Either of shape (N+1,) or (N+1, M+1). New vertex dimensions are named from the initial dimension and suffix “_vertices”.


Getting the correct axes “order” is tricky. There are no real standards for dimension names or even axes order, even though the CF conventions mentions the ax0-ax1-upward (counterclockwise bounds) as being the default. Moreover, xarray can tranpose data without raising any warning or error, which make attributes unreliable.


Please refer to the CF conventions document :