Updated function to add project level metadata at the root group of the hdf5 file.

This commit is contained in:
2024-06-19 18:31:11 +02:00
parent 06c5c6d84b
commit 498a51cbc6

View File

@ -505,6 +505,10 @@ def save_processed_dataframe_to_hdf5(df, annotator, src_hdf5_path, script_date,
# Get metadata
metadata_dict = annotator.get_metadata()
# Prepare project level attributes
root_level_attributes = metadata_dict['metadata']['project']
# Prepare high-level attributes
high_level_attributes = {
'parent_files': metadata_dict['parent_files'],
@ -538,6 +542,7 @@ def save_processed_dataframe_to_hdf5(df, annotator, src_hdf5_path, script_date,
# Write to HDF5
with h5py.File(output_filename, 'w') as h5file:
h5file.attrs.update(root_level_attributes)
transfer_file_dict_to_hdf5(h5file, '/', file_dict)