xcdat.create_bounds#
- xcdat.create_bounds(axis, coord_var)[source]#
Creates bounds for an axis using coordinate points as midpoints.
This method uses each coordinate point as the midpoint between its lower and upper bound.
- Parameters:
axis (
CFAxisKey
) – The CF axis key (“X”, “Y”, “T” ,”Z”).coord_var (
xr.DataArray
) – The coordinate variable for the axis.
- Returns:
xr.DataArray
– The axis coordinate bounds.- Raises:
ValueError – If coords dimensions does not equal 1.
Notes
Based on [2]
iris.coords._guess_bounds
and [3]cf_xarray.accessor.add_bounds
.For temporal coordinates
create_bounds
will attempt to set the bounds to the start and end of each time step’s period. Time axes are expected to be composed ofcftime
objects.References