plot summary with usual script

This commit is contained in:
lisazeyen 2023-08-24 14:43:36 +02:00
parent 4fb2116968
commit f2b01fbbe0
2 changed files with 5 additions and 38 deletions

View File

@ -190,39 +190,7 @@ rule make_summary_perfect:
"../scripts/make_summary_perfect.py" "../scripts/make_summary_perfect.py"
rule plot_summary_perfect:
input:
**{
f"costs_{year}": f"data/costs_{year}.csv"
for year in config["scenario"]["planning_horizons"]
},
costs_csv=RESULTS + "csvs/costs.csv",
energy=RESULTS + "csvs/energy.csv",
balances=RESULTS + "csvs/supply_energy.csv",
eea="data/eea/UNFCCC_v24.csv",
countries=RESULTS + "csvs/nodal_capacities.csv",
co2_emissions=RESULTS + "csvs/co2_emissions.csv",
capacities=RESULTS + "csvs/capacities.csv",
capital_cost=RESULTS + "csvs/capital_cost.csv",
output:
costs1=RESULTS + "graphs/costs.pdf",
costs2=RESULTS + "graphs/costs2.pdf",
costs3=RESULTS + "graphs/total_costs_per_year.pdf",
# energy="results" + '/' + config['run'] + '/graphs/energy.pdf',
balances=RESULTS + "graphs/balances-energy.pdf",
co2_emissions=RESULTS + "graphs/carbon_budget_plot.pdf",
capacities=RESULTS + "graphs/capacities.pdf",
threads: 2
resources:
mem_mb=10000,
log:
LOGS + "plot_summary_perfect.log",
benchmark:
(BENCHMARKS + "plot_summary_perfect")
conda:
"../envs/environment.yaml"
script:
"../scripts/plot_summary_perfect.py"
ruleorder: add_existing_baseyear > add_brownfield ruleorder: add_existing_baseyear > add_brownfield

View File

@ -356,7 +356,6 @@ def plot_balances():
fig.savefig(snakemake.output.balances[:-10] + k + ".pdf", bbox_inches="tight") fig.savefig(snakemake.output.balances[:-10] + k + ".pdf", bbox_inches="tight")
plt.cla()
def historical_emissions(countries): def historical_emissions(countries):
@ -478,7 +477,7 @@ def plot_carbon_budget_distribution(input_eurostat):
# add other years https://sdi.eea.europa.eu/data/0569441f-2853-4664-a7cd-db969ef54de0 # add other years https://sdi.eea.europa.eu/data/0569441f-2853-4664-a7cd-db969ef54de0
emissions.loc[2019] = 2.971372 emissions.loc[2019] = 2.971372
emissions.loc[2020] = 2.691958 emissions.loc[2020] = 2.691958
emissions.loc[2020] = 2.869355 emissions.loc[2021] = 2.869355
if snakemake.config["foresight"] == "myopic": if snakemake.config["foresight"] == "myopic":
@ -534,15 +533,15 @@ def plot_carbon_budget_distribution(input_eurostat):
) )
plt.grid(axis="y") plt.grid(axis="y")
path = snakemake.output.balances.split("balances")[0] + "carbon_budget.pdf"
plt.savefig(snakemake.output.co2_emissions, bbox_inches="tight") plt.savefig(path, bbox_inches="tight")
#%% #%%
if __name__ == "__main__": if __name__ == "__main__":
if "snakemake" not in globals(): if "snakemake" not in globals():
from _helpers import mock_snakemake from _helpers import mock_snakemake
snakemake = mock_snakemake("plot_summary_perfect") snakemake = mock_snakemake("plot_summary")
logging.basicConfig(level=snakemake.config["logging"]["level"]) logging.basicConfig(level=snakemake.config["logging"]["level"])