From 8e568cee0359dd6f348cb09b58a6ca73e07a7a14 Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 14 Jul 2023 16:00:21 +0200 Subject: [PATCH] cluster network: remove bus strategies as already handled internally --- scripts/cluster_network.py | 2 -- scripts/simplify_network.py | 8 ++------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index d82f7569..ea749cbc 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -139,7 +139,6 @@ from pypsa.clustering.spatial import ( busmap_by_hac, busmap_by_kmeans, get_clustering_from_busmap, - make_consense, ) warnings.filterwarnings(action="ignore", category=UserWarning) @@ -406,7 +405,6 @@ def clustering_for_n_clusters( clustering = get_clustering_from_busmap( n, busmap, - bus_strategies={"country": make_consense}, aggregate_generators_weighted=True, aggregate_generators_carriers=aggregate_carriers, aggregate_one_ports=["Load", "StorageUnit"], diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 45e84dd8..9315342f 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -86,7 +86,7 @@ The rule :mod:`simplify_network` does up to four things: """ import logging -from functools import reduce +from functools import partial, reduce import numpy as np import pandas as pd @@ -99,7 +99,6 @@ from pypsa.clustering.spatial import ( aggregateoneport, busmap_by_stubs, get_clustering_from_busmap, - make_consense, ) from pypsa.io import import_components_from_dataframe, import_series_from_dataframe from scipy.sparse.csgraph import connected_components, dijkstra @@ -482,17 +481,14 @@ def aggregate_to_substations(n, aggregation_strategies=dict(), buses_i=None): busmap = n.buses.index.to_series() busmap.loc[buses_i] = dist.idxmin(1) - bus_strategies = {"country": make_consense} - clustering = get_clustering_from_busmap( n, busmap, - bus_strategies=bus_strategies, aggregate_generators_weighted=True, aggregate_generators_carriers=None, aggregate_one_ports=["Load", "StorageUnit"], line_length_factor=1.0, - generator_strategies=generator_strategies, + generator_strategies=aggregation_strategies["generators"], scale_link_capital_costs=False, ) return clustering.network, busmap