caterva2.download#

caterva2.download(dataset, localpath=None, urlbase=None, auth_cookie=None)#

Downloads a dataset to local storage.

Note: If the dataset is a regular file and Blosc2 is installed, it will be downloaded and decompressed. Otherwise, it will remain compressed in its .b2 format.

Parameters:
  • dataset (Path) – Path to the dataset.

  • localpath (Path, optional) – Local path to save the downloaded dataset. Defaults to the current working directory if not specified.

  • urlbase (str, optional) – Base URL to query. Defaults to caterva2.sub_urlbase_default.

  • auth_cookie (str, optional) – HTTP cookie for authorization.

Returns:

The path to the downloaded file.

Return type:

Path

Examples

>>> import caterva2 as cat2
>>> import pathlib
>>> urlbase = 'https://demo.caterva2.net'
>>> path = 'example/ds-2d-fields.b2nd'
>>> cat2.subscribe('example', urlbase)
'Ok'
>>> cat2.download(pathlib.Path(path), urlbase=urlbase)
PosixPath('example/ds-2d-fields.b2nd')