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

Function test_shuffle_by

xarray/tests/test_groupby.py:3387–3401  ·  view source on GitHub ↗
(chunks, expected_chunks)

Source from the content-addressed store, hash-verified

3385 ],
3386)
3387def test_shuffle_by(chunks, expected_chunks):
3388 import dask.array
3389
3390 da = xr.DataArray(
3391 dims="x",
3392 data=dask.array.arange(10, chunks=chunks),
3393 coords={"x": [1, 2, 3, 1, 2, 3, 1, 2, 3, 0]},
3394 name="a",
3395 )
3396 ds = da.to_dataset()
3397
3398 for obj in [ds, da]:
3399 actual = obj.groupby(x=UniqueGrouper()).shuffle_to_chunks()
3400 assert_identical(actual, obj.sortby("x"))
3401 assert actual.chunksizes["x"] == expected_chunks
3402
3403
3404@requires_dask

Callers

nothing calls this directly

Calls 7

to_datasetMethod · 0.95
UniqueGrouperClass · 0.90
assert_identicalFunction · 0.90
arangeMethod · 0.80
shuffle_to_chunksMethod · 0.45
groupbyMethod · 0.45
sortbyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…