xoa.cf.CFCoordSpecs.search_from_dim

CFCoordSpecs.search_from_dim(obj, dim, errors='ignore')[source]

Search a dataarray/dataset for a coordinate from a dimension name

It first searches for a coordinate with a different name and that is the only one having this dimension. Then check if it is an index. Then look for coordinates with the same type like x, y, etc.

Parameters:
  • obj (xarray.DataArray, xarray.Dataset) –

  • dim (str) –

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

    In case of errors

    • 'ignore': silently ignore

    • 'warn': emit a warning

    • 'raise': raise an exception

Returns:

xarray.DataArray, None – An coordinate array or None