Skip to content

Validate sector weather year - #816

Merged
ktehranchi merged 4 commits into
PyPSA:developfrom
giovannicozzolongo:issue-607
Sep 28, 2026
Merged

ktehranchi merged 4 commits into
PyPSA:developfrom
giovannicozzolongo:issue-607

Conversation

@giovannicozzolongo

Copy link
Copy Markdown

Closes #607.

Changes proposed in this Pull Request

Sector-coupled runs with G or E-G now fail during configuration validation unless renewable_weather_years is [2018]. The schema error explains that residential and commercial demand profiles use 2018 weather data and shows the configured value. Electricity-only configurations keep their existing validation rules.

Tests cover the supported year, unsupported and empty year lists, electricity-only configurations and the error from Snakemake when loading a user configuration. The sector documentation states the requirement.

Testing

  • pytest -m fast --tb=short -ra: 792 passed, 11 skipped, 81 deselected. Ten skips require the absent master-benchmark worktree; one is an existing solver-test skip.
  • The eight new rejection cases fail on the unmodified schema.
  • Pre-commit hooks on all four changed files: passed.
  • mypy --check-untyped-defs --ignore-missing-imports tests/static/test_config_schema.py tests/static/test_dag_dryrun.py: passed.
  • cd docs && make html: passed without warnings.
  • Snakemake configuration loading for G and E-G with 2018, plus E with 2019: passed.
  • git diff --check: passed.

Tested with Python 3.11.15 and GLPK 5.0. Tier B and the data-dependent equivalence runs were not run.

Checklist

  • I tested my contribution locally.
  • pre-commit and pytest -m fast pass locally.
  • The configuration restriction is documented.
  • No dependency updates are needed.
  • No configuration keys were added.

giovannicozzolongo and others added 2 commits September 28, 2026 08:39
Signed-off-by: Giovanni Cozzolongo <79092266+giovannicozzolongo@users.noreply.github.com>
ktehranchi added a commit that referenced this pull request Sep 28, 2026
…shas (#817)

* ci: trim pre-commit to ruff + snakefmt, run ruff in CI, quote ledger shas

pre-commit.ci has failed on every PR since #805 because the hook set could
never converge: add-trailing-comma and ruff-format rewrote each other's
output, blackdoc crashed on a YAML snippet inside a docstring, pyupgrade
was pinned to py39 against a py311 target, and pretty-format-yaml
rewrote the unquoted sha `51e1719` in tests/equivalence/hotfixes.yaml as
the YAML float `.inf` (PR #816, HF-7 and HF-20), which is what broke
test_waiver_ledger there.

- .pre-commit-config.yaml: keep pre-commit-hooks basics, ruff-check,
  ruff-format and snakefmt; drop the four hooks above and the notebook
  cleaner; `ci.autofix_prs: false` so the bot reports instead of pushing
  commits into contributors' branches.
- main.yml: fast-tests now runs `ruff check` and `ruff format --check`
  with the same ruff pin as the hook (0.15.0), so lint is enforced
  without the external service.
- hotfixes.yaml: every `commit:`/`ported_sha:` value quoted (40 rows),
  so no YAML loader can read a sha as a number.
- Fix the three ruff findings on develop (RUF001, RUF059, RUF046) and
  drop the removed PD901 rule from extend-ignore.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* style: apply ruff 0.15 --fix and ruff format so the new lint step starts green

Mechanical output of `ruff check --fix` (9 findings: RUF046 int(len()),
RUF100 stale noqa) and `ruff format` (14 files), plus two hand fixes in
tests/equivalence/diagnostics/p_max_pu_quantiles.py: the E702 semicolon
line split in two and a noqa for the typographic minus sign in a figure
label. end-of-file-fixer adds the missing newline to .gitignore.
Verified on Sherlock (job 45731301): ruff check and format --check clean,
pre-commit run --all-files clean, 424 fast tests pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
@ktehranchi
ktehranchi merged commit 10b1be5 into PyPSA:develop Sep 28, 2026
5 checks passed
@trevorb1

Copy link
Copy Markdown
Collaborator

Thanks for the contribution, @giovannicozzolongo!

ktehranchi added a commit that referenced this pull request Sep 30, 2026
Brings the branch level with develop before the PR: the 2026-09-22 harness
merge, #813, #816 and #817 (quoted ledger shas). No conflicts; the diff
against develop is only tests/equivalence/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants