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

Set duration_period in add_horizon() #286

Merged
merged 15 commits into from
Aug 12, 2020

Conversation

francescolovat
Copy link
Contributor

@francescolovat francescolovat commented Dec 17, 2019

This PR closes #282.

This PR edits the add_horizon method for Scenario class found in /message_ix/core.py

Change of data argument to **kwargs, and added automatic generation of duration_period parameter. Added description in the docstring of add_horizon.

Still, from #282 the following bullet needs to be addressed:

  • Clarify and test whether it should be possible to call add_horizon more than once. If so perhaps warn or return a value if the user adds overlapping sets of years; if not, raise an exception.

Please help, @khaeru I don't know why the changes in the core.py file are not reflected in the jupyter notebook files for the tutorials (I was testing my changes in the Westeros tutorial file but nothing was changing when I was editing or even commenting some methods in core.py).

PR checklist:

  • Tests added.
  • Documentation added.
  • Release notes updated.

@francescolovat francescolovat self-assigned this Dec 17, 2019
@khaeru khaeru changed the title **kwargs and duration_period Set duration_period in add_horizon() Dec 18, 2019
@francescolovat francescolovat added this to the 3.0 milestone Jan 9, 2020
@khaeru
Copy link
Member

khaeru commented Jan 24, 2020

Please help, @khaeru I don't know why the changes in the core.py file are not reflected in the jupyter notebook files for the tutorials (I was testing my changes in the Westeros tutorial file but nothing was changing when I was editing or even commenting some methods in core.py).

I guess you were not restarting the kernel or Jupyter—right? Searching for "Jupyter module reload" brings this and this as first results.

@khaeru khaeru removed their request for review January 24, 2020 09:58
@khaeru
Copy link
Member

khaeru commented Jun 7, 2020

Postponing to after v3.0.

@khaeru khaeru modified the milestones: 3.0, 3.1 Jun 7, 2020
@khaeru
Copy link
Member

khaeru commented Aug 12, 2020

Per discussion in Slack, I'll jump in here to help complete this.

@khaeru khaeru self-assigned this Aug 12, 2020
@khaeru khaeru added the enh New features & functionality label Aug 12, 2020
@codecov
Copy link

codecov bot commented Aug 12, 2020

Codecov Report

Merging #286 into master will increase coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #286      +/-   ##
==========================================
+ Coverage   90.32%   90.46%   +0.13%     
==========================================
  Files          31       31              
  Lines        2740     2780      +40     
==========================================
+ Hits         2475     2515      +40     
  Misses        265      265              
Impacted Files Coverage Δ
message_ix/message_ix/tests/test_core.py 100.00% <0.00%> (ø)
message_ix/message_ix/core.py 95.18% <0.00%> (+0.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 266f984...869e1c8. Read the comment docs.

@khaeru khaeru merged commit c53e3bb into iiasa:master Aug 12, 2020
@khaeru
Copy link
Member

khaeru commented Aug 12, 2020

Thanks @francescolovat!

@francescolovat
Copy link
Contributor Author

Thank you @khaeru for improving and merging this work! I see that just a little of my code survided to your exhaustive revision 😅

khaeru added a commit to khaeru/message_ix that referenced this pull request Aug 20, 2020
khaeru added a commit that referenced this pull request May 23, 2022
Remove calls to Scenario.add_par("duration_period", …); since #286
these are redundant when .add_horizon() is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features & functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add_horizon() should also set 'duration_period'
2 participants