update config and script

This commit is contained in:
AmosSchledorn 2024-08-07 13:33:59 +02:00
parent d903f4ace9
commit 80603fda6e
3 changed files with 24 additions and 23 deletions

View File

@ -410,18 +410,13 @@ sector:
2045: 0.8 2045: 0.8
2050: 1.0 2050: 1.0
district_heating_loss: 0.15 district_heating_loss: 0.15
# check these numbers!
forward_temperature: forward_temperature:
default: 90 DE: 90 #C
DK: 70 DK: 60 #C
SE: 70
NO: 70
FI: 70
return_temperature: return_temperature:
default: 50 DE: 50 #C
DK: 40 DK: 40 #C
SE: 40
NO: 40
FI: 40
heat_source_cooling: 6 #K heat_source_cooling: 6 #K
heat_pump_cop_approximation: heat_pump_cop_approximation:
refrigerant: ammonia refrigerant: ammonia

View File

@ -242,9 +242,11 @@ rule build_cop_profiles:
"sector", "district_heating", "heat_pump_cop_approximation" "sector", "district_heating", "heat_pump_cop_approximation"
), ),
heat_pump_sources=config_provider("sector", "heat_pump_sources"), heat_pump_sources=config_provider("sector", "heat_pump_sources"),
snapshots=config_provider("snapshots"),
input: input:
temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"), temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"),
temp_air_total=resources("temp_air_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: output:
cop_profiles=resources("cop_profiles_elec_s{simpl}_{clusters}.nc"), cop_profiles=resources("cop_profiles_elec_s{simpl}_{clusters}.nc"),
resources: resources:

View File

@ -8,6 +8,7 @@ import sys
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import xarray as xr import xarray as xr
import geopandas as gpd
from _helpers import get_country_from_node_name, set_scenario_config from _helpers import get_country_from_node_name, set_scenario_config
from CentralHeatingCopApproximator import CentralHeatingCopApproximator from CentralHeatingCopApproximator import CentralHeatingCopApproximator
from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator
@ -17,8 +18,8 @@ from scripts.definitions.heat_system_type import HeatSystemType
def map_temperature_dict_to_onshore_regions( def map_temperature_dict_to_onshore_regions(
supply_temperature_by_country: dict, supply_temperature_by_country: dict,
onshore_regions: xr.DataArray, regions_onshore: pd.Index,
snapshots: xr.DataArray, snapshots: pd.DatetimeIndex,
) -> xr.DataArray: ) -> xr.DataArray:
""" """
Map dictionary of temperatures to onshore regions. Map dictionary of temperatures to onshore regions.
@ -27,8 +28,10 @@ def map_temperature_dict_to_onshore_regions(
---------- ----------
supply_temperature_by_country : dictionary supply_temperature_by_country : dictionary
Dictionary with temperatures as values and country keys as keys. One key must be named "default" 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 Names of onshore regions
snapshots : pd.DatetimeIndex
Time stamps
Returns: Returns:
------- -------
@ -44,13 +47,13 @@ def map_temperature_dict_to_onshore_regions(
in supply_temperature_by_country.keys() in supply_temperature_by_country.keys()
else supply_temperature_by_country["default"] 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 # pass both nodes and snapshots as dimensions to preserve correct data structure
for _ in snapshots["time"].values for _ in snapshots
], ],
dims=["time", "name"], 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) set_scenario_config(snakemake)
# map forward and return temperatures specified on country-level to onshore regions # 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 = ( forward_temperature_central_heating_by_node_and_time: xr.DataArray = (
map_temperature_dict_to_onshore_regions( map_temperature_dict_to_onshore_regions(
temperature_dict=snakemake.params.forward_temperature_central_heating, supply_temperature_by_country=snakemake.params.forward_temperature_central_heating,
onshore_regions=onshore_regions, regions_onshore=regions_onshore,
snapshots=source_inlet_temperature_celsius["time"], snapshots=snapshots,
) )
) )
return_temperature_central_heating_by_node_and_time: xr.DataArray = ( return_temperature_central_heating_by_node_and_time: xr.DataArray = (
map_temperature_dict_to_onshore_regions( map_temperature_dict_to_onshore_regions(
temperature_dict=snakemake.params.return_temperature_central_heating, supply_temperature_by_country=snakemake.params.return_temperature_central_heating,
onshore_regions=onshore_regions, regions_onshore=regions_onshore,
snapshots=source_inlet_temperature_celsius["time"], snapshots=snapshots,
) )
) )
cop_all_system_types = [] cop_all_system_types = []