adjust plotting

This commit is contained in:
lisazeyen 2023-04-05 18:18:53 +02:00
parent 1a7e9c241a
commit 91d2a4a052
2 changed files with 9 additions and 2 deletions

View File

@ -730,7 +730,7 @@ if __name__ == "__main__":
networks_dict = { networks_dict = {
(clusters, lv, opts+sector_opts) : (clusters, lv, opts+sector_opts) :
"results/" + snakemake.config['run']["name"] + f'/postnetworks/elec_s{simpl}_{clusters}_l{lv}_{opts}_{sector_opts}_brownfield_all_years.nc' \ "results/" + snakemake.config['run']["name"] + f'postnetworks/elec_s{simpl}_{clusters}_l{lv}_{opts}_{sector_opts}_brownfield_all_years.nc' \
for simpl in snakemake.config['scenario']['simpl'] \ for simpl in snakemake.config['scenario']['simpl'] \
for clusters in snakemake.config['scenario']['clusters'] \ for clusters in snakemake.config['scenario']['clusters'] \
for opts in snakemake.config['scenario']['opts'] \ for opts in snakemake.config['scenario']['opts'] \

View File

@ -42,7 +42,9 @@ def rename_techs(label):
"resistive heater", "resistive heater",
"Fischer-Tropsch", "Fischer-Tropsch",
"land transport fuel cell", "land transport fuel cell",
"land transport oil" "land transport oil",
"H2 for industry",
"shipping oil"
] ]
rename_if_contains_dict = { rename_if_contains_dict = {
@ -216,6 +218,11 @@ def plot_energy():
logger.info(f"Total energy of {round(df.sum()[0])} TWh/a") logger.info(f"Total energy of {round(df.sum()[0])} TWh/a")
if df.empty:
fig, ax = plt.subplots(figsize=(12, 8))
fig.savefig(snakemake.output.energy, bbox_inches="tight")
return
new_index = preferred_order.intersection(df.index).append( new_index = preferred_order.intersection(df.index).append(
df.index.difference(preferred_order) df.index.difference(preferred_order)
) )