wolfhece.pydownloader ===================== .. py:module:: wolfhece.pydownloader .. autoapi-nested-parse:: 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 --------------- .. py:class:: DownloadType(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.pydownloader.DownloadType :parts: 1 :private-bases: Enum to define the type of download. .. py:attribute:: HTTP :value: 'http' .. py:attribute:: HTTPS :value: 'https' .. py:attribute:: FTP :value: 'ftp' .. py:class:: DownloadFiles(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.pydownloader.DownloadFiles :parts: 1 :private-bases: Enum to define the files to download. .. py:attribute:: WOLFARRAYS :value: ('bin', 'bin.txt') .. py:attribute:: TIFARRAYS :value: ('tif',) .. py:attribute:: TIFFARRAYS :value: ('tiff',) .. py:attribute:: SHPFILES :value: ('shp', 'dbf', 'shx', 'prj', 'cpg', 'sbn', 'sbx') .. py:attribute:: GPKGFILES :value: ('gpkg',) .. py:attribute:: VECFILES :value: ('vec', 'vec.extra') .. py:attribute:: VECZFILES :value: ('vecz', 'vecz.extra') .. py:attribute:: PROJECTFILES :value: ('proj',) .. py:class:: DonwloadDirectories(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.pydownloader.DonwloadDirectories :parts: 1 :private-bases: Enum to define the directories for downloads. .. py:attribute:: GDBFILES :value: ('gdb',) .. py:data:: GITLAB_EXAMPLE :value: 'https://gitlab.uliege.be/HECE/wolf_examples/-/raw/main' .. py:data:: DATADIR .. py:function:: clean_url(url: str) -> str Clean the URL by removing any query parameters or fragments. :param url: The URL to clean. :type url: str :return: The cleaned URL. :rtype: str .. py:function:: download_file(url: str, destination: Union[str, pathlib.Path] = None, download_type: DownloadType = DownloadType.HTTP, load_from_cache: bool = True) -> None Download a file from the specified URL to the destination path. :param url: The URL of the file to download. :param destination: The path where the file will be saved. :param download_type: The type of download (HTTP, HTTPS, FTP). :type url: str :type destination: Union[str, Path] :type download_type: DownloadType :return: None :raises requests.HTTPError: If the HTTP request fails. .. py:function:: toys_dataset(dir: str, file: str, load_from_cache: bool = True) Download toy files from the WOLFHECE dataset. :param dir: The directory where the file will be saved. :param file: The name of the file to download. :type dir: str :type file: str :return: The path to the downloaded file.