blosc2.C2Array.__getitem__#

C2Array.__getitem__(slice_: int | slice | Sequence[slice]) np.ndarray#

Get a slice of the array.

Parameters:

slice_ (int, slice, tuple of ints and slices, or None) – The slice to fetch.

Returns:

out – A numpy.ndarray containing the data slice.

Return type:

numpy.ndarray

Examples

>>> import blosc2
>>> urlbase = "https://demo.caterva2.net/"
>>> path = "example/dir1/ds-2d.b2nd"
>>> remote_array = blosc2.C2Array(path, urlbase=urlbase)
>>> data_slice = remote_array[3:5, 1:4]
>>> data_slice.shape
(2, 3)
>>> data_slice[:]
[[61 62 63]
[81 82 83]]