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

cloning with and without explicit use of keyword_arguments model/scenario doesnt provide the same results #130

Closed
OFR-IIASA opened this issue Nov 26, 2018 · 1 comment

Comments

@OFR-IIASA
Copy link
Contributor

When explicitily using the keyword arguments model/scenario, and only when the model name is kept the same as in the scenario to be cloned (scenario: base - in the example below), then the clone command makes a a copy and assigns this the base scenario name "base" scenario instead of making a copy and assigning the copied scenario the "new scenario name".

import message_ix
import ixmp
mp = ixmp.Platform(dbtype='HSQLDB')
base = message_ix.Scenario(mp, 'Westeros Electrified', 'baseline', cache=True)

__
2018-11-26 10:33:35,663 INFO at.ac.iiasa.ixmp.objects.Scenario:215 - loading default Scenario 'Westeros Electrified|baseline' (version: 7, runid: 86)...
2018-11-26 10:33:35,744 INFO at.ac.iiasa.ixmp.objects.Scenario:241 - done loading Scenario from the database!
2018-11-26 10:33:35,744 INFO at.ac.iiasa.ixmp.objects.MsgScenario:457 - spatial and temporal disaggregation maps assignment
2018-11-26 10:33:35,760 INFO at.ac.iiasa.ixmp.objects.MsgScenario:573 - period mapping assignment
2018-11-26 10:33:35,760 INFO at.ac.iiasa.ixmp.objects.MsgScenario:599 - duration period assignment
2018-11-26 10:33:35,760 INFO at.ac.iiasa.ixmp.objects.Scenario:1826 - committing changes of Scenario 'Westeros Electrified|baseline' to the database (runid: 86)...
2018-11-26 10:33:35,856 INFO at.ac.iiasa.ixmp.objects.Scenario:601 - done updating Scenario 'Westeros Electrified|baseline' to the database (runid: 86, version: 7)!
2018-11-26 10:33:35,856 INFO at.ac.iiasa.ixmp.objects.MsgScenario:457 - spatial and temporal disaggregation maps assignment
2018-11-26 10:33:35,872 INFO at.ac.iiasa.ixmp.objects.MsgScenario:573 - period mapping assignment
2018-11-26 10:33:35,872 INFO at.ac.iiasa.ixmp.objects.MsgScenario:599 - duration period assignment
__

With the explicit use of keyword arguments yields the following
scen = base.clone(model='Westeros Electrified', scenario='baseline_1',)
--> the base scenario is cloned and assigned a new version
__
2018-11-26 10:33:35,948 INFO at.ac.iiasa.ixmp.objects.Scenario:215 - loading default Scenario 'Westeros Electrified|baseline' (version: 0, runid: 86)...
2018-11-26 10:33:35,963 INFO at.ac.iiasa.ixmp.objects.Scenario:241 - done loading Scenario from the database!
2018-11-26 10:33:35,963 INFO at.ac.iiasa.ixmp.objects.Scenario:1896 - saving Scenario 'Westeros Electrified|baseline' to database (runid: 111)...
2018-11-26 10:33:36,087 INFO at.ac.iiasa.ixmp.objects.Scenario:604 - done saving Scenario 'Westeros Electrified|baseline' to the database (runid: 111, version: 10)
__

withOUT the explicit use of keyword arguments yields the following
scen = base.clone('Westeros Electrified', 'baseline_2',)
--> the base scenario is cloned with a new scenario name and assigned a new version
__
2018-11-26 10:33:36,109 INFO at.ac.iiasa.ixmp.objects.Scenario:215 - loading default Scenario 'Westeros Electrified|baseline_2' (version: 0, runid: 86)...
2018-11-26 10:33:36,125 INFO at.ac.iiasa.ixmp.objects.Scenario:241 - done loading Scenario from the database!
2018-11-26 10:33:36,125 INFO at.ac.iiasa.ixmp.objects.Scenario:1896 - saving Scenario 'Westeros Electrified|baseline_2' to database (runid: 112)...
2018-11-26 10:33:36,217 INFO at.ac.iiasa.ixmp.objects.Scenario:604 - done saving Scenario 'Westeros Electrified|baseline_2' to the database (runid: 112, version: 4)!
__

@gidden
Copy link
Member

gidden commented Nov 26, 2018

Hi oliver - yes, this is indeed caused by #129. We allow additional kwargs so your scenario kwarg is not getting picked up. Would you mind making a PR which changes scen to scenario in the clone function? In that PR, we would also want to deprecate scen similar to how keep_sol is deprecated.

@gidden gidden closed this as completed in 154c581 Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants