xoa.cf.CFVarSpecs.format_dataarray¶
-
CFVarSpecs.format_dataarray(da, name=None, loc=None, rename=True, attrs=True, standardize=True, specialize=False, rename_dim=True, replace_attrs=False, copy=True, add_loc_to_name=None)¶ Format a DataArray’s name and attributes
- Parameters
da (xarray.DataArray) –
name (str, None) – A CF name. If not provided, it guessed with
match().loc (str, {"any", None}, {"", False}) –
str: one of these locations
None or “any”: any
False or ‘””: no location
rename (bool) – Rename arrays when their name is set?
add_loc_to_name (None, bool) – Add the loc to the name, overriding the specs.
attrs (bool, dict) – If False, does not change attributes at all. If True, use Cf attributes. If a dict, use this dict.
replace_attrs (bool) – Replace existing attributes?
standardize (bool) –
specialize (bool) – Does not use the CF name for renaming, but the first name as listed in specs, which is generally a specialized one, like a name adopted by specialized dataset.
rename_dim (bool) – For a 1D array, rename the dimension if it has the same name as the array. Note that it is set to False, if
renameis False.copy (bool) – Force a copy (not of the data) in any case?
- Returns
xarray.DataArray, str, None – The formatted array or copy of it. The CF name, given or matching, if rename if False; and None if not matching.