()
| 1039 | |
| 1040 | |
| 1041 | def test_dataarray_with_dask_coords(): |
| 1042 | import toolz |
| 1043 | |
| 1044 | x = xr.Variable("x", da.arange(8, chunks=(4,))) |
| 1045 | y = xr.Variable("y", da.arange(8, chunks=(4,)) * 2) |
| 1046 | data = da.random.random((8, 8), chunks=(4, 4)) + 1 |
| 1047 | array = xr.DataArray(data, dims=["x", "y"]) |
| 1048 | array.coords["xx"] = x |
| 1049 | array.coords["yy"] = y |
| 1050 | |
| 1051 | assert dict(array.__dask_graph__()) == toolz.merge( |
| 1052 | data.__dask_graph__(), x.__dask_graph__(), y.__dask_graph__() |
| 1053 | ) |
| 1054 | |
| 1055 | (array2,) = dask.compute(array) |
| 1056 | assert not dask.is_dask_collection(array2) |
| 1057 | |
| 1058 | assert all(isinstance(v._variable.data, np.ndarray) for v in array2.coords.values()) |
| 1059 | |
| 1060 | |
| 1061 | def test_basic_compute(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…