Skip to content

Add config validation via json-schema #1547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Closes # (if applicable).
- [ ] Code and workflow changes are sufficiently documented.
- [ ] Changed dependencies are added to `envs/environment.yaml`.
- [ ] Changes in configuration options are added in `config/config.default.yaml`.
- [ ] Changes in configuration options are documented in `doc/configtables/*.csv`.
- [ ] Changes in configuration options are added in `config/config.schema.yaml`.
- [ ] Sources of newly added data are documented in `doc/data_sources.rst`.
- [ ] A release note `doc/release_notes.rst` is added.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sphinx:
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
apt_packages:
- graphviz

Expand Down
8 changes: 5 additions & 3 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import yaml
from os.path import normpath, exists, join
from shutil import copyfile, move, rmtree
from snakemake.utils import min_version

min_version("8.11")

from scripts._helpers import (
path_provider,
copy_default_files,
Expand All @@ -18,14 +15,19 @@ from scripts._helpers import (
get_shadow,
)

from scripts.lib.validation import validate_config

min_version("8.11")
copy_default_files(workflow)


configfile: "config/config.default.yaml"
configfile: "config/config.yaml"


validate_config(config, "config/config.schema.yaml")


run = config["run"]
scenarios = get_scenarios(run)
RDIR = get_rdir(run)
Expand Down
6 changes: 6 additions & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ renewable:
natura: true
excluder_resolution: 100
clip_p_max_pu: 1.e-2

offwind-ac:
cutout: europe-2013-sarah3-era5
resource:
Expand All @@ -189,6 +190,7 @@ renewable:
excluder_resolution: 200
clip_p_max_pu: 1.e-2
landfall_length: 10

offwind-dc:
cutout: europe-2013-sarah3-era5
resource:
Expand All @@ -207,6 +209,7 @@ renewable:
excluder_resolution: 200
clip_p_max_pu: 1.e-2
landfall_length: 10

offwind-float:
cutout: europe-2013-sarah3-era5
resource:
Expand All @@ -228,6 +231,7 @@ renewable:
max_depth: 1000
clip_p_max_pu: 1.e-2
landfall_length: 10

solar:
cutout: europe-2013-sarah3-era5
resource:
Expand All @@ -243,6 +247,7 @@ renewable:
natura: true
excluder_resolution: 100
clip_p_max_pu: 1.e-2

solar-hsat:
cutout: europe-2013-sarah3-era5
resource:
Expand All @@ -258,6 +263,7 @@ renewable:
natura: true
excluder_resolution: 100
clip_p_max_pu: 1.e-2

hydro:
cutout: europe-2013-sarah3-era5
carriers: [ror, PHS, hydro]
Expand Down
Loading
Loading