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

Function test_apply_dask_parallelized_one_arg

xarray/tests/test_computation.py:1213–1229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1211
1212@requires_dask
1213def test_apply_dask_parallelized_one_arg() -> None:
1214 import dask.array as da
1215
1216 array = da.ones((2, 2), chunks=(1, 1))
1217 data_array = xr.DataArray(array, dims=("x", "y"))
1218
1219 def parallel_identity(x):
1220 return apply_ufunc(identity, x, dask="parallelized", output_dtypes=[x.dtype])
1221
1222 actual = parallel_identity(data_array)
1223 assert isinstance(actual.data, da.Array)
1224 assert actual.data.chunks == array.chunks
1225 assert_identical(data_array, actual)
1226
1227 computed = data_array.compute()
1228 actual = parallel_identity(computed)
1229 assert_identical(computed, actual)
1230
1231
1232@requires_dask

Callers

nothing calls this directly

Calls 3

computeMethod · 0.95
parallel_identityFunction · 0.85
assert_identicalFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…