iterate_chunks

Contents

iterate_chunks#

glue.utils.array.iterate_chunks(shape, chunk_shape=None, n_max=None)[source]#

Given a data shape and a chunk shape (or maximum chunk size), iteratively return slice objects that can be used to slice the array.

Parameters:
shapeiterable

The shape of the n-dimensional array.

chunk_shapeiterable, optional

The shape of the chunks to be sliced into, needs to fit within shape.

n_maxint, optional

The maximum number of elements per chunk.

Notes

Exactly one of chunk_shape or n_max must be specified.