Skip to content

Commit 8942376

Browse files
committed
doc: modify configuration section for open-tyndp specific config hierarchy and move section to getting started
1 parent 008574f commit 8942376

2 files changed

Lines changed: 57 additions & 23 deletions

File tree

doc/configuration.md

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,73 @@
77

88
# Configuration
99

10-
PyPSA-Eur has several configuration options which are documented in this section.
10+
Open-TYNDP is configured through layered YAML files. It inherits the complete PyPSA-Eur
11+
configuration surface and adds a TYNDP-specific layer on top, so the options documented in
12+
this section span both the general PyPSA-Eur settings and the Open-TYNDP additions. Both
13+
Open-TYNDP workflows, [Scenario Building (SB)](sb.md) and
14+
[Cost-Benefit Analysis (CBA)](cba.md), are driven by the same set of files.
1115

1216
<a id="defaultconfig"></a>
1317

1418

1519
## Configuration Files
1620

17-
As for PyPSA-Eur, any Open-TYNDP configuration can be set in a `.yaml` file. The default configurations
18-
`config/config.default.yaml`, `config/plotting.default.yaml` and `config/benchmarking.default.yaml`
19-
are maintained in the repository and cover all the options that are used/ can be set.
20-
21-
To pass your own configuration, you can create a new file, e.g. `my_config.yaml`,
22-
and specify the options you want to change. They will override the default settings and
23-
options which are not set, will be inherited from the defaults above.
24-
25-
Another way is to use the `config/config.yaml` file, which does not exist in the
26-
repository and is also not tracked by git. But snakemake will always use this file if
27-
it exists. This way you can run snakemake with a custom config without having to
28-
specify the config file each time.
29-
30-
Configuration order of precedence is as follows:
31-
1. Command line options specified with `--config` (optional)
32-
2. Custom configuration file specified with `--configfile` (optional)
33-
3. The `config/config.yaml` file (optional)
34-
4. The default configuration files `config/config.default.yaml` and `config/plotting.default.yaml`
35-
36-
To use your custom configuration file, you need to pass it to the `snakemake` command
37-
using the `--configfile` option:
21+
The configuration of an Open-TYNDP run is set from several files. The list below follows the
22+
hierarchy in which they are applied, from the base defaults up to the most specific overrides,
23+
with each layer overriding the ones listed before it:
24+
25+
- **`config/config.default.yaml`** — the base defaults, auto-generated from the configuration
26+
schema and inherited from PyPSA-Eur. Together with `config/plotting.default.yaml` and
27+
`config/benchmarking.default.yaml`, it covers every option that can be set and provides a
28+
value for each. These files are maintained in the repository and should not be edited
29+
directly.
30+
- **`config/data.tyndp.yaml`** — an optional data-source layer, loaded on top of the defaults
31+
when [`data_config: tyndp`](#data_config_cf) is set. It switches the supported datasets to the
32+
Open-TYNDP archive mirror on Google Cloud Storage (see [Data Sources](sb.md#tyndp_archive)).
33+
- **`config/config.yaml`** — your own local overrides. This file is not part of the repository
34+
and is not tracked by git, but Snakemake always picks it up if it exists, which makes it a
35+
convenient place to keep machine-specific settings without touching the tracked files. You
36+
can use `config/config.private.template.yaml` as a starting point.
37+
- **`config/config.tyndp.yaml`** — the Open-TYNDP run-level configuration. This is the file
38+
passed to Snakemake by the `pixi run tyndp-sb` and `pixi run tyndp-cba` entry points via
39+
`--configfile`, so it overrides all of the layers above. It activates the TYNDP-specific
40+
rules (through [`tyndp_scenario`](#tyndp_scenario_cf)) and sets the model-wide choices shared
41+
across scenarios, such as the modelled countries, snapshots, foresight mode, and planning
42+
horizons.
43+
- **`config/scenarios.tyndp.yaml`** — the per-scenario overrides, applied on top of the
44+
run-level configuration. `config.tyndp.yaml` points to this file through `run.scenarios.file`
45+
and switches it on with `run.scenarios.enable: true`. Each named scenario (e.g. `NT`, `DE`,
46+
`GA`, or a climate-year collection) supplies only the settings that differ from the run-level
47+
configuration and is selected through the `{run}` wildcard. See
48+
[Scenario Building](sb.md#configuration) and
49+
[Cost-Benefit Analysis](cba.md#running-single-vs-multiple-climate-years) for how each
50+
workflow uses these scenarios.
51+
52+
Any option you set in a higher layer overrides the value from the layers below it, while
53+
options you leave unset are inherited from the defaults. To try out a change you therefore only
54+
need to specify the handful of options that differ — everything else falls back to
55+
`config.tyndp.yaml` and the defaults.
56+
57+
Beyond these files, you are free to add configuration files of your own, e.g. `my_config.yaml`,
58+
and pass them explicitly to Snakemake:
3859

3960
```console
4061
$ snakemake -call --configfile my_config.yaml
4162
```
4263

64+
Taking all of this together, the order of precedence (highest first) is as follows:
65+
66+
1. Command-line options passed with `--config` (optional)
67+
2. Configuration files passed with `--configfile`, such as `config/config.tyndp.yaml` (optional)
68+
3. The `config/config.yaml` file (optional)
69+
4. The default configuration files `config/config.default.yaml`, `config/plotting.default.yaml`
70+
and `config/benchmarking.default.yaml`
71+
72+
On top of this, the per-scenario overrides from `config/scenarios.tyndp.yaml` are merged in for
73+
the scenario selected by the `{run}` wildcard. Note that because `config.tyndp.yaml` is passed
74+
with `--configfile`, it takes precedence over `config/config.yaml`; to override a value that
75+
`config.tyndp.yaml` already sets, pass it on the command line with `--config` or edit
76+
`config.tyndp.yaml` directly or via the scenario file `scenarios.tyndp.yaml`.
4377

4478
!!! warning
4579
In a previous version of PyPSA-Eur (`<=2025.04.0`), a full copy of the created config

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ nav:
3838
- Getting Started:
3939
- Introduction: introduction.md
4040
- Installation: installation.md
41+
- Configuration: configuration.md
4142
- FAQ and Troubleshooting: faq_troubleshooting.md
4243
- References:
4344
- Release Notes: release_notes.md
@@ -67,7 +68,6 @@ nav:
6768
- Validation: validation.md
6869
- Configuration:
6970
- Wildcards: wildcards.md
70-
- Configuration: configuration.md
7171
- References:
7272
- FAQ: faq.md
7373

0 commit comments

Comments
 (0)