def slices_from_chunks(chunks):
    cumdims = [list(accumulate(add, (0,) + bds[:-1])) for bds in chunks]
    shapes = product(*chunks)
    starts = product(*cumdims)
    return [tuple(slice(s, s+dim) for s, dim in zip(start, shape))
                for start, shape in zip(starts, shapes)]
Translate chunks tuple to a set of slices in product order
dataset/ETHPy150Open dask/dask/dask/array/core.py/slices_from_chunks