eggshell.utils
¶
Utitility functions.
Module Contents¶
-
eggshell.utils.
archive
(resources, format='tar', dir_output=None, mode=None)[source]¶ Compresses a list of files into an archive.
Parameters: - resources – list of files to be stored in archive
- format – archive format. Options: tar (default), zip
- dir_output – path to output folder (default: tempory folder)
- 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
-
eggshell.utils.
download
(url, cache=False)[source]¶ Downloads URL using the Python requests module to the current directory.
Parameters: - cache – if True then files will be downloaded to a cache directory.
- url – url adress of the target file location
Return str: filename
-
eggshell.utils.
extract_archive
(resources, dir_output=None)[source]¶ extracts archives (tar/zip)
Parameters: - resources – list of archive files (if netCDF files are in list, they are passed and returnd as well in the return).
- dir_output – define a directory to store the results (default: tempory folder).
Return list: [list of extracted files]