Skip to content

Commit

Permalink
Merge pull request #971 from koen-vg/fix-sanitize-locations
Browse files Browse the repository at this point in the history
Only sanitize locations when there are buses with a location
  • Loading branch information
fneum authored Mar 19, 2024
2 parents 883a850 + e03fbf1 commit db4219f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/add_electricity.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,13 @@ def sanitize_carriers(n, config):


def sanitize_locations(n):
n.buses["x"] = n.buses.x.where(n.buses.x != 0, n.buses.location.map(n.buses.x))
n.buses["y"] = n.buses.y.where(n.buses.y != 0, n.buses.location.map(n.buses.y))
n.buses["country"] = n.buses.country.where(
n.buses.country.ne("") & n.buses.country.notnull(),
n.buses.location.map(n.buses.country),
)
if "location" in n.buses.columns:
n.buses["x"] = n.buses.x.where(n.buses.x != 0, n.buses.location.map(n.buses.x))
n.buses["y"] = n.buses.y.where(n.buses.y != 0, n.buses.location.map(n.buses.y))
n.buses["country"] = n.buses.country.where(
n.buses.country.ne("") & n.buses.country.notnull(),
n.buses.location.map(n.buses.country),
)


def add_co2_emissions(n, costs, carriers):
Expand Down

0 comments on commit db4219f

Please sign in to comment.