Remove data from linked items when removing data from indexset items #171
+646
−60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
message_ix.Scenario.remove_set()
expects that when an element from anIndexSet
is removed, all corresponding keys from other optimization items (i.e. keys that contain this element from items linked theIndexSet
) are also removed (because otherwise, the linked items would contain invalid data). This PR adds the functionality to provide the same behavior.However, since I'm not a big of silently doing stuff in the background, our version of this comes with a flag to disable it. The default for this is
True
right now, i.e. to remove related data, but this is mainly because the function will for now mostly be called from message_ix, which needs this default. I'm happy to swap the default toFalse
and have the shim layer requestTrue
every time it needs it if you think that's better.The PR includes some preparatory cleanups and notes.