caterva2.File.fetch#

File.fetch(slice_=None)#

Fetch a slice of a dataset.

Equivalent to __getitem__().

Parameters:

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

Returns:

The slice of the dataset.

Return type:

numpy.ndarray

Examples

>>> import caterva2 as cat2
>>> root = cat2.Root('example', 'https://demo.caterva2.net')
>>> ds = root['ds-1d.b2nd']
>>> ds.fetch(1)
array(1)
>>> ds.fetch(slice(0, 10))
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])