Skip to content

Commit

Permalink
Add bus coords try except
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph McKinsey committed Aug 6, 2024
1 parent 960b4a9 commit 1c54841
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions LocalFeeder/FeederSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,17 @@ def get_bus_coords(self) -> Dict[str, Tuple[float, float]] | None:
if not os.path.exists(bus_path):
self.bus_coords = None
return self.bus_coords
with open(bus_path, "r") as f:
bus_coord_csv = csv.reader(f, delimiter=" ")
bus_coords = {}
for row in bus_coord_csv:
identifier, x, y = row
bus_coords[identifier] = (float(x), float(y))
return bus_coords
try:
with open(bus_path, "r") as f:
bus_coord_csv = csv.reader(f, delimiter=" ")
bus_coords = {}
for row in bus_coord_csv:
identifier, x, y = row
bus_coords[identifier] = (float(x), float(y))
return bus_coords
except Exception as e:
logging.warning(f"Unable to parse bus coords: {e}")
return None

def load_feeder(self):
"""Load feeder once downloaded. Relies on legacy mode."""
Expand Down

0 comments on commit 1c54841

Please sign in to comment.