From 606356cb04d52b567d7b3f552e462e37a98e2c71 Mon Sep 17 00:00:00 2001 From: "Anthony M. Sciola" Date: Tue, 18 Nov 2025 11:55:04 -0600 Subject: [PATCH] Updating slimH5 to properly copy root groups that are not Step (e.g. raiju's Grid group) --- kaipy/scripts/postproc/slimh5.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kaipy/scripts/postproc/slimh5.py b/kaipy/scripts/postproc/slimh5.py index 5baa6ef..8919ee8 100755 --- a/kaipy/scripts/postproc/slimh5.py +++ b/kaipy/scripts/postproc/slimh5.py @@ -56,9 +56,10 @@ def createfile(iH5,fOut): sQ = str(Q) #Don't include stuff that starts with "Step" if "Step" not in sQ and cacheName not in sQ: - oH5.create_dataset(sQ,data=iH5[sQ]) - if cacheName in sQ: - oH5.create_group(sQ) + if isinstance(iH5[sQ], h5py.Group): + oH5.copy(iH5[sQ], oH5) + else: + oH5.create_dataset(sQ,data=iH5[sQ]) return oH5 @@ -172,6 +173,7 @@ def main(): #Add the cache after steps, select the same steps for the cache that are contained in the #Ns:Ne:Nsk start,end,stride if cacheName in iH5.keys(): + oH5.create_group(cacheName) for Q in iH5[cacheName].keys(): sQ = str(Q) @@ -201,4 +203,4 @@ def main(): oH5.close() if __name__ == "__main__": - main() \ No newline at end of file + main()