Merge pull request #988 from PyPSA/fix-indexing-cluster-weights

cluster_network: ensure correct indexing of weights
This commit is contained in:
Fabian Hofmann 2024-03-25 14:54:03 +01:00 committed by GitHub
commit 91e0087ce4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -231,7 +231,7 @@ def distribute_clusters(n, n_clusters, focus_weights=None, solver_name="scip"):
.pipe(normed)
)
N = n.buses.groupby(["country", "sub_network"]).size()
N = n.buses.groupby(["country", "sub_network"]).size()[L.index]
assert (
n_clusters >= len(N) and n_clusters <= N.sum()
@ -454,7 +454,7 @@ if __name__ == "__main__":
if "snakemake" not in globals():
from _helpers import mock_snakemake
snakemake = mock_snakemake("cluster_network", simpl="", clusters="5")
snakemake = mock_snakemake("cluster_network", simpl="", clusters="40")
configure_logging(snakemake)
set_scenario_config(snakemake)