make_summary: Update summary creation for new line volume/cost constraints
Fixes #4.
This commit is contained in:
parent
448e8c238e
commit
15e986a0ec
@ -268,11 +268,18 @@ rule plot_network:
|
|||||||
|
|
||||||
def input_make_summary(w):
|
def input_make_summary(w):
|
||||||
# It's mildly hacky to include the separate costs input as first entry
|
# It's mildly hacky to include the separate costs input as first entry
|
||||||
|
if w.ll.endswith("all"):
|
||||||
|
ll = config["scenario"]["ll"]
|
||||||
|
if len(w.ll) == 4:
|
||||||
|
ll = [l for l in ll if l[0] == w.ll[0]]
|
||||||
|
else:
|
||||||
|
ll = w.ll
|
||||||
return ([COSTS] +
|
return ([COSTS] +
|
||||||
expand("results/networks/{network}_s{simpl}_{clusters}_l{ll}_{opts}.nc",
|
expand("results/networks/{network}_s{simpl}_{clusters}_l{ll}_{opts}.nc",
|
||||||
network=w.network,
|
network=w.network,
|
||||||
|
ll=ll,
|
||||||
**{k: config["scenario"][k] if getattr(w, k) == "all" else getattr(w, k)
|
**{k: config["scenario"][k] if getattr(w, k) == "all" else getattr(w, k)
|
||||||
for k in ["simpl", "clusters", "l", "opts"]}))
|
for k in ["simpl", "clusters", "opts"]}))
|
||||||
|
|
||||||
rule make_summary:
|
rule make_summary:
|
||||||
input: input_make_summary
|
input: input_make_summary
|
||||||
|
@ -353,7 +353,7 @@ outputs = ["costs",
|
|||||||
|
|
||||||
def make_summaries(networks_dict, country='all'):
|
def make_summaries(networks_dict, country='all'):
|
||||||
|
|
||||||
columns = pd.MultiIndex.from_tuples(networks_dict.keys(),names=["simpl","clusters","lv","opts"])
|
columns = pd.MultiIndex.from_tuples(networks_dict.keys(),names=["simpl","clusters","ll","opts"])
|
||||||
|
|
||||||
dfs = {}
|
dfs = {}
|
||||||
|
|
||||||
@ -401,15 +401,22 @@ if __name__ == "__main__":
|
|||||||
w = getattr(snakemake.wildcards, key)
|
w = getattr(snakemake.wildcards, key)
|
||||||
return snakemake.config["scenario"][key] if w == "all" else [w]
|
return snakemake.config["scenario"][key] if w == "all" else [w]
|
||||||
|
|
||||||
networks_dict = {(simpl,clusters,lv,opts) : ('results/networks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}.nc'
|
if snakemake.wildcards.ll.endswith("all"):
|
||||||
|
ll = snakemake.config["scenario"]["ll"]
|
||||||
|
if len(snakemake.wildcards.ll) == 4:
|
||||||
|
ll = [l for l in ll if l[0] == snakemake.wildcards.ll[0]]
|
||||||
|
else:
|
||||||
|
ll = [snakemake.wildcards.ll]
|
||||||
|
|
||||||
|
networks_dict = {(simpl,clusters,l,opts) : ('results/networks/{network}_s{simpl}_{clusters}_l{ll}_{opts}.nc'
|
||||||
.format(network=snakemake.wildcards.network,
|
.format(network=snakemake.wildcards.network,
|
||||||
simpl=simpl,
|
simpl=simpl,
|
||||||
clusters=clusters,
|
clusters=clusters,
|
||||||
opts=opts,
|
opts=opts,
|
||||||
lv=lv))
|
ll=l))
|
||||||
for simpl in expand_from_wildcard("simpl")
|
for simpl in expand_from_wildcard("simpl")
|
||||||
for clusters in expand_from_wildcard("clusters")
|
for clusters in expand_from_wildcard("clusters")
|
||||||
for lv in expand_from_wildcard("lv")
|
for l in ll
|
||||||
for opts in expand_from_wildcard("opts")}
|
for opts in expand_from_wildcard("opts")}
|
||||||
|
|
||||||
print(networks_dict)
|
print(networks_dict)
|
||||||
|
Loading…
Reference in New Issue
Block a user