ensure correct dimensions in forward/return temperature arayx and change naming from "generic" to "default"
This commit is contained in:
parent
f096592b7f
commit
08c30d8b2e
@ -408,15 +408,14 @@ 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:
|
||||||
generic: 90
|
default: 90
|
||||||
DK: 70
|
DK: 70
|
||||||
SE: 70
|
SE: 70
|
||||||
NO: 70
|
NO: 70
|
||||||
FI: 70
|
FI: 70
|
||||||
return_temperature:
|
return_temperature:
|
||||||
generic: 50
|
default: 50
|
||||||
DK: 40
|
DK: 40
|
||||||
SE: 40
|
SE: 40
|
||||||
NO: 40
|
NO: 40
|
||||||
|
@ -11,7 +11,7 @@ from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator
|
|||||||
|
|
||||||
|
|
||||||
def map_temperature_dict_to_onshore_regions(
|
def map_temperature_dict_to_onshore_regions(
|
||||||
temperature_dict: dict, onshore_regions: xr.DataArray
|
temperature_dict: dict, onshore_regions: xr.DataArray, snapshots: xr.DataArray
|
||||||
) -> xr.DataArray:
|
) -> xr.DataArray:
|
||||||
"""
|
"""
|
||||||
Map dictionary of temperatures to onshore regions.
|
Map dictionary of temperatures to onshore regions.
|
||||||
@ -19,7 +19,7 @@ def map_temperature_dict_to_onshore_regions(
|
|||||||
Parameters:
|
Parameters:
|
||||||
----------
|
----------
|
||||||
temperature_dict : dictionary
|
temperature_dict : dictionary
|
||||||
Dictionary with temperatures as values and country keys as keys. One key must be named "generic"
|
Dictionary with temperatures as values and country keys as keys. One key must be named "default"
|
||||||
onshore_regions : xr.DataArray
|
onshore_regions : xr.DataArray
|
||||||
Names of onshore regions
|
Names of onshore regions
|
||||||
|
|
||||||
@ -29,16 +29,20 @@ def map_temperature_dict_to_onshore_regions(
|
|||||||
The dictionary values mapped to onshore regions with onshore regions as coordinates.
|
The dictionary values mapped to onshore regions with onshore regions as coordinates.
|
||||||
"""
|
"""
|
||||||
return xr.DataArray(
|
return xr.DataArray(
|
||||||
|
[
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
temperature_dict[get_country_from_node_name(node_name)]
|
temperature_dict[get_country_from_node_name(node_name)]
|
||||||
if get_country_from_node_name(node_name) in temperature_dict.keys()
|
if get_country_from_node_name(node_name) in temperature_dict.keys()
|
||||||
else temperature_dict["generic"]
|
else temperature_dict["default"]
|
||||||
)
|
)
|
||||||
for node_name in onshore_regions["name"].values
|
for node_name in onshore_regions["name"].values
|
||||||
|
]
|
||||||
|
# pass both nodes and snapshots as dimensions to preserve correct data structure
|
||||||
|
for _ in snapshots["time"].values
|
||||||
],
|
],
|
||||||
dims=["name"],
|
dims=["time", "name"],
|
||||||
coords={"name": onshore_regions["name"]},
|
coords={"time": snapshots["time"], "name": onshore_regions["name"]},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -76,12 +80,14 @@ if __name__ == "__main__":
|
|||||||
map_temperature_dict_to_onshore_regions(
|
map_temperature_dict_to_onshore_regions(
|
||||||
temperature_dict=snakemake.params.forward_temperature_central_heating,
|
temperature_dict=snakemake.params.forward_temperature_central_heating,
|
||||||
onshore_regions=onshore_regions,
|
onshore_regions=onshore_regions,
|
||||||
|
snapshots=source_inlet_temperature_celsius["time"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return_temperature_central_heating: xr.DataArray = (
|
return_temperature_central_heating: xr.DataArray = (
|
||||||
map_temperature_dict_to_onshore_regions(
|
map_temperature_dict_to_onshore_regions(
|
||||||
temperature_dict=snakemake.params.return_temperature_central_heating,
|
temperature_dict=snakemake.params.return_temperature_central_heating,
|
||||||
onshore_regions=onshore_regions,
|
onshore_regions=onshore_regions,
|
||||||
|
snapshots=source_inlet_temperature_celsius["time"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user