Add failing test cases to illustrate potentially conflicting information #315
+67
−0
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.
Closes #290.
@danielhuppmann, I took a look at the questions you brought up in #290 and I think we should be good.
The case that you described would be as follows. Given a model mapping:
with a variable code list:
and input data:
yields a pyam error for duplicate data:
meaning that as expected both operations are attempted. The aggregation of
Variable A (max)
though theregion-aggregation
attribute inVariable A
as well as the "standard" aggregation from the entryVariable A (max)
.This case is safe though since pyam yields an error. We could specifically protect against it but I'd say it's fine.
There might be more cases to consider though.
Only
Variable A (max)
Take the above data but eliminate the first two lines for
Varible A
. In this case we'd get the following aggregation result:for region_C, we now get 3 which is the sum, not the max of region_A and region_B.
This is wrong but expected since there is no method set for the aggregation of
Variable A (max)
. We could safeguard against that relatively easy by enforcing that aggregation methods between theregion-aggregation
attribute and the "normal" variable must be the same. So:in the above example. We could also make it more simple and remove the method attribute from the variable inside the
region-aggregation
attribute so that the method information is taken from the main variable directly.Only
Variable A
This is the straightforward version of the above case but I wanted to mention it. Taking only the first two rows of data gives:
which is correct and what we expect.
Variable A (max)
in aggregation regionThe final case that I could find is this one:
where
Variable A (max)
exists but for the common regionregion_C
. In this case we also don't get an error since the provided data always takes precedence over aggregated and we get:with the warning that there is a difference between aggregated and provided data for
region_C
.Summary
region-aggregation
attribute and the "original" variable entry. One way out of this could be to only allow mentioning the variable name inregion-aggregation
, all other information is then read from the original entry.@danielhuppmann, looking forward to your thoughts. I think I've thought through every case but please let me know if you've spotted an error.