numpy_archive

Archive/Extract one or multiple NumPy .npy files in/from one or multiple NumPy .npz archives.

This script can:

  • Archive one or multiple .npy files in a single compressed .npz archive.

  • Archive each given .npy file in its individual compressed .npz archive (--individual).

  • Extract all .npy files from one or more .npz archives.

Options

-f

Input file name(s). Space separated list of input file name(s). By default, all .npy files in this list will be archived in a single compressed .npz archive and all .npz archives in this list will be extracted.

-o

Output file name. Name of the created compressed .npz archive. Only meaningful when archiving multiple .npy files in a single compressed .npy archive.

--npy-names

Names of the .npy files in the created compressed .npz archive(s). Note that the names given here determine how to access the arrays when loading the .npz archive with numpy.load(). See there for furhter details. If given, the number of names must match the number of .npy files given with -f and all names must be unique. When --individual is given, it is also allowed to parse a single name that is used for all .npy files. Ignored, when only extracting .npz archives. Default: Use names of the input .npy files.

--individual

Archive each given .npy file in its individual compressed .npz archive instead of archiving all given .npy files in a single compressed .npz archive.

See also

numpy.savez_compressed()

Save several arrays into a single file in compressed .npz format.

numpy.load()

Load arrays or pickled objects from .npy, .npz or pickled files.