ClimoDataArrayAccessor.average¶
- ClimoDataArrayAccessor.average(dim=None, **kwargs)[source]¶
Return the mass-weighted average.
- Parameters
dim (dim-spec or {‘area’, ‘volume’}, optional) – The averaging dimension(s). Weights are applied automatically using cell measure variables stored in the coodinates and referenced by the
cell_measures
attribute (seeadd_cell_measures
). If not specified, the entire 3-dimensional domain is used.weight (xr.DataArray, optional) – Optional additional weighting.
skipna (bool, optional) – Whether to skip NaN values.
**kwargs – Passed to
truncate
. Used to limit the bounds of the averaging.
Notes
ClimoPy makes an artifical distinction between the “mean” as a naive, unweighted average and the “average” as a cell measures-aware, mass-weighted average.
This was added as a dedicated accessor function rather than creating a custom
Weighted
object because the selection of mass weights depends on the dimension(s) passed by the user.