caterva2.fetch#

caterva2.fetch(path, urlbase=None, slice_=None, auth_cookie=None)#

Fetch (a slice of) the data in a dataset.

Parameters:
  • path (str) – The path of the dataset.

  • urlbase (str) – The base of URLs of the subscriber to query. Default is caterva2.sub_urlbase_default.

  • slice_ (str) – The slice to fetch (the whole dataset if missing).

  • auth_cookie (str) – An optional HTTP cookie for authorizing access.

Returns:

The slice of the dataset.

Return type:

numpy.ndarray

Examples

>>> import caterva2 as cat2
>>> urlbase = 'https://demo.caterva2.net'
>>> cat2.subscribe('example', urlbase)
'Ok'
>>> cat2.fetch('example/ds-2d-fields.b2nd', urlbase, "0:2, 0:2")
array([[(0.0000000e+00, 1.       ), (5.0002502e-05, 1.00005  )],
       [(1.0000500e-02, 1.0100005), (1.0050503e-02, 1.0100505)]],
      dtype=[('a', '<f4'), ('b', '<f8')])