xoa.cf.CFSpecs.format_coord

CFSpecs.format_coord(da, cf_name=None, loc=None, copy=True, format_coords=True, standardize=True, rename=True, specialize=False, attrs=True, replace_attrs=False, rename_dims=True)[source]

Format a coordinate array

Parameters:
  • da (xarray.DataArray) –

  • cf_name (str, None) – A generic 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

  • 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) – 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.