MCPcopy
hub / github.com/pydata/xarray / test_dataarray_with_dask_coords

Function test_dataarray_with_dask_coords

xarray/tests/test_dask.py:1041–1058  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1039
1040
1041def 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
1061def test_basic_compute():

Callers

nothing calls this directly

Calls 6

__dask_graph__Method · 0.95
arangeMethod · 0.80
mergeMethod · 0.45
__dask_graph__Method · 0.45
computeMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…