import sys import os root_dir = os.path.abspath(os.curdir) sys.path.append(root_dir) import src.smog_chamber_file_reader as scf_reader import src.g5505_file_reader as g5505f_reader from datetime import datetime import pandas as pd import pygit2 as pygit author = pygit.Signature('Florez Ospina Juan Felipe', 'juan.florez-ospina@psi.ch') committer = pygit.Signature('Florez Ospina Juan Felipe', 'juan.florez-ospina@psi.ch') output_filename_tempate = lambda group_id, timestamp,user_initials : '_'.join(['unified_file',group_id,timestamp,user_initials])+'.h5' def created_at(): now = datetime.now() # Populate now object with time zone infotmation obtained from the local system now_tz_aware = now.astimezone() tz = now_tz_aware.strftime('%z') #created_at = now_tz_aware.strftime('%Y-%m-%d_%H-%M-%S')+'_utcoffset_' + tz created_at = now_tz_aware.strftime('%Y-%m-%d')+'_UTC-OFST_' + tz # Make created at timestamp with tz information #created_at = now.isoformat() return created_at def select_file_readers(group_id): if group_id == '5505': ext_to_reader_dict = {'.ibw': g5505f_reader.read_xps_ibw_file_as_dict, '.txt': g5505f_reader.read_txt_files_as_dict, '.dat': g5505f_reader.read_txt_files_as_dict, '.h5': g5505f_reader.copy_file_in_group} elif group_id == 'smog_chamber': ext_to_reader_dict = {'.txt': scf_reader.read_txt_files_as_dict, '.TXT': scf_reader.read_txt_files_as_dict, '.h5': g5505f_reader.copy_file_in_group} return ext_to_reader_dict