|
| 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( |
| 5 | + scenarios=[get_scenario("1342", "1342"), get_scenario("base", "base")] |
| 6 | +) |
| 7 | +tools.pre_graphing(multi_scenario=True) |
| 8 | + |
| 9 | +projects = tools.get_dataframe( |
| 10 | + "generation_projects_info.csv", from_inputs=True, convert_dot_to_na=True |
| 11 | +) |
| 12 | +costs = tools.get_dataframe( |
| 13 | + "gen_build_costs.csv", from_inputs=True, convert_dot_to_na=True |
| 14 | +) |
| 15 | +predetermined = tools.get_dataframe( |
| 16 | + "gen_build_predetermined", from_inputs=True, convert_dot_to_na=True |
| 17 | +) |
| 18 | + |
| 19 | +projects = projects.merge( |
| 20 | + costs, |
| 21 | + on=["GENERATION_PROJECT", "scenario_name", "scenario_index"], |
| 22 | +) |
| 23 | + |
| 24 | +projects = projects.merge( |
| 25 | + predetermined, |
| 26 | + on=["GENERATION_PROJECT", "build_year", "scenario_name", "scenario_index"], |
| 27 | + how="left", # Makes a left join |
| 28 | +) |
| 29 | + |
| 30 | +prebuilt = projects[(projects.build_year != 2050) & (projects.scenario_name == "1342")] |
| 31 | +print("prebuilt total :", len(prebuilt)) |
| 32 | +prebuilt = prebuilt[(prebuilt.build_year + prebuilt.gen_max_age) > 2051] |
| 33 | +print("prebuilt alive :", len(prebuilt)) |
| 34 | + |
| 35 | +print("prebuild by tech") |
| 36 | +prebuilt_by_tech = prebuilt.groupby( |
| 37 | + ["gen_energy_source", "gen_tech"] |
| 38 | +).GENERATION_PROJECT.count() |
| 39 | +print(prebuilt_by_tech) |
| 40 | + |
| 41 | +prebuilt_by_tech = ( |
| 42 | + prebuilt.groupby(["gen_energy_source", "gen_tech"]).gen_capacity_limit_mw.sum() |
| 43 | + / 1000 |
| 44 | +) |
| 45 | +print("prebuilt by tech capacity") |
| 46 | +print(prebuilt_by_tech.sort_values(ascending=False)) |
| 47 | +print(prebuilt_by_tech.sum()) |
| 48 | + |
| 49 | +candidate = projects[(projects.build_year == 2050) & (projects.scenario_name == "base")] |
| 50 | +print( |
| 51 | + "candidate projects (50 extra than actual because storage gets overwritten): ", |
| 52 | + len(candidate), |
| 53 | +) |
| 54 | +candidate_by_tech = candidate.groupby( |
| 55 | + ["gen_energy_source", "gen_tech"] |
| 56 | +).GENERATION_PROJECT.count() |
| 57 | +print(candidate_by_tech) |
| 58 | + |
| 59 | +candidate = projects[(projects.build_year == 2050) & (projects.scenario_name == "1342")] |
| 60 | +print("candidate projects aggregated: ", len(candidate)) |
| 61 | +candidate_by_tech = ( |
| 62 | + candidate.groupby(["gen_energy_source"]).gen_capacity_limit_mw.sum() / 1000 |
| 63 | +) |
| 64 | +print(candidate_by_tech) |
| 65 | + |
| 66 | +tools = GraphTools(scenarios=[get_scenario("WS043")]) |
| 67 | +tx = tools.get_dataframe("transmission.csv", convert_dot_to_na=True) |
| 68 | +tx = tx[["BuildTx", "trans_length_km"]] |
| 69 | +tx_new = (tx.BuildTx * tx.trans_length_km).sum() * 1e-6 |
| 70 | +print("Million MW-km tx deployed: ", tx_new) |
0 commit comments