Deleted annotate_root_dir(filename,annotation_dict: dict), and outsourced functionality to HDF5DataOpsManager.append_metadata() or .update_metadata() at obj_name = '/'
This commit is contained in:
@ -19,6 +19,16 @@ import json
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
class HDF5DataOpsManager():
|
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:
|
def __init__(self, file_path, mode = 'r+') -> None:
|
||||||
|
|
||||||
if mode in ['r','r+']:
|
if mode in ['r','r+']:
|
||||||
@ -549,11 +559,5 @@ def get_groups_at_a_level(file: h5py.File, level: str):
|
|||||||
return groups
|
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])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user