-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support data validation using value and tolerance (subclass implement…
…ation) (#371) * Add check that some validation criteria must exist * Add more tests * Make black * No reason not to allow both rtol and atol * Fix failing tests * Make bounds-fail-validation more generic * Implement validation by value and tolerance * Make ruff * Update docstring * Don't allow extra arguments to IamcDataFilter * Make fieldl optional * Make black * Separate DataValidationCriteria into separate classes * Sort imports * Use pydantic functionality for model_dump * Clean up DataValidationCriteria classes * Add explicit criteria check * Use property * Update error messages * Apply suggestions from code review Co-authored-by: Daniel Huppmann <dh@dergelbesalon.at> * Apply black * Disable Windows tests for now as there's a GH issue --------- Co-authored-by: Daniel Huppmann <dh@dergelbesalon.at>
- Loading branch information
1 parent
18c0b12
commit cee0ed1
Showing
10 changed files
with
130 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
5 changes: 5 additions & 0 deletions
5
tests/data/validation/validate_data/validate_bounds_and_rtol.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- variable: Final Energy | ||
year: 2010 | ||
upper_bound: 2.5 | ||
lower_bound: 1 | ||
rtol: 0.5 |
5 changes: 5 additions & 0 deletions
5
tests/data/validation/validate_data/validate_bounds_and_value.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- variable: Final Energy | ||
year: 2010 | ||
upper_bound: 2.5 | ||
lower_bound: 1 | ||
value: 1.5 |
4 changes: 2 additions & 2 deletions
4
...on/validate_data/validate_data_fails.yaml → ...date_data/validate_data_fails_bounds.yaml
This file contains 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
12 changes: 12 additions & 0 deletions
12
tests/data/validation/validate_data/validate_data_fails_value.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 2005 value passes the validation, fails validation for 2010 for both scenarios | ||
- variable: Primary Energy | ||
value: 2. | ||
atol: 1. | ||
# variable exists only for 'scen_a', fails validation for 2005 | ||
- variable: Primary Energy|Coal | ||
value: 3 | ||
# both upper and lower bound fail for both scenarios | ||
- variable: Primary Energy | ||
year: 2005 | ||
value: 1.5 | ||
rtol: 0.2 |
2 changes: 2 additions & 0 deletions
2
tests/data/validation/validate_data/validate_missing_criteria.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- variable: Final Energy | ||
year: 2010 |
This file contains 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
This file contains 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