From dfecf35bae19573fd1a86c1a1150621e7f1e183b Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 20 Nov 2023 19:45:10 +0100 Subject: [PATCH] add focus_weights to documentation --- config/config.default.yaml | 2 ++ doc/configtables/toplevel.csv | 1 + scripts/cluster_network.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/config.default.yaml b/config/config.default.yaml index 1f430004..81dda14a 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -18,6 +18,8 @@ remote: ssh: "" path: "" +focus_weights: false + # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#run run: name: "" diff --git a/doc/configtables/toplevel.csv b/doc/configtables/toplevel.csv index 67954389..a27623bd 100644 --- a/doc/configtables/toplevel.csv +++ b/doc/configtables/toplevel.csv @@ -10,3 +10,4 @@ private,,, remote,,, -- ssh,--,,Optionally specify the SSH of a remote cluster to be synchronized. -- path,--,,Optionally specify the file path within the remote cluster to be synchronized. +focus_weights,,,Optionally specify the focus weights for the clustering of countries. For instance: `DE: 0.8` will distribute 80% of all nodes to Germany and 20% to the rest of the countries. diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index 9dbe887a..dc4e8c4e 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -237,7 +237,7 @@ def distribute_clusters(n, n_clusters, focus_weights=None, solver_name="cbc"): n_clusters >= len(N) and n_clusters <= N.sum() ), f"Number of clusters must be {len(N)} <= n_clusters <= {N.sum()} for this selection of countries." - if focus_weights is not None: + if isinstance(focus_weights, dict): total_focus = sum(list(focus_weights.values())) assert (