MCPcopy
hub / github.com/pydata/xarray / _mean

Method _mean

xarray/computation/rolling.py:195–205  ·  view source on GitHub ↗
(self, keep_attrs, **kwargs)

Source from the content-addressed store, hash-verified

193 return method
194
195 def _mean(self, keep_attrs, **kwargs):
196 result = self.sum(keep_attrs=False, **kwargs)
197 # use dtype of result for casting of count
198 # this allows for GH #7062 and GH #8864, fixes GH #10340
199 result /= duck_array_ops.astype(
200 self.count(keep_attrs=False), dtype=result.dtype, copy=False
201 )
202 if keep_attrs:
203 result.attrs = self.obj.attrs
204
205 return result
206
207 _mean.__doc__ = _ROLLING_REDUCE_DOCSTRING_TEMPLATE.format(name="mean")
208

Callers

nothing calls this directly

Calls 3

countMethod · 0.95
sumMethod · 0.45
astypeMethod · 0.45

Tested by

no test coverage detected