Added cleanup_h5 to utils.py

This commit is contained in:
Sebastian Kloth 2023-12-21 16:39:30 +01:00
parent 21dcc7641b
commit 2d7905315d

View File

@ -3,6 +3,7 @@ Collection of utility functions.
"""
import functools
from time import time as pytime
from subprocess import run
from types import FunctionType
import numpy as np
@ -500,3 +501,18 @@ def timing(function):
return result
return wrap
def cleanup_h5(hdf5_file) -> None:
hdf5_temp_file = f"{hdf5_file[:-3]}_temp.h5"
run(
[
"ptrepack",
"--chunkshape=auto",
"--propindexes",
"--complevel=9",
"--complib=blosc",
hdf5_file,
hdf5_temp_file,
]
)
run(["mv", hdf5_temp_file, hdf5_file])