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

Function test_weighted_var_equal_weights

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

Source from the content-addressed store, hash-verified

417@pytest.mark.parametrize("skipna", (True, False))
418@pytest.mark.parametrize("factor", [1, 2, 3.14])
419def test_weighted_var_equal_weights(da, skipna, factor):
420 # if all weights are equal (!= 0), should yield the same result as var
421
422 da = DataArray(da)
423
424 # all weights as 1.
425 weights = xr.full_like(da, factor)
426
427 expected = da.var(skipna=skipna)
428 result = da.weighted(weights).var(skipna=skipna)
429
430 assert_equal(expected, result)
431
432
433@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

weightedMethod · 0.95
DataArrayClass · 0.90
assert_equalFunction · 0.90
varMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…