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

Function test_weighted_quantile_nan

xarray/tests/test_weighted.py:251–264  ·  view source on GitHub ↗
(skipna)

Source from the content-addressed store, hash-verified

249
250@pytest.mark.parametrize("skipna", (True, False))
251def test_weighted_quantile_nan(skipna):
252 # Check skipna behavior
253 da = DataArray([0, 1, 2, 3, np.nan])
254 w = DataArray([1, 0, 1, 0, 1])
255 q = [0.5, 0.75]
256
257 result = da.weighted(w).quantile(q, skipna=skipna)
258
259 if skipna:
260 expected = DataArray(np.quantile([0, 2], q), coords={"quantile": q})
261 else:
262 expected = DataArray(np.full(len(q), np.nan), coords={"quantile": q})
263
264 assert_allclose(expected, result)
265
266
267@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

weightedMethod · 0.95
DataArrayClass · 0.90
assert_allcloseFunction · 0.90
quantileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…