nlrepack

nlrepack(path)

Repacks the specified file(s). If path is a directory, it will be walked recursively and all contained hdf5 files will be repacked. If the reclaimed free space is smaller than 1 MB, the operation is discarded.

Parameters:path (str) – The filename or directory.
Returns:The freed disk space in MB.
Return type:float

Usage examples

To repack the hdf5 file my_file.hdf5 and reclaim unused space (for deleting QuantumATK objects from hdf5 files see nldelete)

nlrepack('my_file.hdf5')

or to repack all files in a given directory /my/directory and its subdirectorys.

nlrepack('/my/directory')