xarray.DataArray.cf.add_canonical_attributes#

DataArray.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

1

https://cfconventions.org/standard-names.html