Skip to content

Commit

Permalink
fix MAGICC6 on reference run
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Feb 26, 2024
1 parent 85d0b60 commit 46e7e5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[[#1500](https://github.com/remindmodel/remind/pull/1500)]
- prevent tradtional biomass spillover to other sectors than buildings
[[#1519](https://github.com/remindmodel/remind/pull/1519)]
- fully fix landuse and MAGICC6 variables in delayed transition runs to reference run
[[#1565](https://github.com/remindmodel/remind/pull/1565)]

### removed
- **45_carbonprice** remove outdated realizations:
Expand Down
14 changes: 14 additions & 0 deletions scripts/output/single/fixOnRef.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ findRefMif <- function(outputdir, envi) {
return(refmif)
}

fixMAGICC <- function(d, dref, startyear) {
magiccgrep <- "^Forcing|^Temperature|^Concentration"
message("Fixing MAGICC6 data before ", startyear)
dnew <-
rbind(
filter(dref, grepl(magiccgrep, .data$variable),
.data$period < startyear),
filter(d, ! grepl(magiccgrep, .data$variable) |
.data$period >= startyear)
)
return(dnew)
}

fixOnMif <- function(outputdir) {

gdxs <- file.path(outputdir, "fulldata.gdx")
Expand Down Expand Up @@ -64,6 +77,7 @@ fixOnMif <- function(outputdir) {
refname <- basename(dirname(refmif))
d <- quitte::as.quitte(mifs)
dref <- quitte::as.quitte(refmif)
d <- fixMAGICC(d, dref, startyear)
failfile <- file.path(outputdir, "log_fixOnRef.csv")
fixeddata <- piamInterfaces::fixOnRef(d, dref, ret = "fixed", startyear = startyear, failfile = failfile)

Expand Down

0 comments on commit 46e7e5a

Please sign in to comment.