Fix plotting of maps and balances; move log/benchmark to results/
This commit is contained in:
parent
fa767772d6
commit
beefb57c25
24
Snakefile
24
Snakefile
@ -213,7 +213,7 @@ rule prepare_sector_network:
|
|||||||
output: config['results_dir'] + config['run'] + '/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc'
|
output: config['results_dir'] + config['run'] + '/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc'
|
||||||
threads: 1
|
threads: 1
|
||||||
resources: mem_mb=2000
|
resources: mem_mb=2000
|
||||||
benchmark: "benchmarks/prepare_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}"
|
benchmark: config['results_dir'] + config['run'] + "/benchmarks/prepare_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}"
|
||||||
script: "scripts/prepare_sector_network.py"
|
script: "scripts/prepare_sector_network.py"
|
||||||
|
|
||||||
|
|
||||||
@ -243,8 +243,8 @@ rule make_summary:
|
|||||||
networks=expand(config['results_dir'] + config['run'] + "/postnetworks/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc",
|
networks=expand(config['results_dir'] + config['run'] + "/postnetworks/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc",
|
||||||
**config['scenario']),
|
**config['scenario']),
|
||||||
costs=config['costs_dir'] + "costs_{}.csv".format(config['scenario']['planning_horizons'][0]),
|
costs=config['costs_dir'] + "costs_{}.csv".format(config['scenario']['planning_horizons'][0]),
|
||||||
#plots=expand(config['results_dir'] + config['run'] + "/maps/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}-costs-all_{co2_budget_name}_{planning_horizons}.pdf",
|
plots=expand(config['results_dir'] + config['run'] + "/maps/elec_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}-costs-all_{co2_budget_name}_{planning_horizons}.pdf",
|
||||||
# **config['scenario'])
|
**config['scenario'])
|
||||||
#heat_demand_name='data/heating/daily_heat_demand.h5'
|
#heat_demand_name='data/heating/daily_heat_demand.h5'
|
||||||
output:
|
output:
|
||||||
nodal_costs=config['summary_dir'] + '/' + config['run'] + '/csvs/nodal_costs.csv',
|
nodal_costs=config['summary_dir'] + '/' + config['run'] + '/csvs/nodal_costs.csv',
|
||||||
@ -276,7 +276,7 @@ rule plot_summary:
|
|||||||
output:
|
output:
|
||||||
costs=config['summary_dir'] + '/' + config['run'] + '/graphs/costs.pdf',
|
costs=config['summary_dir'] + '/' + config['run'] + '/graphs/costs.pdf',
|
||||||
energy=config['summary_dir'] + '/' + config['run'] + '/graphs/energy.pdf',
|
energy=config['summary_dir'] + '/' + config['run'] + '/graphs/energy.pdf',
|
||||||
#balances=config['summary_dir'] + '/' + config['run'] + '/graphs/balances-energy.pdf'
|
balances=config['summary_dir'] + '/' + config['run'] + '/graphs/balances-energy.pdf'
|
||||||
threads: 2
|
threads: 2
|
||||||
resources: mem_mb=10000
|
resources: mem_mb=10000
|
||||||
script:
|
script:
|
||||||
@ -292,10 +292,10 @@ if config["foresight"] == "overnight":
|
|||||||
output: config['results_dir'] + config['run'] + "/postnetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc"
|
output: config['results_dir'] + config['run'] + "/postnetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc"
|
||||||
shadow: "shallow"
|
shadow: "shallow"
|
||||||
log:
|
log:
|
||||||
solver="logs/" + config['run'] + "/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log",
|
solver=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log",
|
||||||
python="logs/" + config['run'] + "/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log",
|
python=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log",
|
||||||
memory="logs/" + config['run'] + "/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log"
|
memory=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log"
|
||||||
benchmark: "benchmarks/solve_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}"
|
benchmark: config['results_dir'] + config['run'] + "/benchmarks/solve_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}"
|
||||||
threads: 4
|
threads: 4
|
||||||
resources: mem_mb=config['solving']['mem']
|
resources: mem_mb=config['solving']['mem']
|
||||||
# group: "solve" # with group, threads is ignored https://bitbucket.org/snakemake/snakemake/issues/971/group-job-description-does-not-contain
|
# group: "solve" # with group, threads is ignored https://bitbucket.org/snakemake/snakemake/issues/971/group-job-description-does-not-contain
|
||||||
@ -348,10 +348,10 @@ if config["foresight"] == "myopic":
|
|||||||
output: config['results_dir'] + config['run'] + "/postnetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc"
|
output: config['results_dir'] + config['run'] + "/postnetworks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}.nc"
|
||||||
shadow: "shallow"
|
shadow: "shallow"
|
||||||
log:
|
log:
|
||||||
solver="logs/" + config['run'] + "/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log",
|
solver=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_solver.log",
|
||||||
python="logs/" + config['run'] + "/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log",
|
python=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_python.log",
|
||||||
memory="logs/" + config['run'] + "/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log"
|
memory=config['results_dir'] + config['run'] + "/logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}_memory.log"
|
||||||
benchmark: "benchmarks/solve_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}"
|
benchmark: config['results_dir'] + config['run'] + "/benchmarks/solve_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_{co2_budget_name}_{planning_horizons}"
|
||||||
threads: 4
|
threads: 4
|
||||||
resources: mem_mb=config['solving']['mem']
|
resources: mem_mb=config['solving']['mem']
|
||||||
script: "scripts/solve_network.py"
|
script: "scripts/solve_network.py"
|
||||||
|
@ -253,9 +253,7 @@ def plot_h2_map(network):
|
|||||||
|
|
||||||
elec = n.links.index[n.links.carrier == "H2 Electrolysis"]
|
elec = n.links.index[n.links.carrier == "H2 Electrolysis"]
|
||||||
|
|
||||||
bus_sizes = pd.Series(0., index=n.buses.index)
|
bus_sizes = n.links.loc[elec,"p_nom_opt"].groupby(n.links.loc[elec,"bus0"]).sum() / bus_size_factor
|
||||||
bus_sizes.loc[elec.str.replace(" H2 Electrolysis", "")] = \
|
|
||||||
n.links.loc[elec, "p_nom_opt"].values / bus_size_factor
|
|
||||||
|
|
||||||
# make a fake MultiIndex so that area is correct for legend
|
# make a fake MultiIndex so that area is correct for legend
|
||||||
bus_sizes.index = pd.MultiIndex.from_product(
|
bus_sizes.index = pd.MultiIndex.from_product(
|
||||||
|
@ -188,11 +188,11 @@ def plot_balances():
|
|||||||
df = df/1e6
|
df = df/1e6
|
||||||
|
|
||||||
#remove trailing link ports
|
#remove trailing link ports
|
||||||
df.index = [i[:-1] if i[-1:] in ["0","1","2","3"] else i for i in df.index]
|
df.index = [i[:-1] if ((i != "co2") and (i[-1:] in ["0","1","2","3"])) else i for i in df.index]
|
||||||
|
|
||||||
df = df.groupby(df.index.map(rename_techs)).sum()
|
df = df.groupby(df.index.map(rename_techs)).sum()
|
||||||
|
|
||||||
to_drop = df.index[df.abs().max(axis=1) < snakemake.config['plotting']['energy_threshold']]
|
to_drop = df.index[df.abs().max(axis=1) < snakemake.config['plotting']['energy_threshold']/10]
|
||||||
|
|
||||||
print("dropping")
|
print("dropping")
|
||||||
|
|
||||||
@ -261,4 +261,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
plot_energy()
|
plot_energy()
|
||||||
|
|
||||||
#plot_balances()
|
plot_balances()
|
||||||
|
Loading…
Reference in New Issue
Block a user