Comments (7)
@behnam2015 can you help adding a test for this case or extending one or more of existing? (see test_integration.py and test_core.py for details)
from ixmp.
cc @danielhuppmann @khaeru FYI
from ixmp.
cc @danielhuppmann @khaeru FYI
Thanks. This is pursuant to @behnam2015 explaining to me why I had to do this.
May also be related to #112
from ixmp.
@zikolach, when I only load ixmp things are okey. But when I load a message_ix Scenario this behavoir happens, i.e., scen = message_ix.Scenario(mp, model, scenario)
I wrote the test below to show this. And I realized that when I do scenario.clone()
for a model that doesn't have a first model year, I get an error:
Then, when I add the first model year and I clone, the situation that I explained happens: the default version is loaded instead of the new version. It seems there is a problem in the interaction between ixmp and message_ix on my machine.
from ixmp.
thanks for identifying this issue @behnam2015. I'm currently reworking the clone
feature for MESSAGE-scheme scenarios and will take a look.
from ixmp.
from message_ix import Scenario
import ixmp
test_mp = ixmp.Platform()
def model_setup(scen):
scen.add_set('node', 'node')
scen.add_set('commodity', 'comm')
scen.add_set('level', 'level')
scen.add_set('year', 2010)
scen.add_set('technology', 'tec')
scen.add_set('mode', 'mode')
output_specs = ['node', 'comm', 'level', 'year', 'year']
scen.add_par('demand', ['node', 'comm', 'level', 2010, 'year'], 1, 'GWa')
tec_specs = ['node', 'tec', 2010, 2010, 'mode']
scen.add_par('output', tec_specs + output_specs, 1, 'GWa')
def add_first_year(scen):
scen.remove_solution()
scen.check_out()
scen.add_set('cat_year', ['firstmodelyear', 2010])
scen.commit('')
Check if clone works as expected
def do_clone(scen):
try:
scen_new = scen.clone()
except:
print('Clone did not work!')
scen_new = []
return scen_new
Testing version number after cloning
def test_clone(test_mp):
scen = Scenario(test_mp, 'test_clone', 'test', version='new')
model_setup(scen)
scen.commit('initialize test model')
scen.solve(case='test_clone')
scen.set_as_default()
ver_old = scen.version
Cloning without first model year
scen_new = do_clone(scen)
assert scen_new
Cloning after adding first model year
add_first_year(scen)
scen_new = do_clone(scen)
ver_new = scen_new.version
Testing the version number
assert ver_new == ver_old + 1
from ixmp.
@danielhuppmann, thanks Daniel! I used the test above for this.
from ixmp.
Related Issues (20)
- Configure notifications for cron triggered workflows HOT 1
- Scenario.timeseries() doesn't filter results with 'year' field HOT 1
- Cannot commit after add_timeseries() call HOT 9
- Adjust for mypy 0.960
- How to remove a variable from a scenario? HOT 1
- Scenario.timeseries() not working when using transact() or check_out() HOT 2
- Database schema does not match ixmp schema HOT 4
- GAMS executable not found in PATH HOT 1
- Adjust for pandas 1.5.0 HOT 1
- Editable install not working HOT 15
- Update actions used in CI workflows
- Work around conda-forge/openjdk-feedstock#107
- Adjust for JPype1 v1.4.1 HOT 7
- Adjust for mypy `--no-implicit-optional`
- Address failing tests of R/Jupyter notebooks
- Adjust for pandas 2.0.0 HOT 4
- IXMP on Apple Silicon (ARM architecture) HOT 11
- Documentation to subannual timeslices erroneous
- `ixmp[tests] <= 3.6.0` not installable ← `codecov` yanked from PyPI HOT 1
- R 4.3.0 not working as expected on macOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ixmp.