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

Function test_weighted_mean_equal_weights

xarray/tests/test_weighted.py:171–182  ·  view source on GitHub ↗
(da, skipna, factor)

Source from the content-addressed store, hash-verified

169@pytest.mark.parametrize("skipna", (True, False))
170@pytest.mark.parametrize("factor", [1, 2, 3.14])
171def test_weighted_mean_equal_weights(da, skipna, factor):
172 # if all weights are equal (!= 0), should yield the same result as mean
173
174 da = DataArray(da)
175
176 # all weights as 1.
177 weights = xr.full_like(da, factor)
178
179 expected = da.mean(skipna=skipna)
180 result = da.weighted(weights).mean(skipna=skipna)
181
182 assert_equal(expected, result)
183
184
185@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

weightedMethod · 0.95
DataArrayClass · 0.90
assert_equalFunction · 0.90
meanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…