Skip to content

Commit 39c02d7

Browse files
measrainseykhaeru
authored andcommitted
Clean up scripts and remove commented sections
1 parent 17a80f0 commit 39c02d7

File tree

2 files changed

+23
-34
lines changed

2 files changed

+23
-34
lines changed

message_ix_models/project/ssp/script/scenarios/low.py

+8-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# selections
1313
sel_scen = "SSP1"
1414
scen_suffix = ""
15-
# scen_vers = 1
1615
rem_bof_steel = True
1716
mod_growth_steel = True
1817
mod_initial_steel = True
@@ -38,28 +37,31 @@
3837
model_orig = "SSP_" + sel_scen + "_v1.0"
3938
scenario_orig = snames[sel_scen]
4039

41-
# add scen_suffic depending on remove_bof_steel, modify_lc_steel,
42-
# steel_scalar, and add_steel_target
4340
if rem_bof_steel:
4441
scen_suffix += "_bof"
4542
if mod_growth_steel:
46-
scen_suffix += "_growth" # + str(steel_growth)
43+
scen_suffix += "_growth"
4744
if mod_initial_steel:
48-
scen_suffix += "_initial" # + str(steel_inital)
45+
scen_suffix += "_initial"
4946
if add_steel_target:
5047
scen_suffix += "_nzsteel"
5148

49+
# target scenario
5250
model_target = "MM_ScenarioMIP"
5351
scenario_target = "Low_" + sel_scen + scen_suffix # + "_v" + str(scen_vers)
5452

53+
# connect to database
5554
mp = ixmp.Platform("ixmp_dev")
55+
56+
# load scenario
5657
s_orig = message_ix.Scenario(
5758
mp, model=model_orig, scenario=scenario_orig, version=svers[sel_scen]
5859
)
60+
61+
# clone scenario
5962
s_tar = s_orig.clone(model_target, scenario_target, keep_solution=False)
6063
s_tar.set_as_default()
6164

62-
6365
# modify steel sector
6466
if rem_bof_steel:
6567
remove_bof_steel_lower(s_tar, steel_years)
@@ -86,15 +88,6 @@
8688
# add balance equality
8789
add_balance_equality(s_tar)
8890

89-
# solve parameters
90-
# message_ix.models.DEFAULT_CPLEX_OPTIONS = {
91-
# "advind": 0,
92-
# "lpmethod": 4,
93-
# "threads": 4,
94-
# "epopt": 1e-6,
95-
# "scaind": -1,
96-
# }
97-
9891
solve_typ = "MESSAGE-MACRO"
9992
solve_args = dict(model=solve_typ)
10093
s_tar.solve(**solve_args)

message_ix_models/project/ssp/script/scenarios/very_low.py

+15-19
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
# selections
2121
sel_scen = "LED"
2222
scen_suffix = "g05_e9"
23-
# scen_vers = 1
2423
rem_bof_steel = True
2524
mod_growth_steel = True
2625
mod_initial_steel = True
@@ -41,36 +40,41 @@
4140
0,
4241
]
4342

44-
# model and scenario names
45-
path_ue = package_data_path("ue-shares")
46-
path_ue_file = os.path.join(path_ue, file_ue)
43+
# scenario names
4744
snames = {"SSP1": "SSP1 - Very Low Emissions", "LED": "SSP2 - Very Low Emissions"}
4845
svers = {"SSP1": 1, "LED": 2}
4946
model_orig = "SSP_" + sel_scen + "_v1.0"
5047
scenario_orig = snames[sel_scen]
5148

52-
# add scen_suffic depending on remove_bof_steel, modify_lc_steel,
53-
# steel_scalar, and add_steel_target
5449
if rem_bof_steel:
5550
scen_suffix += "_bof"
5651
if mod_growth_steel:
57-
scen_suffix += "_growth" # + str(steel_growth)
52+
scen_suffix += "_growth"
5853
if mod_initial_steel:
59-
scen_suffix += "_initial" # + str(steel_inital)
54+
scen_suffix += "_initial"
6055
if add_steel_target:
6156
scen_suffix += "_nzsteel"
6257

58+
# read UE share file
59+
path_ue = package_data_path("ue-shares")
60+
path_ue_file = os.path.join(path_ue, file_ue)
61+
62+
# target scenario
6363
model_target = "MM_ScenarioMIP"
64-
scenario_target = "VL_" + sel_scen + "_" + scen_suffix # + "_v" + str(scen_vers)
64+
scenario_target = "VL_" + sel_scen + "_" + scen_suffix
6565

66+
# connect to database
6667
mp = ixmp.Platform("ixmp_dev")
68+
69+
# load scenario
6770
s_orig = message_ix.Scenario(
6871
mp, model=model_orig, scenario=scenario_orig, version=svers[sel_scen]
6972
)
73+
74+
# clone scenario
7075
s_tar = s_orig.clone(model_target, scenario_target, keep_solution=False)
7176
s_tar.set_as_default()
7277

73-
7478
# modify bounds for some fuels in residential and commercial sector
7579
modify_rc_bounds(s_orig, s_tar, rc_years)
7680

@@ -114,15 +118,7 @@
114118
# add balance equality
115119
add_balance_equality(s_tar)
116120

117-
# solve parameters
118-
# message_ix.models.DEFAULT_CPLEX_OPTIONS = {
119-
# "advind": 0,
120-
# "lpmethod": 4,
121-
# "threads": 4,
122-
# "epopt": 1e-6,
123-
# "scaind": -1,
124-
# }
125-
121+
# solve
126122
solve_typ = "MESSAGE-MACRO"
127123
solve_args = dict(model=solve_typ)
128124
s_tar.solve(**solve_args)

0 commit comments

Comments
 (0)