Skip to content

Validation thresholds in compareScenarios - #2493

Merged
pweigmann merged 7 commits into
remindmodel:developfrom
pweigmann:cs-vs
Oct 8, 2026
Merged

pweigmann merged 7 commits into
remindmodel:developfrom
pweigmann:cs-vs

Conversation

@pweigmann

@pweigmann pweigmann commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Purpose of this PR

Validation thresholds can now be included into line plots in compareScenarios via the following changes:

It boils down to using the default REMIND thresholds in the AMT validationConfig (via the new validationConfig parameter) on the runs that were selected for a compareScenarios execution, together with their historical data for checks that are relative to reference data. It has been implemented in a way which avoids needing to make changes to the plotting calls in the cs RMDs by checking if a given variable has thresholds available that can be plotted.

For now, the REMIND scripts use NULL as default, so it won't yet run the validation, until further testing has been done.

Example:
image

Type of change

Indicate the items relevant for your PR by replacing ◻️ with ☑️.
Do not delete any lines. This makes it easier to understand which areas are affected by your changes and which are not.

Parts concerned

  • ◻️ GAMS Code
  • ☑️ R-scripts
  • ◻️ Documentation (GAMS incode documentation, comments, tutorials)
  • ◻️ Input data / CES parameters
  • ◻️ Tests, CI/CD (continuous integration/deployment)
  • ◻️ Configuration (switches in main.gms, default.cfg, and scenario_config*.csv files)
  • ◻️ Other (please give a description)

Impact

  • ◻️ Bug fix
  • ◻️ Refactoring
  • ☑️ New feature
  • ◻️ Change of parameter values or input data (including CES parameters)
  • ◻️ Minor change (default scenarios show only small differences)
  • ◻️ Fundamental change of results of default scenarios

Checklist

Do not delete any line. Leave unfinished elements unchecked so others know how far along you are.
In the end all checkboxes must be ticked before you can merge
.

  • I executed the automated model tests (make test) after my final commit and all tests pass (FAIL 0)
  • I adjusted the reporting in remind2 if and where it was needed
  • I adjusted the madrat packages (mrremind and other packages involved) for input data generation if and where it was needed
  • My code follows the coding etiquette
  • I explained my changes within the PR, particularly in hard-to-understand areas
  • I checked that the in-code documentation is up-to-date
  • I adjusted forbiddenColumnNames in readCheckScenarioConfig.R in case the PR leads to deprecated switches
  • I updated the CHANGELOG.md correctly (added, changed, fixed, removed, input data/calibration)

Further information (optional)

A test cs is available here: https://cloud.pik-potsdam.de/index.php/f/30284389

Note, that most variable do not have validation thresholds. Find a list of which variables are checked how here:

https://pik-piam.github.io/piamValidation/articles/configs/validationConfig_REMIND.html

@simonkrogmann

Copy link
Copy Markdown
Contributor

How much does this increase CS2 time (both with and without validation thresholds)?

Comment thread scripts/output/comparison/compareScenarios2.R
Comment thread scripts/cs2/run_compareScenarios2.R Outdated
Comment thread scripts/cs2/run_compareScenarios2.R Outdated
@pweigmann

pweigmann commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

How much does this increase CS2 time (both with and without validation thresholds)?

Would expect it to be 30s to 5min max, depending on config and number of runs being compared. No change expected if config is NULL as no validation is run.

@simonkrogmann

Copy link
Copy Markdown
Contributor

And another thing: maybe test if this breaks the AMTs or even integrate it validationConfig if you find it useful there. Last time I touched this code I broke them. (coordinate with @tobiasdiez on his refactoring of modelstats)

if (!is.null(validationConfig)) {
args$validationConfig <- validationConfig
}
args$validationConfig <- validationConfig

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put that directly in the definition of the args aboce

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would break backwards compatibility, I'd rather keep it here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding it to the definition of args directly above does not change the behavior

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it does, if the argument is NULL, it would still create args$validationConfig if created in the list, while args$validationConfig <- NULL will not create it. Older versions will not expect that arg and throw an error in the first case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I learned another weird quirk of R today

@pweigmann
pweigmann merged commit 7dbb061 into remindmodel:develop Oct 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants