Commit 9f533ef2 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

fix generation of simname_fields.h5 file

List of checkpoint files is now generated explicitly (rather than
listing files that match "checkpoint_*").
This fixes problems when encountering non-checkpoint files that do
contain the "checkpoint" word in their name.
parent 203ef17a
Pipeline #65548 passed with stage
in 3 minutes and 56 seconds
......@@ -805,15 +805,21 @@ class PP(_code):
with h5py.File(os.path.join(self.work_dir, self.simname + '_fields.h5'), 'a') as ff:
ff.require_group('vorticity')
ff.require_group('vorticity/complex')
checkpoint_file_list = glob.glob(self.simname + '_checkpoint_*.h5')
checkpoint_file_list = [self.simname + '_checkpoint_{0}.h5'.format(cp)
for cp in range(df['checkpoint'][()])]
for cpf_name in checkpoint_file_list:
cpf = h5py.File(cpf_name, 'r')
for iter_name in cpf['vorticity/complex'].keys():
if iter_name not in ff['vorticity/complex'].keys():
ff['vorticity/complex/' + iter_name] = h5py.ExternalLink(
cpf_name,
'vorticity/complex/' + iter_name)
cpf.close()
if os.path.exists(cpf_name):
cpf = h5py.File(cpf_name, 'r')
if 'vorticity' not in cpf.keys():
print('file ', cpf_name, ' does not have vorticity group')
continue
else:
for iter_name in cpf['vorticity/complex'].keys():
if iter_name not in ff['vorticity/complex'].keys():
ff['vorticity/complex/' + iter_name] = h5py.ExternalLink(
cpf_name,
'vorticity/complex/' + iter_name)
cpf.close()
return None
def launch_jobs(
self,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment