This repository has been archived by the owner on Mar 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.py
113 lines (83 loc) · 3.27 KB
/
start.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 15 16:29:23 2016
Description: Outputting scenarios
Scope: MSc research Modelling circular economy policies in EEIOA
@author: Franco Donati
@institution: Leiden University CML, TU Delft TPM
"""
from save_ import Save
from results import Results
class Start:
"""
From start you can launch all the analysis specifications listed under
scenarios.xls
All directories and base data are specified in dirs.py
Results will be saved in the output folder
The programme only considers two regions EU and Rest-Of-World (ROW)
Permitted SUT transformation Methods are
method = 0 >> Prod X Prod Ind-Tech Assumption Technical Coeff method
method = 1 >> Prod X Prod Ind-Tech Assumption Market Share Coeff method
results_only = True >> output only results (spec'd in scenarios.xls)
results_only = False >> output all IOTs and results
scen_no = 0-7 (0 = baseline)
"scenario_1" is also allowed for scenarios
None, 0, base and baseline are also accepted for baseline
"""
def __init__(self, method):
self.method = method # 0 or 1
self.directory = "outputs/"
self.init_res = Results(method)
def run_one_scenario(self, scen_no, results_only = True):
"""
Run to check specific scenario
results_only = False, True
- True, output results for analysis
- False, output all tables plus results for analysis
"""
scenario = self.init_res.one_scen(scen_no, results_only)
return(scenario)
def all_results(self):
"""
Output all results in a table
"""
results_table = self.init_res.table_res()
return(results_table)
def save_one_scenario(self, scen_no, results_only = False):
"""
Output all results in a table
"""
init_save = Save(self.directory, self.method)
scenario = self.init_res.one_scen(scen_no, results_only)
init_save.save_(scenario, scen_no)
def save_all_scenarios(self):
"""
Save all results in separate files and sheets
data e.g. all_results.all_tables
"""
init_save = Save(self.directory, self.method)
data = self.init_res.table_res(False)
init_save.save_everything(data)
def save_results(self):
"""
Save results
"""
init_save = Save(self.directory, self.method)
data = self.init_res.table_res()
init_save.save_results(data)
def save_everything(self):
"""
Save all scenarios and results
"""
self.save_results()
self.save_all_scenarios()
# uncomment to save results in method 0
#==============================================================================
# strt = Start(0)
# save_results = strt.save_results()
#==============================================================================
# uncomment to save results in method 1
#==============================================================================
# strt = Start(1)
# save_results = strt.save_results()
#==============================================================================