From a0bfc9790d5201b1a53ae0e15de43f74edbbfaab Mon Sep 17 00:00:00 2001 From: virio-andreyana Date: Wed, 1 May 2024 20:29:43 +0200 Subject: [PATCH 1/2] Fix bug to run the cluster wildcard 'min' --- Snakefile | 2 +- scripts/cluster_network.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Snakefile b/Snakefile index 79db6c83a..5b2de322e 100644 --- a/Snakefile +++ b/Snakefile @@ -53,7 +53,7 @@ ATLITE_NPROCESSES = config["atlite"].get("nprocesses", 4) wildcard_constraints: simpl="[a-zA-Z0-9]*|all", - clusters="[0-9]+(m|flex|min)?|all", + clusters="[0-9]+(m|flex)?|all|min", ll="(v|c)([0-9\.]+|opt|all)|all", opts="[-+a-zA-Z0-9\.]*", unc="[-+a-zA-Z0-9\.]*", diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index 6b559deba..6e956b642 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -699,7 +699,9 @@ def cluster_regions(busmaps, inputs, output): elif snakemake.wildcards.clusters == "all": n_clusters = len(n.buses) elif snakemake.wildcards.clusters == "min": - n_clusters = n.buses.groupby(["country", "sub_network"]).size().count() + m = n.copy() + m.determine_network_topology() + n_clusters = m.buses.groupby(["country", "sub_network"]).size().count() else: n_clusters = int(snakemake.wildcards.clusters) aggregate_carriers = None From 99fb67085f117fae870389e820edf6d90904a21e Mon Sep 17 00:00:00 2001 From: virio-andreyana Date: Thu, 2 May 2024 10:52:46 +0200 Subject: [PATCH 2/2] set determine_network_topology earlier and add release notes --- doc/release_notes.rst | 2 ++ scripts/cluster_network.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index aca52b188..f1e2d6441 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -24,6 +24,8 @@ E.g. if a new rule becomes available describe how to use it `snakemake -j1 run_t **Minor Changes and bug-fixing** +* Minor bug-fixing to run the cluster wildcard min `PR #1019 `__ + * Add option to adjust load scale for each individual countries `PR #1006 `__ * Minor bug-fixing to get the generalised line types work for DC lines and AC lines. `PR #1008 `__ , `PR #1011 `__ and `PR #1013 `__ diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index 6e956b642..a7683e82e 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -691,6 +691,8 @@ def cluster_regions(busmaps, inputs, output): "exclude_carriers", [] ) aggregate_carriers = set(n.generators.carrier) - set(exclude_carriers) + + n.determine_network_topology() if snakemake.wildcards.clusters.endswith("m"): n_clusters = int(snakemake.wildcards.clusters[:-1]) aggregate_carriers = snakemake.params.electricity.get("conventional_carriers") @@ -699,9 +701,7 @@ def cluster_regions(busmaps, inputs, output): elif snakemake.wildcards.clusters == "all": n_clusters = len(n.buses) elif snakemake.wildcards.clusters == "min": - m = n.copy() - m.determine_network_topology() - n_clusters = m.buses.groupby(["country", "sub_network"]).size().count() + n_clusters = n.buses.groupby(["country", "sub_network"]).size().count() else: n_clusters = int(snakemake.wildcards.clusters) aggregate_carriers = None