Skip to content
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

Switch IIASA-Connection default argument #733

Merged
merged 8 commits into from
Mar 6, 2023

Conversation

danielhuppmann
Copy link
Member

@danielhuppmann danielhuppmann commented Feb 28, 2023

Please confirm that this PR has done the following:

  • Tests Added
  • Documentation Added
  • Name of contributors Added to AUTHORS.rst
  • Description in RELEASE_NOTES.md Added

Description of PR

In anticipation of the release of the re-implemented ixmp package, this PR changes the API of the iiasa.Connection methods to resemble other filter options (and the forthcoming ixmp API).

Currently, a user could be confused that the query

iiasa.Connection("integration-test").index(default=False)

will return a table of runs that have both True and False in the is_default column.

Going forward, a user has to do is_default=None to get all scenarios (default and non-default), while is_default=True will return only the default scenarios (as currently implemented by default=True).

The new ixmp package will also support is_default=False to return only the non-default scenarios - the current ixmp API does not support that option.

@codecov
Copy link

codecov bot commented Feb 28, 2023

Codecov Report

Merging #733 (28ce008) into main (13a1b93) will increase coverage by 0.0%.
The diff coverage is 100.0%.

@@          Coverage Diff          @@
##            main    #733   +/-   ##
=====================================
  Coverage   95.1%   95.1%           
=====================================
  Files         59      59           
  Lines       6044    6057   +13     
=====================================
+ Hits        5748    5761   +13     
  Misses       296     296           
Impacted Files Coverage Δ
pyam/iiasa.py 87.3% <100.0%> (+0.5%) ⬆️
pyam/logging.py 64.8% <100.0%> (ø)
tests/test_iiasa.py 97.8% <100.0%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@danielhuppmann danielhuppmann marked this pull request as ready for review February 28, 2023 15:52
Copy link

@meksor meksor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IXMPs python API will provide a Platform.runs.tabulate function which takes default_only and is_default arguments.
default_only is True per default, so Platform.runs.tabulate(is_default=False) will always return nothing. Instead Platform.runs.tabulate(is_default=False, default_only=False) will return all non-default runs.

It might be worth keeping this in mind when designing the pyam API.

@danielhuppmann
Copy link
Member Author

Thanks for the clarification, @meksor, will update the PR

@danielhuppmann
Copy link
Member Author

After some thinking, I went back to simply renaming the kwarg from "default" to "default_only" for forward-compatibility (with a deprecation-warning until release 2.0). The "is_default"-option (True, False, None) will not be available in the current (soon-to-be-legacy) API, so it's not necessary to add that here.

@danielhuppmann danielhuppmann merged commit 487c92c into IAMconsortium:main Mar 6, 2023
@danielhuppmann danielhuppmann deleted the iiasa/api-default branch March 6, 2023 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants