Skip to content

Commit 6ab3be3

Browse files
daniel-rdttgilon
andauthored
feat: Integrate missing PECD data (#71)
* feat: add configuration for pecd fill_gaps_method for missing data * feat: add SolarPV for utility and rooftop with differentiation * fix: adjust config name of solar-pv carrier * fix: make LFSolarPV import more generic to differentiation of more nodes * feat: add Exception if no input data for specified PECD tech * feat: add onshore wind to tyndp renewable carriers and pecd profiles * fix: check in add existing renwables in case non of the specified carriers are included * fix: add back onwind and solar to renewable carriers until tyndp carriers are added to the model * feat: Slightly improve value error message * feat: add todo for redundant renewable carriers * feat: custom fix for skiprows and typo * feat: add collect rules for clean_pecd_datas and build_renewable_profiles_pecds * feat: add logger warning for missing files * feat: introduce safe_pyear helper function * feat: make handling of GB and UK more consistent * feat: adjust wording of logger about existing capacities * doc: document compatibility with Solar CSP * doc: document new config option for available pyears in all configs and documentation files * doc: add release note * feat: add verbose option to safe_pyear helper function * Apply suggestions from code review Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org> * fix: remove manual 2050 fallback to 2040 for PECD data * feat: adjust input and output types in safe_pyear * Apply suggestions from code review Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org> * feat: refactor input_data_pecd function for easier readability * apply suggestions from code review * doc: add documentation for retrieve_tyndp_pecd_data rule --------- Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org>
1 parent bfa22dd commit 6ab3be3

16 files changed

Lines changed: 237 additions & 54 deletions

config/config.default.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ electricity:
145145

146146
pecd_renewable_profiles:
147147
enable: false
148+
fill_gaps_method: zero
149+
available_years:
150+
- 2030
151+
- 2040
152+
- 2050
148153
technologies:
149154
Wind_Offshore:
150155
- offwind-ac-fb-r
@@ -393,6 +398,10 @@ load:
393398
enable: true
394399
interpolate_limit: 3
395400
time_shift_for_large_gaps: 1w
401+
available_years_tyndp:
402+
- 2030
403+
- 2040
404+
- 2050
396405
manual_adjustments: true
397406
scaling_factor: 1.0
398407
fixed_year: false

config/config.tyndp.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@ co2_budget:
3737
electricity:
3838
base_network: tyndp
3939

40-
renewable_carriers: [solar, solar-hsat, onwind, hydro]
41-
tyndp_renewable_carriers: [offwind-ac-fb-r, offwind-ac-fl-r, offwind-dc-fb-r, offwind-dc-fl-r, offwind-dc-fb-oh, offwind-dc-fl-oh, offwind-h2-fb-oh, offwind-h2-fl-oh]
40+
# TODO: remove redundant onwind and solar from renewable_carriers list once technologies are included as tyndp_renewable_carriers from PEMMDB data
41+
renewable_carriers: [onwind, solar, solar-hsat, hydro]
42+
tyndp_renewable_carriers: [onwind, solar-pv-utility, solar-pv-rooftop, offwind-ac-fb-r, offwind-ac-fl-r, offwind-dc-fb-r, offwind-dc-fl-r, offwind-dc-fb-oh, offwind-dc-fl-oh, offwind-h2-fb-oh, offwind-h2-fl-oh]
4243

4344
pecd_renewable_profiles:
4445
enable: true
46+
fill_gaps_method: zero
47+
# Complete PECD data is only available for the years 2030, 2040
48+
# TODO: adjust once udpated 2050 PECD data is available
49+
available_years:
50+
- 2030
51+
- 2040
4552
technologies:
4653
Wind_Offshore:
4754
- offwind-ac-fb-r
@@ -52,6 +59,12 @@ electricity:
5259
- offwind-dc-fl-oh
5360
- offwind-h2-fb-oh
5461
- offwind-h2-fl-oh
62+
LFSolarPVRooftop:
63+
- solar-pv-rooftop
64+
LFSolarPVUtility:
65+
- solar-pv-utility
66+
Wind_Onshore:
67+
- onwind
5568

5669
estimate_renewable_capacities:
5770
# NOTE: technologies that are covered by TYNDP renewable carriers need to be removed from estimation
@@ -76,6 +89,10 @@ load:
7689
source: tyndp # opsd, tyndp
7790
fill_gaps:
7891
enable: false
92+
available_years_tyndp:
93+
- 2030
94+
- 2040
95+
- 2050
7996
manual_adjustments: false
8097
supplement_synthetic: false
8198

config/test/config.tyndp.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@ electricity:
4949
Store: [H2]
5050
Link: [H2 pipeline]
5151

52-
renewable_carriers: [solar, solar-hsat, onwind]
53-
tyndp_renewable_carriers: [offwind-ac-fb-r, offwind-ac-fl-r, offwind-dc-fb-r, offwind-dc-fl-r, offwind-dc-fb-oh, offwind-dc-fl-oh, offwind-h2-fb-oh, offwind-h2-fl-oh]
52+
# TODO: remove redundant onwind and solar from renewable_carriers list once technologies are included as tyndp_renewable_carriers from PEMMDB data
53+
renewable_carriers: [onwind, solar, solar-hsat]
54+
tyndp_renewable_carriers: [onwind, solar-pv-utility, solar-pv-rooftop, offwind-ac-fb-r, offwind-ac-fl-r, offwind-dc-fb-r, offwind-dc-fl-r, offwind-dc-fb-oh, offwind-dc-fl-oh, offwind-h2-fb-oh, offwind-h2-fl-oh]
5455

5556
pecd_renewable_profiles:
5657
enable: true
58+
fill_gaps_method: zero
59+
# Complete PECD data is only available for the years 2030, 2040
60+
# TODO: adjust once udpated 2050 PECD data is available
61+
available_years:
62+
- 2030
63+
- 2040
5764
technologies:
5865
Wind_Offshore:
5966
- offwind-ac-fb-r
@@ -64,6 +71,12 @@ electricity:
6471
- offwind-dc-fl-oh
6572
- offwind-h2-fb-oh
6673
- offwind-h2-fl-oh
74+
LFSolarPVRooftop:
75+
- solar-pv-rooftop
76+
LFSolarPVUtility:
77+
- solar-pv-utility
78+
Wind_Onshore:
79+
- onwind
6780

6881
estimate_renewable_capacities:
6982
# NOTE: technologies that are covered by TYNDP renewable carriers need to be removed from estimation
@@ -103,6 +116,10 @@ load:
103116
source: tyndp # opsd, tyndp
104117
fill_gaps:
105118
enable: false
119+
available_years_tyndp:
120+
- 2030
121+
- 2040
122+
- 2050
106123
manual_adjustments: false
107124
supplement_synthetic: false
108125

doc/configtables/electricity.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ conventional_carriers,--,"Any subset of {nuclear, oil, OCGT, CCGT, coal, lignite
3232
renewable_carriers,--,"Any subset of {solar, onwind, offwind-ac, offwind-dc, offwind-float, hydro}",List of renewable generators to include in the model.
3333
tyndp_renewable_carriers,--,"Any subset of {solar-pv, solar-pv-utility, solar-pv-rooftop, onwind, offwind-ac-fb-r, offwind-ac-fl-r, offwind-dc-fb-r, offwind-dc-fl-r, offwind-dc-fb-oh, offwind-dc-fl-oh, offwind-h2-fb-oh, offwind-h2-fl-oh}",List of TYNDP renewable generators to include in the model. Technologies covered by specified TYNDP renewable carriers need to be removed from `estimate_renewable_carriers` technology list.
3434
pecd_renewable_profiles,,,
35-
-- enable,,bool,Activate PECD renewable profiles from 2024 TYNDP instead of default renewable profiles for specified renewable technologies below. Technologies ``pecd_techs`` can be any of {CSP, LFSolarPV, Wind_Offshore, Wind_Onshore}.
35+
-- enable,,bool,Activate PECD renewable profiles from 2024 TYNDP instead of default renewable profiles for specified renewable technologies below. Technologies ``pecd_techs`` can be any of {LFSolarPVUtility, LFSolarPVRooftop, Wind_Offshore, Wind_Onshore, CSP_noStorage, CSP_withStorage_7h_dispatched, CSP_withStorage_7h_preDispatch}.
36+
-- fill_gaps_method,,str,The chosen method for filling gaps in the PECD data to the modelled nodes. Can be either `zero` to fill with zero values or any other aggregation method such as `mean`, `median`, `max` or similar.
37+
-- available_years,--,list,"List of years for which PECD data is available."
3638
-- technologies,,,
3739
-- -- {pecd_tech},--,str,The PECD tech whose PECD profile is used. These PECD tech and their profiles are mapped to ``tyndp_renewable_carriers``.
3840
-- -- -- {tyndp_renewable_carriers},--,str,The `tyndp_renewable_carriers` for which the PECD profiles must be used. All `tyndp_renewable_carriers` must be mapped to a PECD profile. Non-TYNDP renewable carriers use the default renewable profiles.

doc/configtables/load.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fill_gaps,--,--,"Gaps filling strategy used."
44
-- enable,bool,"{true, false}","Whether to fill gaps using interpolation for small gaps and time shift for large gaps."
55
-- interpolate_limit,hours,integer,"Maximum gap size (consecutive nans) which interpolated linearly."
66
-- time_shift_for_large_gaps,string,string,"Periods which are used for copying time-slices in order to fill large gaps of nans. Have to be valid ``pandas`` period strings."
7+
available_years_tyndp,--,list,"List of years for which TYNDP demand data is available."
78
manual_adjustments,bool,"{true, false}","Whether to adjust the load data manually according to the function in :func:`manual_adjustment`."
89
scaling_factor,--,float,"Global correction factor for the load time series."
910
fixed_year,--,Year or False,"To specify a fixed year for the load time series that deviates from the snapshots' year"

doc/data-retrieval.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,11 @@ Data in this section is retrieved and extracted in rules specified in ``rules/re
258258
- **Link:** https://cdn.jsdelivr.net/gh/gavinr/world-countries-centroids@v1.0.0/dist/countries.geojson
259259
- **License:** MIT License
260260
- **Description:** Contains centroids of world countries in GeoJson.
261+
262+
``data/tyndp_2024_bundle/PECD``
263+
264+
- **Source:** TYNDP 2024 Scenarios, https://2024.entsos-tyndp-scenarios.eu/download/
265+
- **Link:** https://storage.googleapis.com/open-tyndp-data-store/PECD.zip
266+
- **License:** CC-BY 4.0
267+
- **Description:** Contains hourly PECD v3.1 capacity factor time series for Solar PV rooftop,
268+
Solar PV utility, Onshore Wind, Offshore Wind and Solar CSP.

doc/release_notes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Release Notes
1212
Upcoming Open-TYNDP Release
1313
================
1414

15-
15+
* Add complete compatibility for processing and preparation of PECD v3.1 renewable profiles (Solar PV rooftop, Solar PV utility, Onshore Wind, Offshore Wind, Solar CSP) (https://github.com/open-energy-transition/open-tyndp/pull/71). These profiles are used for the TYNDP 2024 and replace the default ERA5- and SARAH3-based profiles processed with Atlite. This implementation serves to facilitate a sub-workflow for creation of the renewable profiles, but does not yet attach them to any technologies.
1616

1717

1818
Upcoming PyPSA-Eur Release

doc/retrieve.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,8 @@ None.
168168
**Outputs**
169169

170170
- ``data/countries_centroids.geojson``
171+
172+
Rule ``retrieve_tyndp_pecd_data``
173+
====================================
174+
175+
.. automodule:: retrieve_tyndp_pecd_data

rules/build_electricity.smk

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#
44
# SPDX-License-Identifier: MIT
55

6+
from scripts._helpers import safe_pyear
7+
68

79
def input_elec_demand(w):
810
return {
@@ -398,6 +400,12 @@ rule clean_pecd_data:
398400
params:
399401
snapshots=config_provider("snapshots"),
400402
drop_leap_day=config_provider("enable", "drop_leap_day"),
403+
fill_gaps_method=config_provider(
404+
"electricity", "pecd_renewable_profiles", "fill_gaps_method"
405+
),
406+
available_years=config_provider(
407+
"electricity", "pecd_renewable_profiles", "available_years"
408+
),
401409
input:
402410
offshore_buses="data/tyndp_2024_bundle/Offshore hubs/NODE.xlsx",
403411
onshore_buses=resources("busmap_base_s_all.csv"),
@@ -418,19 +426,26 @@ rule clean_pecd_data:
418426

419427

420428
def input_data_pecd(w):
429+
available_years = config_provider(
430+
"electricity", "pecd_renewable_profiles", "available_years"
431+
)(w)
432+
planning_horizons = config_provider("scenario", "planning_horizons")(w)
433+
safe_pyears = set(
434+
safe_pyear(year, available_years, "PECD", verbose=False)
435+
for year in planning_horizons
436+
)
421437
return {
422438
f"pecd_data_{pyear}": resources("pecd_data_{technology}_" + str(pyear) + ".csv")
423-
for pyear in set(
424-
config_provider("scenario", "planning_horizons")(w)
425-
).intersection([2030, 2040])
426-
# Complete PECD data is only available for the years 2030, 2040
427-
# TODO: adjust if udpated 2050 data available
439+
for pyear in safe_pyears
428440
}
429441

430442

431443
rule build_renewable_profiles_pecd:
432444
params:
433445
planning_horizons=config_provider("scenario", "planning_horizons"),
446+
available_years=config_provider(
447+
"electricity", "pecd_renewable_profiles", "available_years"
448+
),
434449
input:
435450
unpack(input_data_pecd),
436451
output:
@@ -1032,6 +1047,7 @@ if config["load"]["source"] == "tyndp":
10321047
planning_horizons=config_provider("scenario", "planning_horizons"),
10331048
snapshots=config_provider("snapshots"),
10341049
scenario=config_provider("tyndp_scenario"),
1050+
available_years=config_provider("load", "available_years_tyndp"),
10351051
input:
10361052
electricity_demand="data/tyndp_2024_bundle/Demand Profiles",
10371053
output:

rules/collect.smk

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,27 @@ rule plot_power_networks_clustered:
9090
**config["scenario"],
9191
run=config["run"]["name"],
9292
),
93+
94+
95+
rule clean_pecd_datas:
96+
input:
97+
lambda w: expand(
98+
resources("pecd_data_{technology}_{planning_horizons}.csv"),
99+
**config["scenario"],
100+
run=config["run"]["name"],
101+
technology=config_provider(
102+
"electricity", "pecd_renewable_profiles", "technologies"
103+
)(w),
104+
),
105+
106+
107+
rule build_renewable_profiles_pecds:
108+
input:
109+
lambda w: expand(
110+
resources("profile_pecd_{clusters}_{technology}.nc"),
111+
**config["scenario"],
112+
run=config["run"]["name"],
113+
technology=config_provider(
114+
"electricity", "pecd_renewable_profiles", "technologies"
115+
)(w),
116+
),

0 commit comments

Comments
 (0)