Skip to content

Commit

Permalink
Voronoi cells are created now for buses with carrier 'H2' or 'H2_grid'
Browse files Browse the repository at this point in the history
  • Loading branch information
lenzim97 committed Jan 16, 2025
1 parent d8ac379 commit 77ca472
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/egon/data/datasets/gas_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,23 @@ def create_voronoi(scn_name, carrier):
""",
geom_col="geometry",
).to_crs(epsg=4326)


if isinstance(carrier, str):
if carrier == "H2":
carriers = ["H2", "H2_grid"]
else:
carriers = [carrier]
else:
carriers = carrier

carrier_strings = "', '".join(carriers)


db.execute_sql(
f"""
DELETE FROM grid.egon_gas_voronoi
WHERE "carrier" = '{carrier}' and "scn_name" = '{scn_name}';
WHERE "carrier" IN ('{carrier_strings}') and "scn_name" = '{scn_name}';
"""
)

Expand All @@ -122,13 +134,14 @@ def create_voronoi(scn_name, carrier):
FROM grid.egon_etrago_bus
WHERE scn_name = '{scn_name}'
AND country = 'DE'
AND carrier = '{carrier}';
AND carrier IN ('{carrier_strings}');
""",
).to_crs(epsg=4326)



if len(buses) == 0:
return

# generate voronois
# For some scenarios it is defined that there is only 1 bus (e.g. gas). It
# means that there will be just 1 voronoi covering the entire german
Expand Down

0 comments on commit 77ca472

Please sign in to comment.