xoa.cf.CFCoordSpecs.get_dims

CFCoordSpecs.get_dims(obj, cf_args, allow_positional=False, positions='tzyx', single=True, errors='warn')[source]

Get the data array dimensions names from their type or generic CF name

Parameters:
  • obj (xarray.DataArray, xarray.Dataset) – Array/dataset to scan

  • cf_args (list) – List of letters among “x”, “y”, “z”, “t” and “f”, or generic names.

  • allow_positional (bool) – Fall back to positional dimension of types is unkown.

  • positions (str) – Default expected position of dim per type in obj starting from the end.

  • single (bool) – If True, return the first item found or None. If False, return a possible empty list of found items.

  • errors ({'ignore', 'warn', 'raise'}) –

    In case of errors

    • 'ignore': silently ignore

    • 'warn': emit a warning

    • 'raise': raise an exception

Returns:

tuple, tuple(list) – Tuple of dimension names or None when the dimension is not found