dask.array.core.unify_chunks

dask.array.core.unify_chunks(*args, **kwargs)[source]

Unify chunks across a sequence of arrays

This utility function is used within other common operations like dask.array.core.map_blocks() and dask.array.core.blockwise(). It is not commonly used by end-users directly.

Parameters
*args: sequence of Array, index pairs

Sequence like (x, ‘ij’, y, ‘jk’, z, ‘i’)

Returns
chunkssdict

Map like {index: chunks}.

arrayslist

List of rechunked arrays.

See also

common_blockdim

Examples

>>> import dask.array as da
>>> x = da.ones(10, chunks=((5, 2, 3),))
>>> y = da.ones(10, chunks=((2, 3, 5),))
>>> chunkss, arrays = unify_chunks(x, 'i', y, 'i')
>>> chunkss
{'i': (2, 3, 2, 3)}
>>> x = da.ones((100, 10), chunks=(20, 5))
>>> y = da.ones((10, 100), chunks=(4, 50))
>>> chunkss, arrays = unify_chunks(x, 'ij', y, 'jk', 'constant', None)
>>> chunkss  
{'k': (50, 50), 'i': (20, 20, 20, 20, 20), 'j': (4, 1, 3, 2)}
>>> unify_chunks(0, None)
({}, [0])