xoa.cf.CFSpecs.format_dataset
- CFSpecs.format_dataset(ds, cf_names=None, copy=True, format_coords=True, standardize=True, rename=True, rename_dims=True, specialize=False, attrs=True, replace_attrs=False)[source]
Format a whole dataset
- Parameters:
ds (xarray.Dataset) –
cf_names (dict, None) – Dict of names as keys and generic CF names as values. If not provided, CF names are 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
add_loc_to_name (bool) – Add loc to the name
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.
standardize (bool) –
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
rename
is False.attrs (bool, dict of 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?
- 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.
See also