xarray_aggregate
- PlasmaCalcs.tools.xarray_tools.xarray_agg_stats.xarray_aggregate(array, f, dim=None, *, keep=None, promote_dims_if_needed=True, missing_dims='raise', **kw_agg_f)
returns array aggregated along dim using f.
f: callable or str
function to aggregate along dim. E.g. xarray.DataArray.sum, or ‘mean’.Call signature should be like: f(array, dim, **kw).str –> will call getattr(array, f)(dim, **kw).dim: None, str, or iterable of strsapply operation along these dimensionskeep: None, str, or iterable of strsapply operation along all except for these dimensions.(can provide keep or dim, but not both.)promote_dims_if_needed: boolwhether to promote non-dimension coords to dimensions.if False, raise DimensionKeyError if any relevant coord is not already a dimension.missing_dims: str in (‘ignore’, ‘warn’, ‘raise’)what to do if any coord is not found:‘ignore’ –> do nothing.‘warn’ –> raise a warning.‘raise’ –> raise DimensionKeyError.if not ‘raise’, any missing dims will be skipped.additional kwargs are passed to f.