()
| 1830 | |
| 1831 | |
| 1832 | def test_minimize_graph_size(): |
| 1833 | # regression test for https://github.com/pydata/xarray/issues/8409 |
| 1834 | ds = Dataset( |
| 1835 | { |
| 1836 | "foo": ( |
| 1837 | ("x", "y", "z"), |
| 1838 | dask.array.ones((120, 120, 120), chunks=(20, 20, 1)), |
| 1839 | ) |
| 1840 | }, |
| 1841 | coords={"x": np.arange(120), "y": np.arange(120), "z": np.arange(120)}, |
| 1842 | ) |
| 1843 | |
| 1844 | mapped = ds.map_blocks(lambda x: x) |
| 1845 | graph = dict(mapped.__dask_graph__()) |
| 1846 | |
| 1847 | numchunks = {k: len(v) for k, v in ds.chunksizes.items()} |
| 1848 | for var in "xyz": |
| 1849 | actual = len([key for key in graph if var in key[0]]) |
| 1850 | # assert that we only include each chunk of an index variable |
| 1851 | # is only included once, not the product of number of chunks of |
| 1852 | # all the other dimensions. |
| 1853 | # e.g. previously for 'x', actual == numchunks['y'] * numchunks['z'] |
| 1854 | assert actual == numchunks[var], (actual, numchunks[var]) |
| 1855 | |
| 1856 | |
| 1857 | def test_idxmin_chunking(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…