petitRADTRANS.cli.prt_cli
=========================

.. py:module:: petitRADTRANS.cli.prt_cli

.. autoapi-nested-parse::

   Command line interface to download petitRADTRANS input data files.
   # TODO should probably be renamed keeper_cli or prt_keeper_cli in v4.0.0



Attributes
----------

.. autoapisummary::

   petitRADTRANS.cli.prt_cli.__megabyte


Functions
---------

.. autoapisummary::

   petitRADTRANS.cli.prt_cli._import_selenium
   petitRADTRANS.cli.prt_cli._import_bs4
   petitRADTRANS.cli.prt_cli._get_html
   petitRADTRANS.cli.prt_cli._path2keeper_url
   petitRADTRANS.cli.prt_cli._reporthook
   petitRADTRANS.cli.prt_cli._reporthook_sys_output
   petitRADTRANS.cli.prt_cli.download_input_data
   petitRADTRANS.cli.prt_cli.get_keeper_files_url_paths


Module Contents
---------------

.. py:function:: _import_selenium()

   Lazily import selenium components (only needed for Keeper downloads).


.. py:function:: _import_bs4()

   Lazily import BeautifulSoup (only needed for Keeper downloads).


.. py:data:: __megabyte
   :value: 9.5367431640625e-07


.. py:function:: _get_html(options, url, timeout)

.. py:function:: _path2keeper_url(path: str, path_input_data: str = None, url_input_data: str = None) -> str

   Convert an input_data path to its Keeper equivalent.


.. py:function:: _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


.. py:function:: _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


.. py:function:: 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.


.. py:function:: get_keeper_files_url_paths(path, ext='h5', timeout=3, path_input_data=None, url_input_data=None)

