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

Method _weighted_mean

xarray/computation/weighted.py:281–293  ·  view source on GitHub ↗

Reduce a DataArray by a weighted ``mean`` along some dimension(s).

(
        self,
        da: T_DataArray,
        dim: Dims = None,
        skipna: bool | None = None,
    )

Source from the content-addressed store, hash-verified

279 return self._reduce(da, self.weights, dim=dim, skipna=skipna) # type: ignore[return-value]
280
281 def _weighted_mean(
282 self,
283 da: T_DataArray,
284 dim: Dims = None,
285 skipna: bool | None = None,
286 ) -> T_DataArray:
287 """Reduce a DataArray by a weighted ``mean`` along some dimension(s)."""
288
289 weighted_sum = self._weighted_sum(da, dim=dim, skipna=skipna)
290
291 sum_of_weights = self._sum_of_weights(da, dim=dim)
292
293 return weighted_sum / sum_of_weights
294
295 def _weighted_var(
296 self,

Callers

nothing calls this directly

Calls 2

_weighted_sumMethod · 0.95
_sum_of_weightsMethod · 0.95

Tested by

no test coverage detected