Fix summation errors: load parameter values from ref gdx because they are not covered by the fixing mechanism#2389
Merged
Conversation
…om ref gdx, because parameters are not automatically treated by the fixing mechanism
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an inconsistency in historical (t < cm_startyear) CO2 land-use change subtype reporting by loading the p_co2lucSub parameter from the same reference GDX used by the fixing mechanism, preventing mismatches between the fixed aggregate (vm_emiMacSector(...,"co2luc")) and its reported subcomponents.
Changes:
- Load
p_co2lucSubfrominput_refwhencm_startyear > 2005to align pre-startyear values with the fixed reference run. - Only overwrite
p_co2lucSubvalues forttot >= cm_startyearfrom the lookup table (f_macBaseMagpie), leaving earlier years consistent with the reference GDX.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fbenke-pik
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose of this PR
Some time ago, CO2 landuse change subcategories were introduced into REMIND as pure parameters (
p_co2lucSub), which are passed through solely for reporting purposes but are not modified or used in calculations. Since they are parameters, they are not covered by the fixing mechanism. In contrast, their sum (vm_emiMacSector(t,regi, “co2luc”)) is a variable that is covered by the fixing mechanism. As a result,p_co2lucSubfor years <cm_startyearwas not fixed by the fixing mechanism to the values from the NPi, but were always read from the lookup table (f_macBaseMagpie). This led to summation errors, as the sum (vm_emiMacSector, fixed to ref as a variable) and the subcategories (p_co2lucSub, read from the lookup table) could be inconsistent.This PR loads
p_co2lucSubfor years <cm_startyearfrom the GDX—specifically, the same one used for fixing the variables—thereby ensuring consistency and eliminating the summation errors (reported in the issues listed below).Fixes https://github.com/remindmodel/development_issues/issues/769
Fixes https://github.com/remindmodel/development_issues/issues/768
Type of change
Parts concerned
Impact
Checklist
make test) after my final commit and all tests pass (FAIL 0)remind2if and where it was neededforbiddenColumnNamesin readCheckScenarioConfig.R in case the PR leads to deprecated switchesCHANGELOG.mdcorrectly (added, changed, fixed, removed, input data/calibration)