-
Notifications
You must be signed in to change notification settings - Fork 157
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
type_year="cumulative"
is only populated at .solve()
#828
Comments
@SongminYu, thanks for these two suggestions. First, when opening an issue on this repository you should have seen an a template (this one) that asks you to give certain information—including "the output of
The latest versions of the tutorials are automatically tested daily; see here. These tests all pass, which means that the code in each notebook cell runs without any error. When you say "one step is missing", what specifically happens without that step? Do you see an error message? If so, please paste the full text.
This is a good suggestion. Although (a) this is a documented and supported usage of @behnam-zakeri @glatterf42 perhaps we can include a small change to this line into #815. |
Hi @khaeru, thanks for your fast reply. I will remember to use the template next time. Regarding the tutorial error I saw, first I need to say that I am not running the Jupyter file but using PyCharm that I am more used to. I just pushed my code to GitHub and you can try it by running the If you comment out line 91 in the main.py file and run it, you can see the error message:
The error was fixed after I added this line 91, setting the category (or # Line 91:
scenario.add_category(set_name="year", file_name="Category_Year") The solved OBJ is 206280.146577. The excel file def add_category(self, set_name: str, file_name: str):
df = self.load_xlsx(file_name)
for _, row in df.iterrows():
self.scenario.add_cat(set_name, row["category"], row["name"]) Output of message-ix show-versions
|
Hi @SongminYu and thanks for your extensive report! There are a few things that jump out to me here:
history = [690]
model_horizon = [700, 710, 720]
scenario.add_horizon(year=history + model_horizon, firstmodelyear=model_horizon[0]) The So I think the first thing we need to help you is to figure out which version of MESSAGE you're using. Some of the aspects that are not in your |
Looking at the repo shared in the earlier comment, we see e.g. https://github.com/SongminYu/message_westeros/blob/main/message/scenario.py —so it seems the user has written their own code including classes with similar names to Scenario that somehow wrap the actual @SongminYu, to be clear, we can provide support for the features of |
I see, that makes more sense :) |
Referring to our own westeros_baseline.ipynb, I modify the following cell: scenario.solve() To the following from icecream import ic
# Prior to solve
ic(scenario.set("type_year"))
ic(scenario.set("cat_year"))
scenario.solve()
# After solve
ic(scenario.set("type_year"))
ic(scenario.set("cat_year")) And see this output:
This tells me a few things:
I will retitle this issue to cover the point in message_ix to be resolved. @SongminYu, for your own code, I think the work-arounds already identified are fine:
|
type_year="cumulative"
is only populated at .solve()
The fix should be to extend message_ix/message_ix/models.py Lines 304 to 327 in aabb789
|
Hi @khaeru, hi @glatterf42, thanks for your reply! Yes, that's exactly how I suspect: the "cumulative" category info was added in the |
Hi @glatterf42, yes, I installed the packages via miniconda. It was a long time ago when I first want to play with MESSAGE but was interrupted by other work. I just checked the version problem and managed to update the Output of message-ix show-versions
But, the |
In the emission bound (cumulative) tutorial, it seems one step is missing: add category for year, so "type_year" has "cumulative".
Besides, the following line is not clear enough:
The users do not know the keys in the
key_or_data
. I found this error by comparing with the emission tax tutorial... good training :)The text was updated successfully, but these errors were encountered: