decompress
- typhon.files.decompress(filename, tmpdir=None, target=None)[source]
- Temporarily decompress file for reading. - Returns the full path to the uncompressed temporary file or the original filename if it was not compressed. - Supported compression formats are: gzip, bzip2, zip, and lzma (Python 3.3 or newer only). - This function is tailored for use in a with statement. It uses a context manager to automatically remove the decompressed file after use. - Parameters:
- filename (str) – Input file. 
- tmpdir (str) – Path to directory for temporary storage of the uncompressed file. The directory must exist. The default is the temporary dir of the system. 
- target (str) – With this you can set the name of the decompressed file directly. Caution: this file will be overwritten with the decompressed content and deleted after leaving the with-block. 
 
- Yields:
- Generator containing the path to the input filename. 
 - Example - >>> tmpdir = '/tmp' >>> with typhon.files.decompress('datafile.nc.gz', tmpdir) as file: >>> f = netCDF4.Dataset(file) >>> #...