:mod:`eggshell.utils` ===================== .. py:module:: eggshell.utils .. autoapi-nested-parse:: Utitility functions. Module Contents --------------- .. data:: paths .. data:: LOGGER .. function:: archive(resources, format='tar', dir_output=None, mode=None) Compresses a list of files into an archive. :param resources: list of files to be stored in archive :param format: archive format. Options: tar (default), zip :param dir_output: path to output folder (default: tempory folder) :param mode: for format='tar': 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing for foramt='zip': read "r", write "w" or append "a" :return str: archive path/filname.ext .. function:: download_file(url, out=None, verify=False) .. function:: local_path(url) .. function:: download(url, cache=False) Downloads URL using the Python requests module to the current directory. :param cache: if True then files will be downloaded to a cache directory. :param url: url adress of the target file location :return str: filename .. function:: extract_archive(resources, dir_output=None) extracts archives (tar/zip) :param resources: list of archive files (if netCDF files are in list, they are passed and returnd as well in the return). :param dir_output: define a directory to store the results (default: tempory folder). :return list: [list of extracted files] .. function:: rename_complexinputs(complexinputs) TODO: this method is just a dirty workaround to rename input files according to the url name. .. function:: address_append(address) Formats a URL/URI to be more easily read with libraries such as "rasterstats" :param address: URL/URI to a potential zip or tar file :return: URL/URI prefixed for archive type