You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently needed a small script that converted our usual "fileBased" iterationEncoding to a single "groupBased" file (in HDF5).
Next time I need it I will rewrite it in pure python so it's more portable. (Actually, I tried pure bash but needed a small in-file manipulation which I found no CLI tool for).
Nevertheless, here it is already:
#!/usr/bin/env bash## Copyright 2017 Axel Huebl## Use under the ISC software license.## needs input argument parsing & help
dumps=($(ls h5/*_*.h5))
first=0
fordin${dumps[@]};doif [ $first-eq 0 ]
then# includes copy of / attributes from first file
cp $d simData.h5
first=1
else
step=$(echo $d| sed 's/.\+_\([0-9]\+\)\.h5/\1/')
h5copy -i $d -s "/data/$step" \
-o simData.h5 -d "/data/$step"fidone# that might not be necessary if your files already had compression enabled
h5repack -i simData.h5 -o simData.h5.gz -f GZIP=1 && \
mv simData.h5.gz simData.h5
# change attributes:# "/iterationEncoding" -> "groupBased"# "/iterationFormat" -> "/data/%T/"
python -c 'import h5py; import numpy as np; f=h5py.File("simData.h5", "a"); f.attrs["iterationEncoding"] = np.string_("groupBased"); f.attrs["iterationFormat"] = np.string_("/data/%T/"); f.close()'
The text was updated successfully, but these errors were encountered:
I recently needed a small script that converted our usual "fileBased"
iterationEncoding
to a single "groupBased" file (in HDF5).Next time I need it I will rewrite it in pure python so it's more portable. (Actually, I tried pure bash but needed a small in-file manipulation which I found no CLI tool for).
Nevertheless, here it is already:
The text was updated successfully, but these errors were encountered: