xoa.cf.CFSpecs.search_coord_from_dim

CFSpecs.search_coord_from_dim(da, dim, errors='ignore')[source]

Search a dataarray for a coordinate from a dimension name

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

Parameters:
  • da (xarray.DataArray) –

  • 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