diff --git a/config/config.default.yaml b/config/config.default.yaml index f7ee6716..12610771 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -410,18 +410,13 @@ sector: 2045: 0.8 2050: 1.0 district_heating_loss: 0.15 + # check these numbers! forward_temperature: - default: 90 - DK: 70 - SE: 70 - NO: 70 - FI: 70 + DE: 90 #C + DK: 60 #C return_temperature: - default: 50 - DK: 40 - SE: 40 - NO: 40 - FI: 40 + DE: 50 #C + DK: 40 #C heat_source_cooling: 6 #K heat_pump_cop_approximation: refrigerant: ammonia diff --git a/rules/build_sector.smk b/rules/build_sector.smk index 5916aa02..c7796bab 100644 --- a/rules/build_sector.smk +++ b/rules/build_sector.smk @@ -242,9 +242,11 @@ rule build_cop_profiles: "sector", "district_heating", "heat_pump_cop_approximation" ), heat_pump_sources=config_provider("sector", "heat_pump_sources"), + snapshots=config_provider("snapshots"), input: temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"), temp_air_total=resources("temp_air_total_elec_s{simpl}_{clusters}.nc"), + regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"), output: cop_profiles=resources("cop_profiles_elec_s{simpl}_{clusters}.nc"), resources: diff --git a/scripts/build_cop_profiles/run.py b/scripts/build_cop_profiles/run.py index 44bca6eb..69e2b519 100644 --- a/scripts/build_cop_profiles/run.py +++ b/scripts/build_cop_profiles/run.py @@ -8,6 +8,7 @@ import sys import numpy as np import pandas as pd import xarray as xr +import geopandas as gpd from _helpers import get_country_from_node_name, set_scenario_config from CentralHeatingCopApproximator import CentralHeatingCopApproximator from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator @@ -17,8 +18,8 @@ from scripts.definitions.heat_system_type import HeatSystemType def map_temperature_dict_to_onshore_regions( supply_temperature_by_country: dict, - onshore_regions: xr.DataArray, - snapshots: xr.DataArray, + regions_onshore: pd.Index, + snapshots: pd.DatetimeIndex, ) -> xr.DataArray: """ Map dictionary of temperatures to onshore regions. @@ -27,8 +28,10 @@ def map_temperature_dict_to_onshore_regions( ---------- supply_temperature_by_country : dictionary Dictionary with temperatures as values and country keys as keys. One key must be named "default" - onshore_regions : xr.DataArray + regions_onshore : pd.Index Names of onshore regions + snapshots : pd.DatetimeIndex + Time stamps Returns: ------- @@ -44,13 +47,13 @@ def map_temperature_dict_to_onshore_regions( in supply_temperature_by_country.keys() else supply_temperature_by_country["default"] ) - for node_name in onshore_regions["name"].values + for node_name in regions_onshore.values ] # pass both nodes and snapshots as dimensions to preserve correct data structure - for _ in snapshots["time"].values + for _ in snapshots ], dims=["time", "name"], - coords={"time": snapshots["time"], "name": onshore_regions["name"]}, + coords={"time": snapshots, "name": regions_onshore}, ) @@ -108,19 +111,20 @@ if __name__ == "__main__": set_scenario_config(snakemake) # map forward and return temperatures specified on country-level to onshore regions - onshore_regions: xr.DataArray = source_inlet_temperature_celsius["name"] + regions_onshore = gpd.read_file(snakemake.input.regions_onshore)["name"] + snapshots = pd.date_range(freq="h", **snakemake.params.snapshots) forward_temperature_central_heating_by_node_and_time: xr.DataArray = ( map_temperature_dict_to_onshore_regions( - temperature_dict=snakemake.params.forward_temperature_central_heating, - onshore_regions=onshore_regions, - snapshots=source_inlet_temperature_celsius["time"], + supply_temperature_by_country=snakemake.params.forward_temperature_central_heating, + regions_onshore=regions_onshore, + snapshots=snapshots, ) ) return_temperature_central_heating_by_node_and_time: xr.DataArray = ( map_temperature_dict_to_onshore_regions( - temperature_dict=snakemake.params.return_temperature_central_heating, - onshore_regions=onshore_regions, - snapshots=source_inlet_temperature_celsius["time"], + supply_temperature_by_country=snakemake.params.return_temperature_central_heating, + regions_onshore=regions_onshore, + snapshots=snapshots, ) ) cop_all_system_types = []