Skip to content

Commit

Permalink
apply Black
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosEpia committed Sep 21, 2023
1 parent 0d78999 commit adccc1f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion etrago/appl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions etrago/cluster/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
group_links,
kmedoids_dijkstra_clustering,
sum_with_inf,
find_buses_area
find_buses_area,
)
from etrago.tools.utilities import *

Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion etrago/tools/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def __init__(
plot_grid = plot_grid

plot_clusters = plot_clusters

plot_carrier = plot_carrier

plot_gas_generation = plot_gas_generation
Expand Down

0 comments on commit adccc1f

Please sign in to comment.