Updated function to add project level metadata at the root group of the hdf5 file.
This commit is contained in:
@ -505,6 +505,10 @@ def save_processed_dataframe_to_hdf5(df, annotator, src_hdf5_path, script_date,
|
|||||||
# Get metadata
|
# Get metadata
|
||||||
metadata_dict = annotator.get_metadata()
|
metadata_dict = annotator.get_metadata()
|
||||||
|
|
||||||
|
# Prepare project level attributes
|
||||||
|
|
||||||
|
root_level_attributes = metadata_dict['metadata']['project']
|
||||||
|
|
||||||
# Prepare high-level attributes
|
# Prepare high-level attributes
|
||||||
high_level_attributes = {
|
high_level_attributes = {
|
||||||
'parent_files': metadata_dict['parent_files'],
|
'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
|
# Write to HDF5
|
||||||
with h5py.File(output_filename, 'w') as h5file:
|
with h5py.File(output_filename, 'w') as h5file:
|
||||||
|
h5file.attrs.update(root_level_attributes)
|
||||||
transfer_file_dict_to_hdf5(h5file, '/', file_dict)
|
transfer_file_dict_to_hdf5(h5file, '/', file_dict)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user