xarray_sum
- PlasmaCalcs.tools.xarray_tools.xarray_agg_stats.xarray_sum(array, dim=None, *, keep=None, skipna=False, promote_dims_if_needed=True, missing_dims='raise', **kw)
Like xarray sum but first promotes dims if needed, and accepts ‘keep’ option.
dim: None, str, or iterable of strs
apply 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.)skipna: boolwhether to skip NaNs. Unlike xarray’s builtin sum(), the default here is False.False –> NaNs in input produce NaNs in same locations in output,e.g. [[1,nan,2],[3,4,5]] summing along dim 0 becomes [4, nan, 7].True –> equivalent to replacing all NaNs with 0 before summing.e.g. [[1,nan,2],[3,4,5]] summing along dim 0 becomes [4, 4, 7].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 array.sum.