Dataset.bounds.add_missing_bounds(axes=['X', 'Y', 'T'])#

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:

  1. Axis is either X”, “Y”, “T”, or “Z”

  2. Coordinates are a single dimension, not multidimensional

  3. Coordinates are a length > 1 (not singleton)

  4. 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" and ds.time_bnds is present in the dataset.

  5. For the “T” axis, its coordinates must be composed of datetime-like objects (np.datetime64 or cftime). This method designed to operate on time axes that have constant temporal resolution with annual, monthly, daily, or sub-daily time frequencies. Alternate frequencies (e.g., pentad) are not supported.


axes (List[str]) – List of CF axes that function should operate on, by default [“X”, “Y”, “T”]. Options include “X”, “Y”, “T”, or “Z”.