The function now raises a ValueError if the downsample factor is not greater than 0 - downsample_shape
wrap_index includes handling negative indices and indices that exceed the bounds of the array.
view_as_blocks includes checking that the block shape is a divisor of the array shape to avoid errors, and removing the unnecessary numpy.ravel() call.
I am curious what your use case is for negative indexing with the wrap_index function, as it is only used when writing files which must be in increasing order.
downsample_shape
wrap_index
includes handling negative indices and indices that exceed the bounds of the array.view_as_blocks
includes checking that the block shape is a divisor of the array shape to avoid errors, and removing the unnecessary numpy.ravel() call.