xoa.plot.get_label#
- xoa.plot.get_label(da, units=True, pretty=True)[source]#
Get a label like
"Long name [units]"for a data arrayMissing attributes are completed from the current meta specs with
xoa.meta.MetaSpecs.fill_attrs().- Parameters:
da (xarray.DataArray)
units (bool) – Add the units between brackets.
pretty (bool) – Write the units in a nicer way, like
°Cinstead ofdegrees_celsiusandm s⁻¹instead ofm s-1, and skip the unit1of dimensionless numbers.
- Returns:
str
Example
In [1]: da = xr.DataArray([1.], dims="x", name="temp") In [2]: get_label(da) Out[2]: 'Sea water in situ temperature [°C]' In [3]: get_label(da, units=False) Out[3]: 'Sea water in situ temperature'