pooch.Decompress¶
-
class
pooch.
Decompress
(method='auto')[source]¶ Processor that decompress a file and returns the decompressed version.
Use with
pooch.Pooch.fetch
to decompress a downloaded data file so that it can be easily opened. Useful for data files that take a long time to decompress (exchanging disk space for speed).The output file is
{fname}.decomp
.Supported decompression methods are LZMA (
.xz
), bzip2 (.bz2
), and gzip (.gz
).File names with the standard extensions (see above) can use
method="auto"
to automatically determine the compression method. This can be overwritten by setting the method argument.Warning
With Python 2.7, methods “lzma”/”xz” and “bzip2” require extra dependencies to be installed:
backports.lzma
for “lzma” andbz2file
for “bzip2”.Parameters: - method : str
Name of the compression method. Can be “auto”, “lzma”, “xz”, “bzip2”, or “gzip”.
Methods
__call__
(self, fname, action, pooch)Decompress the given file.
-
Decompress.
__call__
(self, fname, action, pooch)[source]¶ Decompress the given file.
The output file will be
fname
with.decomp
appended to it.Parameters: - fname : str
Full path of the compressed file in local storage.
- action : str
Indicates what action was taken by
pooch.Pooch.fetch
. One of:"download"
: The file didn’t exist locally and was downloaded"update"
: The local file was outdated and was re-download"fetch"
: The file exists and is updated so it wasn’t downloaded
- pooch :
pooch.Pooch
The instance of
pooch.Pooch
that is calling this.
Returns: - fname : str
The full path to the decompressed file.