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

Function test_weighted_weights_nan_raises_dask

xarray/tests/test_weighted.py:44–55  ·  view source on GitHub ↗
(as_dataset, weights)

Source from the content-addressed store, hash-verified

42@pytest.mark.parametrize("as_dataset", (True, False))
43@pytest.mark.parametrize("weights", ([np.nan, 2], [np.nan, np.nan]))
44def test_weighted_weights_nan_raises_dask(as_dataset, weights):
45 data: DataArray | Dataset = DataArray([1, 2]).chunk({"dim_0": -1})
46 if as_dataset:
47 data = data.to_dataset(name="data")
48
49 weights = DataArray(weights).chunk({"dim_0": -1})
50
51 with raise_if_dask_computes():
52 weighted = data.weighted(weights)
53
54 with pytest.raises(ValueError, match=r"`weights` cannot contain missing values."):
55 weighted.sum().load()
56
57
58@requires_cftime

Callers

nothing calls this directly

Calls 7

DataArrayClass · 0.90
raise_if_dask_computesFunction · 0.90
chunkMethod · 0.45
to_datasetMethod · 0.45
weightedMethod · 0.45
loadMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…