download_dataset#
- rapidtools.datasets.download_dataset(dataset_names: str | list[str], output_dir: str | Path = '.') list[Path][source]#
Download all files associated with one or more datasets from the registry.
Uses atomic writing (downloading to a temporary file first) to ensure that interrupted downloads do not result in corrupted files. Files that already exist in
output_dirare not re-downloaded. Network or I/O failures for an individual file are logged and skipped so the remaining files can still be fetched.- Parameters:
dataset_names (str | list[str]) – A single descriptive name of the dataset, or a list of names (e.g., ‘eaton_patch1’ OR [‘eaton_patch1’, ‘eaton_patch2’]). Input is case-insensitive and ignores leading/trailing whitespace.
output_dir (str | Path, optional) – Directory where files should be saved. Defaults to the current working directory (‘.’).
- Returns:
list[Path] – A flat list of absolute paths to all successfully downloaded (or already present) files, in registry order.
- Raises:
ValueError – If any of the requested dataset names do not exist in the registry. The message includes a “Did you mean” suggestion when a close match exists.
Example
>>> from rapidtools.datasets import download_dataset >>> paths = download_dataset( ... ['Eaton_Patch1', ' mapillary_token '], output_dir='data' ... ) >>> [p.name for p in paths] ['eaton_patch_20250214.tiff', 'mapillary_token.txt']