diff --git a/src/hdf5_lib.py b/src/hdf5_lib.py index bb6a700..3e5ea0c 100644 --- a/src/hdf5_lib.py +++ b/src/hdf5_lib.py @@ -5,7 +5,8 @@ sys.path.append(root_dir) import pandas as pd import numpy as np - +import h5py +import logging #import g5505_file_reader @@ -14,10 +15,6 @@ import src.g5505_utils as utils import src.hdf5_vis as hdf5_vis import src.g5505_file_reader as g5505f_reader -import h5py -import yaml -import shutil -import logging # Define mapping from extension to their file reader ext_to_reader_dict = {'.ibw': g5505f_reader.read_xps_ibw_file_as_dict, @@ -330,7 +327,7 @@ def create_hdf5_file_from_filesystem_path(output_filename : str, # Set input_directory as copied input directory root_dir = output_dir_path - with h5py.File(output_filename, 'w') as h5file: + with h5py.File(output_filename, mode='w', track_order=True) as h5file: number_of_dirs = len(path_to_filenames_dict.keys()) dir_number = 1 @@ -389,19 +386,18 @@ def create_hdf5_file_from_filesystem_path(output_filename : str, - if len(root_metadata_dict.keys())>0: - annotate_root_dir(output_filename,root_metadata_dict) + if len(root_metadata_dict.keys())>0: + for key, value in root_metadata_dict.items(): + #if key in h5file.attrs: + # del h5file.attrs[key] + h5file.attrs.create(key, value) + #annotate_root_dir(output_filename,root_metadata_dict) #output_yml_filename_path = hdf5_vis.take_yml_snapshot_of_hdf5_file(output_filename) return output_filename #, output_yml_filename_path -import os -#import src.hdf5_lib as h5lib -import src.g5505_utils as utils -import h5py -import src.metadata_review_lib as metadata_lib def save_processed_dataframe_to_hdf5(df, annotator, output_filename): # src_hdf5_path, script_date, script_name): """ Save processed dataframe columns with annotations to an HDF5 file.