xoa.coords.get_positive_attr#
- xoa.coords.get_positive_attr(da, zdim=None)[source]#
Get the positive attribute of a dataset or data array
Searches for the
positiveattribute in the vertical coordinate or falls back to the current meta specs default.- Parameters:
zdim (None, str) – The index coordinate name that is supposed to have this attribute, which is usually the vertical dimension.
- Returns:
None, “up” or “down”
Example
>>> depth = xr.DataArray([-100., -50., 0.], dims="z", ... attrs={"positive": "up"}) >>> da = xr.DataArray([1, 2, 3], dims="z", ... coords={"depth": depth}) >>> get_positive_attr(da) 'up'