IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
227 stars 118 forks source link

Extend the `validate()` signature #804

Closed danielhuppmann closed 9 months ago

danielhuppmann commented 9 months ago

Please confirm that this PR has done the following:

Description of PR

This PR extends the signature of the validate() method to take filter-arguments directly instead of using a (nested) dictionary, so

df.validate({"Primary Energy": {"up": x, year=y}})

can now be called as

df.validate(variable="Primary Energy", year=y, upper=x)

This allows to validate only a selection of the datapoints, e.g., filtered by region or model/scenario name. The signature can also more easily be called from a (to-be-implemented) processor in the nomenclature package.

The option to use nested dicts is marked as deprecated with release 3.0.

codecov[bot] commented 9 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (d1cd1f7) 94.7% compared to head (a2fefa9) 94.7%.

Files Patch % Lines
pyam/validation.py 96.0% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #804 +/- ## ===================================== Coverage 94.7% 94.7% ===================================== Files 62 62 Lines 6012 6058 +46 ===================================== + Hits 5696 5741 +45 - Misses 316 317 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

danielhuppmann commented 9 months ago

Thanks @phackstock - implemented your suggestion for upper_bound and lower_bound, but I don't think that checking deprecation-warnings is worth the effort...