xarray.Dataset.bounds.add_missing_bounds#
- Dataset.bounds.add_missing_bounds(axes)#
Adds missing coordinate bounds for supported axes in the Dataset.
This function loops through the Dataset’s axes and attempts to adds bounds to its coordinates if they don’t exist. “X”, “Y” , and “Z” axes bounds are the midpoints between coordinates. “T” axis bounds are based on the time frequency of the coordinates.
An axis must meet the following criteria to add bounds for it, otherwise they are ignored:
Axis is either X”, “Y”, “T”, or “Z”
Coordinates are a single dimension, not multidimensional
Coordinates are a length > 1 (not singleton)
Bounds must not already exist
Coordinates are mapped to bounds using the “bounds” attr. For example, bounds exist if
ds.time.attrs["bounds"]
is set to"time_bnds"
andds.time_bnds
is present in the dataset.
For the “T” axis, its coordinates must be composed of datetime-like objects (np.datetime64 or cftime).
- Parameters
axes (
List[str]
) – List of CF axes that function should operate on. Options include “X”, “Y”, “T”, or “Z”.- Returns
xr.Dataset