Skip to content

Commit

Permalink
Merge pull request #697 from openego/fixes/#avoid-cretion-of-temporar…
Browse files Browse the repository at this point in the history
…y-file-during-clustering

Avoid creation of temporary file
  • Loading branch information
ClaraBuettner authored Nov 20, 2023
2 parents 024e852 + bdbc1ab commit 080296e
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions etrago/cluster/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
if "READTHEDOCS" not in os.environ:
from itertools import product
from math import ceil
from pickle import dump
import logging
import multiprocessing as mp

Expand Down Expand Up @@ -422,7 +421,6 @@ def busmap_by_shortest_path(etrago, fromlvl, tolvl, cpu_cores=4):
chunksize = ceil(len(ppaths) / cpu_cores)
container = p.starmap(shortest_path, gen(ppaths, chunksize, M))
df = pd.concat(container)
dump(df, open("df.p", "wb"))

# post processing
df.sort_index(inplace=True)
Expand Down Expand Up @@ -654,7 +652,6 @@ def dijkstras_algorithm(buses, connections, medoid_idx, cpu_cores):
chunksize = ceil(len(ppathss) / cpu_cores)
container = p.starmap(shortest_path, gen(ppathss, chunksize, M))
df = pd.concat(container)
dump(df, open("df.p", "wb"))

# assignment of data points to closest k-medoids centers
df["path_length"] = pd.to_numeric(df["path_length"])
Expand Down

0 comments on commit 080296e

Please sign in to comment.