xoa.cf.CFCoordSpecs.search_dim

CFCoordSpecs.search_dim(obj, cf_arg=None, loc=None, errors='ignore')[source]

Search a dataarray/dataset for a dimension name according to its generic name or type

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

Parameters
  • obj (xarray.DataArray, xarray.Dataset) – Coordinate or data array

  • cf_arg (str, {"x", "y", "z", "t", "f"}, None) – One-letter imension type or generic name. When set to None, dmension type is inferred with get_axis() applied to obj

  • 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, dict, None – Dim name OR, dict with dim, type and cf_name keys if dim_type is None. None if nothing found.