MCPcopy Index your code
hub / github.com/pydata/xarray / _weighted_var

Method _weighted_var

xarray/computation/weighted.py:295–307  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

293 return weighted_sum / sum_of_weights
294
295 def _weighted_var(
296 self,
297 da: T_DataArray,
298 dim: Dims = None,
299 skipna: bool | None = None,
300 ) -> T_DataArray:
301 """Reduce a DataArray by a weighted ``var`` along some dimension(s)."""
302
303 sum_of_squares = self._sum_of_squares(da, dim=dim, skipna=skipna)
304
305 sum_of_weights = self._sum_of_weights(da, dim=dim)
306
307 return sum_of_squares / sum_of_weights
308
309 def _weighted_std(
310 self,

Callers 1

_weighted_stdMethod · 0.95

Calls 2

_sum_of_squaresMethod · 0.95
_sum_of_weightsMethod · 0.95

Tested by

no test coverage detected