cf.Data.todict¶
-
Data.
todict
(optimize_graph=True)[source]¶ Return a dictionary of the dask graph key/value pairs.
New in version 3.15.0.
See also
- Parameters
optimize_graph
:bool
If True, the default, then prior to being converted to a dictionary, the graph is optimised to remove unused chunks. Note that optimising the graph can add a considerable performance overhead.
- Returns
dict
The dictionary of the dask graph key/value pairs.
Examples
>>> d = cf.Data([1, 2, 3, 4], chunks=2) >>> d.todict() {('array-2f41b21b4cd29f757a7bfa932bf67832', 0): array([1, 2]), ('array-2f41b21b4cd29f757a7bfa932bf67832', 1): array([3, 4])} >>> e = d[0] >>> e.todict() {('getitem-153fd24082bc067cf438a0e213b41ce6', 0): (<function dask.array.chunk.getitem(obj, index)>, ('array-2f41b21b4cd29f757a7bfa932bf67832', 0), (slice(0, 1, 1),)), ('array-2f41b21b4cd29f757a7bfa932bf67832', 0): array([1, 2])} >>> e.todict(optimize_graph=False) {('array-2f41b21b4cd29f757a7bfa932bf67832', 0): array([1, 2]), ('array-2f41b21b4cd29f757a7bfa932bf67832', 1): array([3, 4]), ('getitem-153fd24082bc067cf438a0e213b41ce6', 0): (<function dask.array.chunk.getitem(obj, index)>, ('array-2f41b21b4cd29f757a7bfa932bf67832', 0), (slice(0, 1, 1),))}