Skip to content

Commit d210c48

Browse files
committed
Calculate key values
1 parent 297f70d commit d210c48

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from papers.Martin_Staadecker_et_al_2022.util import get_scenario
2+
from switch_model.tools.graph.main import GraphTools
3+
4+
tools = GraphTools(scenarios=[
5+
get_scenario("1342", "1342"),
6+
get_scenario("base", "base")
7+
])
8+
tools.pre_graphing(multi_scenario=True)
9+
10+
projects = tools.get_dataframe("generation_projects_info.csv", from_inputs=True, convert_dot_to_na=True)
11+
costs = tools.get_dataframe("gen_build_costs.csv", from_inputs=True, convert_dot_to_na=True)
12+
predetermined = tools.get_dataframe("gen_build_predetermined", from_inputs=True, convert_dot_to_na=True)
13+
14+
projects = projects.merge(
15+
costs,
16+
on=["GENERATION_PROJECT", "scenario_name", "scenario_index"],
17+
)
18+
19+
projects = projects.merge(
20+
predetermined,
21+
on=["GENERATION_PROJECT", "build_year", "scenario_name", "scenario_index"],
22+
how="left" # Makes a left join
23+
)
24+
25+
prebuilt = projects[(projects.build_year != 2050) & (projects.scenario_name == "1342")]
26+
print("prebuilt total :", len(prebuilt))
27+
prebuilt = prebuilt[(prebuilt.build_year + prebuilt.gen_max_age) > 2051]
28+
print("prebuilt alive :", len(prebuilt))
29+
30+
prebuilt_by_tech = prebuilt.groupby(["gen_energy_source", "gen_tech"]).gen_capacity_limit_mw.sum() / 1000
31+
print(prebuilt_by_tech.sort_values(ascending=False))
32+
print(prebuilt_by_tech.sum())
33+
34+
candidate = projects[(projects.build_year == 2050) & (projects.scenario_name == "base")]
35+
print("candidate projects (50 extra than actual because storage gets overwritten): ", len(candidate))
36+
candidate_by_tech = candidate.groupby(["gen_energy_source", "gen_tech"]).GENERATION_PROJECT.count()
37+
print(candidate_by_tech)
38+
39+
candidate = projects[(projects.build_year == 2050) & (projects.scenario_name == "1342")]
40+
print("candidate projects aggregated: ", len(candidate))
41+
candidate_by_tech = candidate.groupby(["gen_energy_source"]).gen_capacity_limit_mw.sum() / 1000
42+
print(candidate_by_tech)
43+
44+
tools = GraphTools(scenarios=[get_scenario("WS043")])
45+
tx = tools.get_dataframe("transmission.csv", convert_dot_to_na=True)
46+
tx = tx[["BuildTx", "trans_length_km"]]
47+
tx_new = (tx.BuildTx * tx.trans_length_km).sum() * 1e-6
48+
print("Million MW-km tx deployed: ", tx_new)

0 commit comments

Comments
 (0)