modified save_site_database.py for nl and added new tests#139
Open
spyke7 wants to merge 1 commit intoopenclimatefix:mainfrom
Open
modified save_site_database.py for nl and added new tests#139spyke7 wants to merge 1 commit intoopenclimatefix:mainfrom
spyke7 wants to merge 1 commit intoopenclimatefix:mainfrom
Conversation
Contributor
|
It looks like lots of these changes are formatting ones. Would you be able to split this PR into Formatting and NL tests? |
Author
|
I did |
Author
|
Should I do it without doing the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
This PR adds validation for Netherlands (NL) solar capacity data to prevent inconsistent (“funky”) regional capacity values from being saved to the site database.
A new helper function validate_nl_capacities checks, per timestamp, that the sum of regional capacities (regions 1–12) matches the national capacity (region 0) within a configurable tolerance (default 0.1%). If the validation fails, the save process is aborted to avoid persisting bad data.
The validation is integrated into save_generation_to_site_db() and only runs for NL data when the required columns (capacity_kw, region_id) are present.
Fixes #135
How Has This Been Tested?
Unit tests were added to cover:
Integration tests were added to ensure:
save_generation_to_site_db() aborts when NL capacity validation fails
Data is correctly saved when NL capacity validation passes
Yes
If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?
Checklist: