Skip to content

Commit

Permalink
Merge branch 'features/status2023-heat' into features/status2023
Browse files Browse the repository at this point in the history
  • Loading branch information
nailend committed Feb 20, 2024
2 parents ef9d2db + 4e5023e commit 1aa738f
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 78 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ Added
`#205 <https://github.com/openego/powerd-data/pull/205>`_
* Update osm for status2023
`#169 <https://github.com/openego/powerd-data/pull/169>`_

* Add wrapped_partial to dynamise task generation
`#207 <https://github.com/openego/powerd-data/pull/207>`_


.. _PR #159: https://github.com/openego/eGon-data/pull/159
Expand Down
4 changes: 2 additions & 2 deletions src/egon/data/airflow/dags/pipeline_status_quo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from egon.data.datasets.heat_etrago import HeatEtrago
from egon.data.datasets.heat_etrago.hts_etrago import HtsEtragoTable
from egon.data.datasets.heat_supply import HeatSupply
from egon.data.datasets.heat_supply.individual_heating import HeatPumps2019
from egon.data.datasets.heat_supply.individual_heating import HeatPumpsStatusQuo
from egon.data.datasets.industrial_sites import MergeIndustrialSites
from egon.data.datasets.industry import IndustrialDemandCurves
from egon.data.datasets.loadarea import LoadArea, OsmLanduse
Expand Down Expand Up @@ -453,7 +453,7 @@
chp_etrago = ChpEtrago(dependencies=[chp, heat_etrago])

# Heat pump disaggregation for status2019
heat_pumps_2019 = HeatPumps2019(
heat_pumps_2019 = HeatPumpsStatusQuo(
dependencies=[
cts_demand_buildings,
DistrictHeatingAreas,
Expand Down
34 changes: 18 additions & 16 deletions src/egon/data/datasets/heat_etrago/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ def insert_buses(carrier, scenario):
SELECT ST_Centroid(geom) AS geom
FROM {sources['mv_grids']['schema']}.
{sources['mv_grids']['table']}
WHERE bus_id IN
(SELECT DISTINCT bus_id
WHERE bus_id IN
(SELECT DISTINCT bus_id
FROM boundaries.egon_map_zensus_grid_districts a
JOIN demand.egon_peta_heat b
JOIN demand.egon_peta_heat b
ON a.zensus_population_id = b.zensus_population_id
WHERE b.scenario = '{scenario}'
AND b.zensus_population_id NOT IN (
SELECT zensus_population_id FROM
SELECT zensus_population_id FROM
demand.egon_map_zensus_district_heating_areas
WHERE scenario = '{scenario}'
)
Expand Down Expand Up @@ -263,7 +263,7 @@ def insert_store(scenario, carrier):

def store():
for scenario in config.settings()["egon-data"]["--scenarios"]:
if scenario != "status2019":
if "status" not in scenario:
insert_store(scenario, "central_heat")
insert_store(scenario, "rural_heat")

Expand All @@ -290,8 +290,8 @@ def insert_central_direct_heat(scenario):
{targets['heat_generators']['table']}
WHERE carrier IN ('solar_thermal_collector', 'geo_thermal')
AND scn_name = '{scenario}'
AND bus IN
(SELECT bus_id
AND bus IN
(SELECT bus_id
FROM {targets['heat_buses']['schema']}.
{targets['heat_buses']['table']}
WHERE scn_name = '{scenario}'
Expand Down Expand Up @@ -368,13 +368,15 @@ def insert_central_direct_heat(scenario):
# Map solar thermal collectors to weather cells
join = gpd.sjoin(weather_cells, solar_thermal)[["index_right"]]

weather_year = get_sector_parameters("global", scenario)["weather_year"]

feedin = db.select_dataframe(
f"""
SELECT w_id, feedin
FROM {sources['feedin_timeseries']['schema']}.
{sources['feedin_timeseries']['table']}
WHERE carrier = 'solar_thermal'
AND weather_year = 2019
AND weather_year = {weather_year}
""",
index_col="w_id",
)
Expand Down Expand Up @@ -511,14 +513,14 @@ def insert_rural_gas_boilers(scenario):
{targets['heat_links']['table']}
WHERE carrier = 'rural_gas_boiler'
AND scn_name = '{scenario}'
AND bus0 IN
(SELECT bus_id
AND bus0 IN
(SELECT bus_id
FROM {targets['heat_buses']['schema']}.
{targets['heat_buses']['table']}
WHERE scn_name = '{scenario}'
AND country = 'DE')
AND bus1 IN
(SELECT bus_id
AND bus1 IN
(SELECT bus_id
FROM {targets['heat_buses']['schema']}.
{targets['heat_buses']['table']}
WHERE scn_name = '{scenario}'
Expand Down Expand Up @@ -607,8 +609,8 @@ def supply():
"""

for scenario in config.settings()["egon-data"]["--scenarios"]:
# There is no direct heat in status2019 scenario
if scenario != "status2019":
# There is no direct heat in status quo scenario
if "status" not in scenario:
insert_central_direct_heat(scenario)
insert_central_power_to_heat(scenario)
insert_individual_power_to_heat(scenario)
Expand All @@ -619,7 +621,7 @@ class HeatEtrago(Dataset):
def __init__(self, dependencies):
super().__init__(
name="HeatEtrago",
version="0.0.11",
version="0.0.12",
dependencies=dependencies,
tasks=(buses, supply, store),
)
)
10 changes: 5 additions & 5 deletions src/egon/data/datasets/heat_supply/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def district_heating():
if_exists="append",
)

# Do not check data for status2019 as is it not listed in the table
if scenario != "status2019":
# Do not check data for status quo as is it not listed in the table
if "status" not in scenario:
# Compare target value with sum of distributed heat supply
df_check = db.select_dataframe(
f"""
Expand Down Expand Up @@ -128,8 +128,8 @@ def district_heating():
if_exists="append",
)

# Insert resistive heaters which are not available in status2019
if scenario != "status2019":
# Insert resistive heaters which are not available in status quo
if "status" not in scenario:
backup_rh = backup_resistive_heaters(scenario)

if not backup_rh.empty:
Expand Down Expand Up @@ -182,7 +182,7 @@ class HeatSupply(Dataset):
def __init__(self, dependencies):
super().__init__(
name="HeatSupply",
version="0.0.9",
version="0.0.10",
dependencies=dependencies,
tasks=(
create_tables,
Expand Down
Loading

0 comments on commit 1aa738f

Please sign in to comment.