petitRADTRANS.cli.prt_cli#

Command line interface to download petitRADTRANS input data files.

Attributes#

Functions#

_get_html(options, url, timeout)

_path2keeper_url(→ str)

Convert an input_data path to its Keeper equivalent.

_reporthook(count, block_size, total_size[, time_start])

Display downloading progress on the terminal.

_reporthook_sys_output(percent, progress_size, ...)

Terminal output of download progress

download_input_data(→ [http.client.HTTPResponse, None])

Download a petitRADTRANS input data file.

get_keeper_files_url_paths(path[, ext, timeout, ...])

Module Contents#

petitRADTRANS.cli.prt_cli.__megabyte = 9.5367431640625e-07#
petitRADTRANS.cli.prt_cli._get_html(options, url, timeout)#
petitRADTRANS.cli.prt_cli._path2keeper_url(path: str, path_input_data: str = None, url_input_data: str = None) str#

Convert an input_data path to its Keeper equivalent.

petitRADTRANS.cli.prt_cli._reporthook(count: int, block_size: int, total_size: int, time_start=0.0)#

Display downloading progress on the terminal.

Args:

count: number of the data block being downloaded block_size: (B) size of a data block total_size: (B) total size of the data time_start: (s) time at which the download started

petitRADTRANS.cli.prt_cli._reporthook_sys_output(percent: int, progress_size: float, total_size: float, speed: float, eta: [datetime.timedelta, str])#

Terminal output of download progress

Args:

percent: progression percentage progress_size: (MB) amount of data downloaded total_size: (MB) amount of data to download speed: (MB.s-1) data downloading rate eta: (hh:mm:ss) time before download completion

petitRADTRANS.cli.prt_cli.download_input_data(destination, source=None, rewrite=False, path_input_data=None, url_input_data=None, byte_amount=8192) [http.client.HTTPResponse, None]#

Download a petitRADTRANS input data file. If source is None, the source URL is automatically deduced from the destination file.

Args:

destination: file to be downloaded (path to the file where the downloaded data are saved) source: URL of the source rewrite: if True, the data are downloaded even if destination is an already existing local file path_input_data: local path to petitRADTRANS’ input_data folder url_input_data: URL petitRADTRANS’ input data byte_amount: amount of bytes to be read from the URL response

Returns:

If a new file has been downloaded, return a HTTPResponse object, and None otherwise.

petitRADTRANS.cli.prt_cli.get_keeper_files_url_paths(path, ext='h5', timeout=3, path_input_data=None, url_input_data=None)#