Skip to content

Commit 2acc9aa

Browse files
committed
doc: add release note and improve documentation
1 parent 7f7d4fe commit 2acc9aa

3 files changed

Lines changed: 20 additions & 16 deletions

File tree

doc/release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080

8181
* Use `combine_indicators` instead of `collect_indicators` in the function `summary_benchmark_indicators` ([#797](https://github.com/open-energy-transition/open-tyndp/pull/797)).
8282

83+
* Refactor `clean_projects` script to reduce the redundancy in its outputs ([#804](https://github.com/open-energy-transition/open-tyndp/issues/804)).
84+
8385

8486
## Upcoming PyPSA-Eur Release
8587

scripts/cba/clean_projects.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
the user can modify existing projects and add new ones.
1717
1818
- Using an existing combination (`project_id`, `bus0`, `bus1`), the user can overwrite any
19-
field of an existing project with a custom value. Not all fields need to be specified; leaving
20-
a field empty keeps its existing value.
19+
field of an existing project with a custom value. Not all fields need to be specified; leaving
20+
a field empty keeps its existing value.
2121
22-
- New projects are added as PINT projects. A new `project_id` must be used, and custom projects are added as links.
22+
- New projects must use a new `project_id` and are added as PINT links.
2323
2424
**Inputs**
2525
2626
- `data/tyndp_2024_bundle/cba_projects/20250312_export_transmission.xlsx`: Excel file containing CBA transmission projects
2727
- `data/tyndp_2024_bundle/cba_projects/20250312_export_storage.xlsx`: Excel file containing CBA storage projects (not yet processed)
2828
- `rules.retrieve_tyndp.output.nodes`: List of nodes defined in the workflow
29-
- `rules.retrieve_cba_guidelines_reference_projects.output.file`: Overview of the projects included in the reference grid, as defined in the Implementation Guidelines.
29+
- `rules.retrieve_cba_guidelines_reference_projects.output.file`: Overview of the projects included in the reference grid, as defined in the Implementation Guidelines
3030
- `data/custom_cba_transmission_projects.csv`: File used to configure custom transmission projects. With it, the user can modify existing projects and add new ones.
3131
3232
**Outputs**
@@ -45,6 +45,8 @@
4545
4646
- `resources/cba/storage_projects.csv`: Empty CSV with columns project_id and project_name (stub implementation)
4747
48+
- `resources/cba/cba_project_methods.csv`: List of the method to apply on projects
49+
4850
"""
4951

5052
import logging
@@ -77,15 +79,17 @@ def read_tyndp_electricity_buses(buses_fn: str) -> pd.Index:
7779
7880
Parameters
7981
----------
80-
- buses_fn (str): Path to "LIST OF NODES.xlsx" from tyndp bundle
82+
buses_fn : str
83+
Path to "LIST OF NODES.xlsx" from tyndp bundle.
8184
8285
Returns
8386
-------
84-
- buses: Index of electricity buses as used in Open-TYNDP
87+
pd.Index
88+
Index of electricity buses as used in Open-TYNDP.
8589
8690
See Also
8791
--------
88-
build_tyndp_network.py : build_buses
92+
build_tyndp_network.py : build_buses
8993
"""
9094
buses = pd.Index(
9195
pd.read_excel(buses_fn)
@@ -148,7 +152,7 @@ def remove_no_capacity(projects: pd.DataFrame) -> pd.DataFrame:
148152
Returns
149153
-------
150154
pd.DataFrame
151-
Curated list of projects with a defined capacity
155+
Curated list of projects with a defined capacity.
152156
"""
153157
if projects.empty:
154158
return projects
@@ -227,7 +231,7 @@ def extract_transmission_projects(
227231
}
228232
)
229233

230-
# Clean the project list by removing unclear border and projects with no capacity
234+
# Clean the project list by removing projects with unclear borders or no capacity
231235
projects = remove_unclear_border(projects, existing_buses)
232236
projects = remove_no_capacity(projects)
233237

@@ -355,7 +359,7 @@ def overwrite_projects(
355359
new_projects = custom_projects.index.difference(projects.index)
356360
existing_projects = custom_projects.index.intersection(projects.index)
357361

358-
# Fill missing values with existing projects
362+
# Fill missing values from existing projects
359363
custom_projects = custom_projects.reindex(columns=projects.columns).fillna(projects)
360364
custom_projects["is_crossborder"] = (
361365
custom_projects["is_crossborder"].fillna(True).astype(bool)
@@ -399,8 +403,8 @@ def build_method_assignments(
399403
guidelines: pd.DataFrame, projects: pd.DataFrame
400404
) -> pd.DataFrame:
401405
"""
402-
Define the method to apply on a project. The method can be PINT (default) or TOOT and can verify on
403-
the planning horizon (2030 or 2040).
406+
Determine the CBA assessment method for each project. The method is PINT (default) or TOOT and
407+
depends on the planning horizon (2030 or 2040).
404408
405409
Parameters
406410
----------
@@ -413,7 +417,6 @@ def build_method_assignments(
413417
-------
414418
pd.DataFrame
415419
List of the method to apply on projects.
416-
417420
"""
418421
guidelines = guidelines.rename(
419422
columns={
@@ -506,7 +509,7 @@ def build_method_assignments(
506509

507510
# Storage projects
508511
storage_projects = extract_storage_projects(storage_path, existing_buses)
509-
# TODO Add overwrite_projects for storages
512+
# TODO Add overwrite_projects for storage projects
510513
storage_projects.to_csv(snakemake.output.storage_projects, index=False)
511514

512515
# Method definition (PINT / TOOT)

scripts/cba/prepare_project.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ def load_method(methods_fn: str, project_id: int, planning_horizon: int) -> str:
4343
project_id : int
4444
Project reference ID.
4545
planning_horizon : int
46-
Planning horizon
46+
Planning horizon.
4747
4848
Returns
4949
-------
5050
str
5151
Method to be used to assess a project at a planning horizon.
52-
5352
"""
5453
methods = pd.read_csv(methods_fn)
5554
row = methods[

0 commit comments

Comments
 (0)