Skip to content

Commit

Permalink
Merge branch 'paper/kmedoids-dijkstra-2' of https://github.com/openeg…
Browse files Browse the repository at this point in the history
…o/eTraGo into paper/kmedoids-dijkstra-2
  • Loading branch information
KathiEsterl committed Jul 4, 2023
2 parents b8db424 + becca8e commit f7cd1ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion etrago/appl.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def run_etrago(args, json_path):

print(datetime.datetime.now())

spatial_resolution = [20, 300, 30, 40, 50, 100, 150, 200, 250, 400, 500, 600]
spatial_resolution = [50, 100, 300, 500]

spatial_method = ['kmedoids-dijkstra']

Expand Down
11 changes: 11 additions & 0 deletions etrago/cluster/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,10 @@ def kmedoids_dijkstra_clustering(etrago, buses, connections, weight, n_clusters)
distances = distances.apply(pd.to_numeric)

medoid_idx = distances.idxmin()
if n_clusters > 5:
busmap_medoid = busmap.map(medoid_idx)
medoids_n = etrago.args["network_clustering"]["n_clusters_AC"]
busmap_medoid.to_csv(f'relocated_clus/busmap_medoid_{medoids_n}.csv')

import datetime
print(' ')
Expand All @@ -716,6 +720,13 @@ def kmedoids_dijkstra_clustering(etrago, buses, connections, weight, n_clusters)


busmap.index.name = "bus_id"

if n_clusters > 5:
medoid_idx_copy = medoid_idx.copy()
medoid_idx_copy.index = medoid_idx_copy.index.map(str)
busmap_dijkstra = busmap.map(medoid_idx_copy)
medoids_n = etrago.args["network_clustering"]["n_clusters_AC"]
busmap_dijkstra.to_csv(f'relocated_clus/busmap_dijkstra_{medoids_n}.csv')

else:
df = pd.read_csv(settings["k_busmap"])
Expand Down

0 comments on commit f7cd1ec

Please sign in to comment.