Skip to content

Automatically detect in prepare.R which variables + equations can be fixed - #2033

Merged
orichters merged 6 commits into
remindmodel:developfrom
orichters:develop
Mar 13, 2025
Merged

Automatically detect in prepare.R which variables + equations can be fixed#2033
orichters merged 6 commits into
remindmodel:developfrom
orichters:develop

Conversation

@orichters

@orichters orichters commented Mar 12, 2025

Copy link
Copy Markdown
Contributor

Purpose of this PR

  • avoid the problem at its core that REMIND tries to fix variables or equations that are not declared, maybe because they were renamed or because a different realization was chosen
  • instead of a hand-picked list of variables to be dropped depending on realization choices, just get the variables and equations that are declared from the code and only keep marginals, levels and fixings for the variables that are declared
  • print which variables that do exist in path_gdx_ref but have been dropped as they do not exist in the current run
  • print which variables couldn't not be fixed because they did not exist in path_gdx_ref. They might then still have non-zero values from path_gdx
  • this lead to me finding this problem where negative variables were not fixed at all
  • I removed all the manual renaming from prepare.R from old variable names that existed only long ago. The feature of renaming might still be used in the future, but I also adjusted it such that you only have to specify it once, not three times for a single renaming. Dropping stuff manually should not be necessary anymore.
  • fixed an inconsistency in bioenergy phaseout and population/GDP settings detected by the new tests in coupled test config file and ScenarioMIP as agreed with Laurin
  • add make test-coupled log files to .gitignore
  • example run: /p/tmp/oliverr/remindmagpie/output/SSP2-PkBudg1000_2025-03-13_08.41.05

Type of change

  • Bugfix including a bigger refactoring of this part with minor new features

Checklist:

  • My code follows the coding etiquette
  • I performed a self-review of my own code
  • 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 the reporting in remind2 where it was needed
  • I adjusted forbiddenColumnNames in readCheckScenarioConfig.R in case the PR leads to deprecated switches
  • I checked the log.txt file of my runs for newly introduced summation, fixing or variable name errors
  • All automated model tests pass, executed after my final commit (FAIL 0 in the output of make test)
  • make test-coupled-slurm works apart from a from settings in ScenarioMIP config is fixed in this commit.
  • The changelog CHANGELOG.md has been updated correctly

@orichters
orichters marked this pull request as ready for review March 12, 2025 15:50
Comment thread scripts/start/prepare.R Outdated
# in core/loop.gms.
full_manipulateThis <- c(full_manipulateThis,
full_manipulateThis <- c(
list(c("cb20150605readinpositionforlevelfile",

@orichters orichters Mar 13, 2025

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.

Where does this actually go? I couldn't find any spot where this cb20150605readinpositionforlevelfile part will be inserted.

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.

I deleted it. It was removed here: a64823c

@LaviniaBaumstark LaviniaBaumstark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that is nice, thank you!

@orichters
orichters merged commit b9f6699 into remindmodel:develop Mar 13, 2025
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