blosc2.Proxy.fetch#

Proxy.fetch(item: slice | list[slice] | None = None) NDArray | SChunk#

Get the container used as cache with the requested data updated.

Parameters:

item (slice or list of slices, optional) – If not None, only the chunks that intersect with the slices in items will be retrieved if they have not been already.

Returns:

out – The local container used to cache the already requested data.

Return type:

NDArray or SChunk

Examples

>>> import numpy as np
>>> import blosc2
>>> data = np.arange(20).reshape(10, 2)
>>> ndarray = blosc2.asarray(data)
>>> proxy = blosc2.Proxy(ndarray)
>>> slice_data = proxy.fetch((slice(0, 3), slice(0, 2)))
>>> slice_data[:3, :2]
[[0 1]
[2 3]
[4 5]]