Skip to content

Commit

Permalink
Delete PtH2, H2tP ... -links only for inland links
Browse files Browse the repository at this point in the history
  • Loading branch information
lenzim97 committed Jan 20, 2025
1 parent 26f93d1 commit d4dfb10
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/egon/data/datasets/hydrogen_etrago/power_to_h2.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ def export_o2_buses_to_db(df):
text(
f"""DELETE FROM {targets["links"]["schema"]}.{targets["links"]["table"]}
WHERE carrier IN ('power_to_H2', 'H2_to_power', 'PtH2_waste_heat', 'PtH2_O2')
AND scn_name = '{SCENARIO_NAME}'
AND scn_name = '{SCENARIO_NAME}' AND bus0 IN (
SELECT bus_id
FROM {targets["buses"]["schema"]}.{targets["buses"]["table"]}
WHERE country = 'DE'
)
"""
)
)
Expand Down Expand Up @@ -822,12 +826,6 @@ def export_links_to_db(df, carrier):
schema=targets["links"]["schema"]
table_name=targets["links"]["table"]

with engine.connect() as conn:
conn.execute(
text(
f"DELETE FROM {schema}.{table_name} WHERE carrier IN ('{carrier}')"
)
)
gdf = gpd.GeoDataFrame(df, geometry="geom").set_crs(METRIC_CRS)
gdf = gdf.to_crs(epsg=DATA_CRS)
gdf.p_nom = 0
Expand Down

0 comments on commit d4dfb10

Please sign in to comment.