pooch.Decompress

class pooch.Decompress(method='auto')[source]

Processor that decompress a file and returns the decompressed version.

Use with pooch.Pooch.fetch or pooch.retrieve 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.

Note

To unpack zip and tar archives with one or more files, use pooch.Unzip and pooch.Untar instead.

Parameters

method (str) – Name of the compression method. Can be “auto”, “lzma”, “xz”, “bzip2”, or “gzip”.

Methods Summary

Decompress.__call__(fname, action, pooch)

Decompress the given file.


Decompress.__call__(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 or pooch.retrieve:

    • "download": File didn’t exist locally and was downloaded

    • "update": Local file was outdated and was re-download

    • "fetch": 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.