MCPcopy Index your code
hub / github.com/dask/dask / test_positional_indexer_multiple_variables

Function test_positional_indexer_multiple_variables

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

Source from the content-addressed store, hash-verified

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

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…