MCPcopy Create free account
hub / github.com/dask/dask / test_positional_indexer_multiple_variables

Function test_positional_indexer_multiple_variables

dask/array/tests/test_xarray.py:65–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64
65def test_positional_indexer_multiple_variables():
66 n = 200
67 ds = xr.Dataset(
68 data_vars=dict(
69 a=(
70 ["x", "y", "time"],
71 da.random.randint(1, 100, (10, 10, n), chunks=(-1, -1, n // 2)),
72 ),
73 b=(
74 ["x", "y", "time"],
75 da.random.randint(1, 100, (10, 10, n), chunks=(-1, -1, n // 2)),
76 ),
77 ),
78 coords=dict(
79 x=list(range(10)),
80 y=list(range(10)),
81 time=np.arange(n),
82 ),
83 )
84 indexer = np.arange(n)
85 np.random.shuffle(indexer)
86 result = ds.isel(time=indexer)
87 graph = result.__dask_graph__()
88 assert len({k for k in graph if "shuffle-taker" in k}) == 4
89 assert len({k for k in graph if "shuffle-sorter" in k}) == 2
90
91
92@pytest.mark.parametrize("compute", [True, False])

Callers

nothing calls this directly

Calls 4

randintMethod · 0.45
arangeMethod · 0.45
shuffleMethod · 0.45
__dask_graph__Method · 0.45

Tested by

no test coverage detected