Refactored due to updates in the file reader function.
This commit is contained in:
@ -21,10 +21,10 @@ import logging
|
|||||||
# Define mapping from extension to their file reader
|
# Define mapping from extension to their file reader
|
||||||
|
|
||||||
ext_to_reader_dict = {'.ibw': g5505f_reader.read_xps_ibw_file_as_dict,
|
ext_to_reader_dict = {'.ibw': g5505f_reader.read_xps_ibw_file_as_dict,
|
||||||
'.txt': g5505f_reader.read_txt_files_as_dict,
|
'.txt': lambda a1: g5505f_reader.read_txt_files_as_dict(a1,False),
|
||||||
'.TXT': g5505f_reader.read_txt_files_as_dict,
|
'.TXT': lambda a1: g5505f_reader.read_txt_files_as_dict(a1,False),
|
||||||
'.dat': g5505f_reader.read_txt_files_as_dict,
|
'.dat': lambda a1: g5505f_reader.read_txt_files_as_dict(a1,False),
|
||||||
'.h5': g5505f_reader.copy_file_in_group}
|
'.h5': lambda a1,a2,a3: g5505f_reader.copy_file_in_group(a1,a2,a3,False)}
|
||||||
|
|
||||||
def progressBar(count_value, total, suffix=''):
|
def progressBar(count_value, total, suffix=''):
|
||||||
bar_length = 100
|
bar_length = 100
|
||||||
@ -430,9 +430,10 @@ def create_hdf5_file_from_filesystem_path(output_filename : str,
|
|||||||
logging.error('Fail to transfer %s into HDF5: %s',os.path.join(dirpath,filename),inst)
|
logging.error('Fail to transfer %s into HDF5: %s',os.path.join(dirpath,filename),inst)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
ext_to_reader_dict[file_ext](source_file_path = os.path.join(dirpath,filename),
|
source_file_path = os.path.join(dirpath,filename)
|
||||||
dest_file_obj = h5file,
|
dest_file_obj = h5file
|
||||||
dest_group_name = group_name +'/'+filename)
|
dest_group_name = f'{group_name}/{filename}' #group_name +'/'+filename
|
||||||
|
ext_to_reader_dict[file_ext](source_file_path, dest_file_obj, dest_group_name)
|
||||||
|
|
||||||
# Update the progress bar and log the end message
|
# Update the progress bar and log the end message
|
||||||
progressBar(dir_number, number_of_dirs, end_message)
|
progressBar(dir_number, number_of_dirs, end_message)
|
||||||
|
Reference in New Issue
Block a user