xarray.Dataset.bounds.add_bounds
xarray.Dataset.bounds.add_bounds#
- Dataset.bounds.add_bounds(axis, width=0.5)#
Add bounds for an axis using its coordinate points.
The coordinates must meet the following criteria in order to add bounds:
The axis for the coordinates are “X”, “Y”, “T”, or “Z”
Coordinates are a single dimension, not multidimensional
Coordinates are a length > 1 (not singleton)
Bounds must not already exist. * Determined by attempting to map the coordinate variable’s “bounds” attr (if set) to the bounds data variable of the same key.
- Parameters
axis (CFAxisName) – The CF-compliant axis name (“X”, “Y”, “T”, “Z”).
width (float, optional) – Width of the bounds relative to the position of the nearest points, by default 0.5.
- Returns
xr.Dataset – The dataset with bounds added.
- Raises
ValueError – If bounds already exist. They must be dropped first.