wolfhece.pydownloader
Author: HECE - University of Liege, Pierre Archambeau Date: 2025
Copyright (c) 2025 University of Liege. All rights reserved.
This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.
Module Contents
- class wolfhece.pydownloader.DownloadType(*args, **kwds)[source]
Bases:
enum.Enum
Enum to define the type of download.
- class wolfhece.pydownloader.DownloadFiles(*args, **kwds)[source]
Bases:
enum.Enum
Enum to define the files to download.
- class wolfhece.pydownloader.DonwloadDirectories(*args, **kwds)[source]
Bases:
enum.Enum
Enum to define the directories for downloads.
- wolfhece.pydownloader.GITLAB_EXAMPLE = 'https://gitlab.uliege.be/HECE/wolf_examples/-/raw/main'[source]
- wolfhece.pydownloader.GITLAB_EXAMPLE_GPU = 'https://gitlab.uliege.be/HECE/wolfgpu_examples/-/raw/main'[source]
- wolfhece.pydownloader.GITLAB_MODREC_DATA_VESDRE = 'https://gitlab.uliege.be/api/v4/projects/4933'[source]
- wolfhece.pydownloader.GITLAB_MODREC_DATA_VESDRE_FILES = 'https://gitlab.uliege.be/api/v4/projects/4933/repository/files/'[source]
- wolfhece.pydownloader.clean_url(url: str) str [source]
Clean the URL by removing any query parameters or fragments.
- Parameters:
url (str) – The URL to clean.
- Returns:
The cleaned URL.
- Return type:
str
- wolfhece.pydownloader.download_file(url: str, destination: str | pathlib.Path = None, download_type: DownloadType = DownloadType.HTTP, load_from_cache: bool = True, token: str = None, file_type: DownloadType = None) pathlib.Path [source]
Download a file from the specified URL to the destination path.
- Parameters:
url (str) – The URL of the file to download.
destination (Union[str, Path]) – The path where the file will be saved.
download_type (DownloadType) – The type of download (HTTP, HTTPS, FTP).
- Returns:
None
- Raises:
requests.HTTPError – If the HTTP request fails.
- wolfhece.pydownloader.toys_dataset(dir: str, file: str, load_from_cache: bool = True)[source]
Download toy files from the WOLFHECE dataset.
- Parameters:
dir (str) – The directory where the file will be saved.
file (str) – The name of the file to download.
- Returns:
The path to the downloaded file.
- wolfhece.pydownloader.download_gpu_simulation(url: str, destination: str | pathlib.Path, load_from_cache: bool = True)[source]
Download a GPU simulation file from the WOLFHECE dataset.
- Parameters:
url (str) – The URL of the GPU simulation file to download.
destination (str | Path) – The path where the file will be saved.
load_from_cache (bool) – If True, will not download the file if it already exists.
- wolfhece.pydownloader.toys_gpu_dataset(dir: str, dirweb: str = None, load_from_cache: bool = True)[source]
Download toy simulatoin files from the WOLFHECE dataset for GPU.
- Parameters:
dir (str) – The directory where the file will be saved.
dirweb (str) – The directory of the files to download.
- Returns:
The path to the downloaded file.
- wolfhece.pydownloader.toys_laz_grid(dir: str, file: str, load_from_cache: bool = True)[source]
Download toy LAZ or GRIDWOLF files from the WOLFHECE dataset.
- Parameters:
dir (str) – The directory where the file will be saved.
file (str) – The name of the file to download.
- Returns:
The path to the downloaded directory.
- wolfhece.pydownloader.laz_grid_from_url(url: str, dir: str, file: str, load_from_cache: bool = True)[source]
Download toy LAZ or GRIDWOLF files from an external URL.
- Parameters:
url (str) – The base URL where the files are located.
dir (str) – The directory where the file will be saved.
file (str) – The name of the file to download.
- Returns:
The path to the downloaded directory.
- wolfhece.pydownloader.check_status(url: str, token: str = None) bool [source]
Check the status of a URL.
- Parameters:
url (str) – The URL to check.
token (str) – The private token for authentication (if required).
- Returns:
True if the URL is accessible, False otherwise.
- Return type:
bool
- wolfhece.pydownloader.download_modrec_vesdre_file(directory: str, filename: str, token: str = None, load_from_cache: bool = True, file_type: DownloadFiles = None) pathlib.Path [source]
Download a file from the ModRec Vesdre dataset.
- Parameters:
directory (str) – The directory where the file is located (relative to the repository root).
filename (str) – The name of the file to download.
token (str) – The private token for authentication (if required).
load_from_cache (bool) – If True, will not download the file if it already exists.
- Returns:
The path to the downloaded file.
- Return type:
Path