ClimoDataArrayAccessor.cumaverage

ClimoDataArrayAccessor.cumaverage(dim, reverse=False, weight=None, skipna=None, **kwargs)[source]

Return the cumulative mass-weighted average.

Parameters
  • dim (dim-spec) – The averaging dimension. Weights are applied automatically using cell measure variables stored in the coodinates and referenced by the cell_measures attribute (see add_cell_measures).

  • skipna (bool, optional) – Whether to skip NaN values.

  • reverse (bool, optional) – Whether to change the direction of the accumulation to right-to-left.

  • **kwargs – Passed to truncate. Used to limit bounds of integration.

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.