From 14a1d032b96d13cae8b433e363a9fc4404ba53a7 Mon Sep 17 00:00:00 2001 From: Florez Ospina Juan Felipe Date: Tue, 1 Oct 2024 09:19:14 +0200 Subject: [PATCH] Deleted annotate_root_dir(filename,annotation_dict: dict), and outsourced functionality to HDF5DataOpsManager.append_metadata() or .update_metadata() at obj_name = '/' --- src/hdf5_ops.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hdf5_ops.py b/src/hdf5_ops.py index 57aed5f..3dccd37 100644 --- a/src/hdf5_ops.py +++ b/src/hdf5_ops.py @@ -19,6 +19,16 @@ import json import copy class HDF5DataOpsManager(): + + """ + A class to handle HDF5 file operations. + + Parameters: + path_to_file : str + path/to/hdf5file. + mode : str + 'r' or 'r+' read or read/write mode only when file exists + """ def __init__(self, file_path, mode = 'r+') -> None: if mode in ['r','r+']: @@ -549,11 +559,5 @@ def get_groups_at_a_level(file: h5py.File, level: str): return groups -def annotate_root_dir(filename,annotation_dict: dict): - with h5py.File(filename,'r+') as file: - file.attrs.update(annotation_dict) - #for key in annotation_dict: - # file.attrs.create('metadata_'+key, annotation_dict[key]) -