Skip to content

Commit

Permalink
Merge pull request #286 from openego/features/#237-finish-eGon100RE-w…
Browse files Browse the repository at this point in the history
…indoff

Merge features/#237-finish-eGon100RE-windoff
  • Loading branch information
CarlosEpia authored Jul 30, 2024
2 parents 9216205 + d2d815b commit 6c066f4
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions src/egon/data/datasets/power_plants/wind_offshore.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
def map_id_bus(scenario):
# Import manually generated list of wind offshore farms with their
# connection points (OSM_id)
if scenario == "eGon2035":
osm_year = egon.data.config.datasets()["openstreetmap"]["original_data"][
"source"
]["url"]

if scenario in ["eGon2035", "eGon100RE"]:
id_bus = {
"Büttel": "136034396",
"Heide/West": "603661085",
"Suchraum Gemeinden Ibbenbüren/Mettingen/Westerkappeln": "114319248",
"Suchraum Zensenbusch": "76185022",
"Rommerskirchen": "24839976",
Expand All @@ -24,13 +27,11 @@ def map_id_bus(scenario):
"Diele": "177829920",
"Dörpen/West": "142487746",
"Emden/Borßum": "34835258",
"Emden/Ost": "34835258",
"Hagermarsch": "79316833",
"Hanekenfähr": "61918154",
"Inhausen": "29420322",
"Unterweser": "32076853",
"Wehrendorf": "33411203",
"Wilhelmshaven 2": "23744346",
"Rastede": "23837631",
"Bentwisch": "32063539",
"Lubmin": "460134233",
Expand All @@ -39,6 +40,25 @@ def map_id_bus(scenario):
"inhausen": "29420322",
"Cloppenburg": "50643382",
}
if "200101" in osm_year:
id_bus2 = {
"Heide/West": "289836713",
"Emden/Ost": "177829920",
"Wilhelmshaven 2": "23837631",
}
elif "220101" in osm_year:
id_bus2 = {
"Heide/West": "603661085",
"Emden/Ost": "34835258",
"Wilhelmshaven 2": "23744346",
}
else:
raise Exception(
"""The OSM year used is not yet compatible with
this function"""
)
id_bus = {**id_bus, **id_bus2}

elif scenario == "status2019":
id_bus = {
"UW Inhausen": "29420322",
Expand Down Expand Up @@ -186,6 +206,7 @@ def insert():
],
)
offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True)
offshore.rename(columns={"B 2040 ": "el_capacity"}, inplace=True)

elif scenario == "status2019":
offshore_path = (
Expand Down Expand Up @@ -276,7 +297,7 @@ def insert():
WHERE scenario_name = 'eGon100RE' AND
carrier = 'wind_offshore'
"""
)
).iloc[0, 0]

# Scale capacities to match target
scale_factor = cap_100RE / offshore.el_capacity.sum()
Expand Down Expand Up @@ -311,15 +332,17 @@ def insert():
offshore = gpd.GeoDataFrame(offshore, geometry="geom", crs=4326)

# Look for the maximum id in the table egon_power_plants
next_id = (
db.select_dataframe(
"SELECT MAX(id) FROM "
+ cfg["target"]["schema"]
+ "."
+ cfg["target"]["table"]
).iloc[0, 0]
+ 1
)
next_id = db.select_dataframe(
"SELECT MAX(id) FROM "
+ cfg["target"]["schema"]
+ "."
+ cfg["target"]["table"]
).iloc[0, 0]

if next_id:
next_id += 1
else:
next_id = 1

# Reset index
offshore.index = pd.RangeIndex(
Expand Down

0 comments on commit 6c066f4

Please sign in to comment.