Skip to content

Commit

Permalink
Merge branch 'dev' into features/#246-myopic-pypsaeur
Browse files Browse the repository at this point in the history
  • Loading branch information
ulfmueller committed Sep 23, 2024
2 parents 25dfd49 + 56ad045 commit 1474cb2
Show file tree
Hide file tree
Showing 24 changed files with 1,123 additions and 954 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def read(*names, **kwargs):
"cdsapi",
"click<8.1",
"entsoe-py >=0.5.5",
"fiona==1.9.6",
"Flask-Session<0.6.0",
"GeoAlchemy2",
"geopandas>=0.10.0",
Expand Down
18 changes: 10 additions & 8 deletions src/egon/data/airflow/dags/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from egon.data.datasets.heat_supply.individual_heating import (
HeatPumps2035,
HeatPumps2050,
HeatPumpsPypsaEurSec,
HeatPumpsPypsaEur,
)
from egon.data.datasets.hydrogen_etrago import (
HydrogenBusEtrago,
Expand Down Expand Up @@ -214,7 +214,7 @@

# Download industrial gas demand
industrial_gas_demand = IndustrialGasDemand(
dependencies=[scenario_parameters]
dependencies=[scenario_parameters, data_bundle]
)

# Extract landuse areas from the `osm` dataset
Expand Down Expand Up @@ -346,8 +346,8 @@
]
)

# Minimum heat pump capacity for pypsa-eur-sec
heat_pumps_pypsa_eur_sec = HeatPumpsPypsaEurSec(
# Minimum heat pump capacity for pypsa-eur
heat_pumps_pypsa_eur = HeatPumpsPypsaEur(
dependencies=[
cts_demand_buildings,
DistrictHeatingAreas,
Expand Down Expand Up @@ -375,7 +375,7 @@
dependencies=[prepare_pypsa_eur, tyndp_data, osmtgmod, fix_subnetworks]
)

# run pypsa-eur-sec
# run pypsa-eur
run_pypsaeur = RunPypsaEur(
dependencies=[
prepare_pypsa_eur,
Expand Down Expand Up @@ -410,6 +410,7 @@
osmtgmod,
scenario_parameters,
tasks["etrago_setup.create-tables"],
run_pypsaeur,
]
)

Expand Down Expand Up @@ -459,6 +460,7 @@
prepare_pypsa_eur,
foreign_lines,
insert_hydrogen_buses,
run_pypsaeur,
]
)

Expand All @@ -479,7 +481,7 @@

# Assign industrial gas demand eGon100RE
IndustrialGasDemandeGon100RE(
dependencies=[create_gas_polygons, industrial_gas_demand]
dependencies=[create_gas_polygons, industrial_gas_demand, run_pypsaeur,]
)

# CHP locations
Expand Down Expand Up @@ -593,7 +595,7 @@
DistrictHeatingAreas,
heat_supply,
heat_time_series,
heat_pumps_pypsa_eur_sec,
heat_pumps_pypsa_eur,
power_plants,
]
)
Expand All @@ -613,7 +615,7 @@
heat_pumps_2050 = HeatPumps2050(
dependencies=[
run_pypsaeur,
heat_pumps_pypsa_eur_sec,
heat_pumps_pypsa_eur,
heat_supply,
]
)
Expand Down
3 changes: 3 additions & 0 deletions src/egon/data/datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,12 @@ data-bundle:
sources:
zenodo:
deposit_id: 10226009
deposit_id_powerd: 11618105
targets:
file:
'data_bundle_egon_data.zip'
file_powerd:
'data_bundle_powerd_data.zip'

pypsa-technology-data:
sources:
Expand Down
19 changes: 18 additions & 1 deletion src/egon/data/datasets/data_bundle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,32 @@ def download():
with zipfile.ZipFile(target_file, "r") as zip_ref:
zip_ref.extractall(".")

powerd_data_bundle_path = Path(".") / "data_bundle_powerd_data"
# Delete folder if it already exists
if powerd_data_bundle_path.exists() and powerd_data_bundle_path.is_dir():
shutil.rmtree(powerd_data_bundle_path)

url = f"""https://zenodo.org/record/{sources['deposit_id_powerd']}/files/data_bundle_powerd_data.zip"""
target_file = egon.data.config.datasets()["data-bundle"]["targets"]["file_powerd"]

# Retrieve files
urlretrieve(url, target_file)

with zipfile.ZipFile(target_file, "r") as zip_ref:
zip_ref.extractall(".")


class DataBundle(Dataset):
def __init__(self, dependencies):
deposit_id = egon.data.config.datasets()["data-bundle"]["sources"][
"zenodo"
]["deposit_id"]
deposit_id_powerd = egon.data.config.datasets()["data-bundle"]["sources"][
"zenodo"
]["deposit_id"]
super().__init__(
name="DataBundle",
version=str(deposit_id) + "-0.0.2",
version=str(deposit_id) + str(deposit_id_powerd) + "-0.0.3",
dependencies=dependencies,
tasks=(download),
)
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def assign_h2_buses(scenario: str = "eGon2035"):
hgv_h2_demand_gdf = read_hgv_h2_demand(scenario=scenario)

hgv_h2_demand_gdf = db.assign_gas_bus_id(
hgv_h2_demand_gdf, scenario, "H2_grid"
hgv_h2_demand_gdf, scenario, "H2"
)

# Add carrier
Expand Down
1 change: 0 additions & 1 deletion src/egon/data/datasets/etrago_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ def insert_carriers():
"H2",
"H2_feedin",
"H2_for_industry",
"H2_grid",
"H2_gridextension",
"H2_hgv_load",
"H2_overground",
Expand Down
6 changes: 3 additions & 3 deletions src/egon/data/datasets/gas_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class EgonPfHvGasVoronoi(Base):
scn_name = Column(Text, primary_key=True, nullable=False)
#: Bus of the corresponding area
bus_id = Column(BigInteger, primary_key=True, nullable=False)
#: Gas carrier of the voronoi area ("CH4", "H2_grid" or "H2_saltcavern")
#: Gas carrier of the voronoi area ("CH4", "H2" or "H2_saltcavern")
carrier = Column(Text)
#: Geometry of the corresponding area
geom = Column(Geometry("GEOMETRY", 4326))
Expand All @@ -48,15 +48,15 @@ def voronoi_egon2035():
"""
Create voronoi polygons for all gas carriers in eGon2035 scenario
"""
for carrier in ["CH4", "H2_grid", "H2_saltcavern"]:
for carrier in ["CH4", "H2", "H2_saltcavern"]:
create_voronoi("eGon2035", carrier)


def voronoi_egon100RE():
"""
Create voronoi polygons for all gas carriers in eGon100RE scenario
"""
for carrier in ["CH4", "H2_grid", "H2_saltcavern"]:
for carrier in ["CH4", "H2", "H2_saltcavern"]:
create_voronoi("eGon100RE", carrier)


Expand Down
Loading

0 comments on commit 1474cb2

Please sign in to comment.