-
Notifications
You must be signed in to change notification settings - Fork 154
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
message_ix.Scenario.rename()
does not work as expected
#601
Comments
@khaeru and @glatterf42, following the demo in the TIGER workshop, I created this simple test related to this issue. Do you think this is good enough to be added to our test suite?
|
Hi @behnam-zakeri —yes, that would be very welcome! Just to explain (for everyone) how this kind of simple test can be a valuable part of a bug fixing workflow, one could:
If you don't have time to do these things, no problem—your comment is already very helpful and will make the work short for @glatterf42 or me. Please just tell us so. |
Improve `Scenario.rename()` to address #601
* Update multinode tutorial after resolving issue #601 * Extend multinode tutorial to include hints for questions * Add release notes #798 * Apply ruff and format hint code block * Rename tutorial to mention energy trade * Update mypy, ruff, pre-commit config Mypy v1.8.0 → v1.9.0 Ruff v0.3.0 → v0.3.2 pre-commit/action v3.0.0 → v3.0.1 --------- Co-authored-by: Fridolin Glatter <glatter@iiasa.ac.at> Co-authored-by: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
…a#798) * Update multinode tutorial after resolving issue iiasa#601 * Extend multinode tutorial to include hints for questions * Add release notes iiasa#798 * Apply ruff and format hint code block * Rename tutorial to mention energy trade * Update mypy, ruff, pre-commit config Mypy v1.8.0 → v1.9.0 Ruff v0.3.0 → v0.3.2 pre-commit/action v3.0.0 → v3.0.1 --------- Co-authored-by: Fridolin Glatter <glatter@iiasa.ac.at> Co-authored-by: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
message_ix.Scenario.rename()
is supposed to rename a set element, i.e., replacing the old name with a new name in allmessage_ix
sets and parameters. However, this is not the case, i.e., not all sets and parameters are updated with a new name correctly, and there is no error or warning thrown stating this incompleteness. One can for example run the following code and check this.It seems the issue is that under this method in
message_ix.core.py
, the check for finding a set element in a parameter is based onscenario.idx_names()
. This means, e.g., when renaming a "node", the code only finds parameters that have index names of "node", but missing other relevant parameters that have index names related to node but not "node" itself, e.g., "node_loc", "node_rel" etc. This can be resolved relatively easily by usingscenario.idx_sets()
and with a little tweak of the code, and should be done possibly soon, as this is a very useful feature.The text was updated successfully, but these errors were encountered: