xarray.Dataset.cf.add_canonical_attributes#

Dataset.cf.add_canonical_attributes(override=False, skip=None, verbose=False, source=None)#

Add canonical CF attributes to variables with standard names.

Attributes are parsed from the official CF standard name table [1]. This function adds an entry to the “history” attribute.

Parameters:
overridebool

Override existing attributes.

skipstr, iterable, optional

Attribute(s) to skip: {"units", "grib", "amip", "description"}.

verbosebool

Print added attributes to screen.

sourceoptional

Path of cf-standard-name-table.xml or file object containing XML data. If None, use the latest CF standard name table (requires pooch).

Returns:
DataArray or Dataset

With attributes added.

Notes

The "units" attribute is never added to datetime-like variables.

References