xoa.cf.CFSpecs.search_dim

CFSpecs.search_dim(da, dim_type=None, loc='any', errors='ignore')[source]

Search a dataarray for a dimension name according to its type

First, scan the dimension names. Then, look for coordinates: either it has an ‘axis’ attribute, or it a known CF coordinate.

Parameters
  • da (xarray.DataArray) – Coordinate or data array

  • dim_type ({"x", "y", "z", "t", "f"}, None) – When set to None, it is inferred with get_axis()

  • loc ("any", letter) – Staggered grid location

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

    In case of errors

    • ignore: silently ignore

    • warn: emit a warning

    • raise: raise an exception

Returns

str, (str, str) – Dim name OR, (dim name, dim_type) if dim_type is None