diff --git a/database_adapter/reeem_adapter_plexos.py b/database_adapter/reeem_adapter_plexos.py index eb8b2c3..4e94292 100644 --- a/database_adapter/reeem_adapter_plexos.py +++ b/database_adapter/reeem_adapter_plexos.py @@ -10,10 +10,24 @@ from reeem_io import * # input -filename = "2018-04-25_Base_Plexos_FrameworkV1_DataV2_Output.xlsx" +# filename = "2018-04-25_Base_Plexos_FrameworkV1_DataV2_Output.xlsx" # filename = "2018-04-25_Base_Plexos_FrameworkV1_DataV2_Input.xlsx" # filename = "2018-02-02_Base_Plexos_FrameworkV1_DataV1_Output.xlsx" # filename = "2018-02-02_Base_Plexos_FrameworkV1_DataV1_Input.xlsx" +filenames = [ + '2019-02-11_BaseIntegrated_Plexos_FrameworkV1_DataV1_Input.xlsx', + '2019-02-11_BaseIntegrated_Plexos_FrameworkV1_DataV1_Output.xlsx', + '2019-02-11_BaseIntegratedFixed_Plexos_FrameworkV1_DataV1_Input.xlsx', + '2019-02-11_BaseIntegratedFixed_Plexos_FrameworkV1_DataV1_Output.xlsx', + '2019-02-11_BaseIsolated_Plexos_FrameworkV1_DataV1_Input.xlsx', + '2019-02-11_BaseIsolated_Plexos_FrameworkV1_DataV1_Output.xlsx', + '2019-02-11_HighRESIntegrated_Plexos_FrameworkV1_DataV1_Input.xlsx', + '2019-02-11_HighRESIntegrated_Plexos_FrameworkV1_DataV1_Output.xlsx', + '2019-02-11_HighRESIntegratedFixed_Plexos_FrameworkV1_DataV1_Input.xlsx', + '2019-02-11_HighRESIntegratedFixed_Plexos_FrameworkV1_DataV1_Output.xlsx', + '2019-02-11_HighRESIsolated_Plexos_FrameworkV1_DataV1_Input.xlsx', + '2019-02-11_HighRESIsolated_Plexos_FrameworkV1_DataV1_Output.xlsx' +] # regions = ['BG'] regions = ['BG', 'HR', 'HU', 'RO', 'SI'] @@ -167,41 +181,46 @@ def plexos_output_2_reeem_db(model, pathway, version, file_name, empty_rows, db_ if __name__ == '__main__': - # file and table - fns = reeem_filenamesplit(filename) - # i/o - if fns['io'] == "Input": - db_table = db_table_input - else: - db_table = db_table_output - # logging log = logger() start_time = time.time() log.info('script started...') - log.info('...file: {}'.format(filename)) - log.info('...pathway: {}'.format(fns['pathway'])) - log.info('...model: {}'.format(fns['model'])) - log.info('...framework: {}'.format(fns['framework'])) - log.info('...version: {}'.format(fns['version'])) - log.info('...i/o: {}'.format(fns['io'])) - log.info('...regions: {}'.format(regions)) - log.info('...database table: model_draft.{}'.format(db_table)) - log.info('...establish database connection...') - + # connection + log.info('...establish database connection:') con = reeem_session() - log.info('...read file(s)...') - - # import - for region in regions: - plexos_2_reeem_db(filename, fns, db_table, empty_rows, - db_schema, region, con) - - # scenario log - scenario_log(con, 'REEEM', __version__, 'import', db_schema, db_table, - os.path.basename(__file__), filename) + + # import files + for filename in filenames: + + # file and table + fns = reeem_filenamesplit(filename) + + # i/o + if fns['io'] == "Input": + db_table = db_table_input + else: + db_table = db_table_output + + # log files + log.info('read file: {}'.format(filename)) + log.info('...model: {}'.format(fns['model'])) + log.info('...pathway: {}'.format(fns['pathway'])) + log.info('...framework: {}'.format(fns['framework'])) + log.info('...version: {}'.format(fns['version'])) + log.info('...i/o: {}'.format(fns['io'])) + log.info('...regions: {}'.format(regions)) + log.info('...database table: model_draft.{}'.format(db_table)) + + # import + for region in regions: + plexos_2_reeem_db(filename, fns, db_table, empty_rows, + db_schema, region, con) + + # scenario log + scenario_log(con, 'REEEM', __version__, 'import', db_schema, db_table, + os.path.basename(__file__), filename) # close connection con.close()