diff --git a/etrago/appl.py b/etrago/appl.py index fee8cbcf..6b690ac2 100644 --- a/etrago/appl.py +++ b/etrago/appl.py @@ -109,7 +109,7 @@ "method": "kmedoids-dijkstra", # choose clustering method: kmeans or kmedoids-dijkstra "n_clusters_AC": 30, # total number of resulting AC nodes (DE+foreign) "cluster_foreign_AC": False, # take foreign AC buses into account, True or False - "exclusion_area": False, # False, path to shapefile or list of nuts names of not cluster area + "exclusion_area": False, # False, path to shapefile or list of nuts names of not cluster area "method_gas": "kmedoids-dijkstra", # choose clustering method: kmeans or kmedoids-dijkstra "n_clusters_gas": 17, # total number of resulting CH4 nodes (DE+foreign) "cluster_foreign_gas": False, # take foreign CH4 buses into account, True or False diff --git a/etrago/cluster/gas.py b/etrago/cluster/gas.py index 2ec1aa6d..4760c05a 100644 --- a/etrago/cluster/gas.py +++ b/etrago/cluster/gas.py @@ -39,7 +39,7 @@ group_links, kmedoids_dijkstra_clustering, sum_with_inf, - find_buses_area + find_buses_area, ) from etrago.tools.utilities import * @@ -127,7 +127,8 @@ def preprocessing(etrago): # Exclude buses in the area that should not be clustered busmap_area = find_buses_area(etrago, "CH4") network_ch4.buses = network_ch4.buses[ - ~network_ch4.buses.index.isin(busmap_area.index)] + ~network_ch4.buses.index.isin(busmap_area.index) + ] def weighting_for_scenario(ch4_buses, save=None): """ @@ -300,7 +301,9 @@ def get_h2_clusters(etrago, busmap_ch4): return busmap -def gas_postprocessing(etrago, busmap, medoid_idx=None, busmap_area=pd.DataFrame()): +def gas_postprocessing( + etrago, busmap, medoid_idx=None, busmap_area=pd.DataFrame() +): """ Performs the postprocessing for the gas grid clustering based on the provided busmap @@ -352,12 +355,12 @@ def gas_postprocessing(etrago, busmap, medoid_idx=None, busmap_area=pd.DataFrame + "_result.csv" ) - #breakpoint() + # breakpoint() ########################################################################### - #include busmap_area to busmap + # include busmap_area to busmap ########################################################################### - if 'H2' in etrago.network.buses.carrier.unique(): + if "H2" in etrago.network.buses.carrier.unique(): busmap = get_h2_clusters(etrago, busmap) # Add all other buses to busmap @@ -1004,7 +1007,9 @@ def run_spatial_clustering_gas(self): "spatial clustering method for the gas network" ) raise ValueError(msg) - self.network, busmap = gas_postprocessing(self, busmap, medoid_idx, busmap_area) + self.network, busmap = gas_postprocessing( + self, busmap, medoid_idx, busmap_area + ) self.update_busmap(busmap) diff --git a/etrago/tools/network.py b/etrago/tools/network.py index 64e26bae..9c3eac12 100644 --- a/etrago/tools/network.py +++ b/etrago/tools/network.py @@ -277,7 +277,7 @@ def __init__( plot_grid = plot_grid plot_clusters = plot_clusters - + plot_carrier = plot_carrier plot_gas_generation = plot_gas_generation