caterva2.Dataset#

class caterva2.Dataset(name, root, urlbase, auth_cookie=None)#

Represents a dataset as a Blosc2 container within a file.

This class is not intended to be instantiated directly; it should be accessed through a Root instance.

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

  • root (str) – The name of the root repository.

  • urlbase (str, optional) – The base URL for the subscriber queries. Default to caterva2.sub_urlbase_default.

  • auth_cookie (str, optional) – A cookie for authorizing HTTP requests.

Examples

>>> import caterva2 as cat2
>>> ds = cat2.Dataset('ds-1d.b2nd', 'example', 'https://demo.caterva2.net')
>>> ds.name
'ds-1d.b2nd'
>>> ds[1:10]
array([1, 2, 3, 4, 5, 6, 7, 8, 9])
Attributes:
vlmeta

Returns a mapping of metalayer names to their respective values.

This is used to access variable-length metalayers (user attributes) associated with the file.

>>> import caterva2 as cat2
>>> root = cat2.Root('example', 'https://demo.caterva2.net')
>>> file = root['ds-sc-attr.b2nd']
>>> file.vlmeta
{'a': 1, 'b': 'foo', 'c': 123.456}

Methods

copy(dst)

Copies the file to a new location.

download([localpath])

Downloads the file to storage.

fetch([slice_])

Fetches a slice of the dataset.

get_download_url()

Retrieves the download URL for the file.

move(dst)

Moves the file to a new location.

remove()

Removes the file from the remote repository.

__init__(name, root, urlbase, auth_cookie=None)#

Methods

__init__(name, root, urlbase[, auth_cookie])

copy(dst)

Copies the file to a new location.

download([localpath])

Downloads the file to storage.

fetch([slice_])

Fetches a slice of the dataset.

get_download_url()

Retrieves the download URL for the file.

move(dst)

Moves the file to a new location.

remove()

Removes the file from the remote repository.

Attributes

vlmeta

Returns a mapping of metalayer names to their respective values.