Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start script to be run on release #765

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions scripts/runTestRuns.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Load start_run(cfg) function which is needed to start MAgPIE runs
source("scripts/start_functions.R") # get start_run function

runTestRuns <- function(cfg) {
cfg$results_folder <- "output/:title:"
cfg$force_replace <- TRUE

# support function to create standardized title
.title <- function(cfg, ...) paste(cfg$info$flag, sep = "_", ...)

# Single time step run
timeSteps <- cfg$gms$c_timesteps
cfg$gms$c_timesteps <- 1
cfg$title <- .title(cfg, "singleTimeStep")
start_run(cfg, codeCheck = TRUE)
cfg$gms$c_timesteps <- timeSteps

# Reference and Policy run for the following SSPs:
for (ssp in c("SSP1", "SSP2", "SSP5")) {
cfg$title <- .title(cfg, paste(ssp, "Ref", sep = "-"))
cfg <- gms::setScenario(cfg, c(ssp, "NPI", "rcp7p0"))
cfg$gms$c56_mute_ghgprices_until <- "y2150"
cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp == "SSP2") "SSP2EU" else ssp, "-NPi")
cfg$gms$c60_2ndgen_biodem <- cfg$gms$c56_pollutant_prices
start_run(cfg, codeCheck = FALSE)

cfg$title <- .title(cfg, paste(ssp, "NDC", sep = "-"))
cfg <- gms::setScenario(cfg, c(ssp, "NDC", "rcp4p5"))
cfg$gms$c56_mute_ghgprices_until <- "y2150"
cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp == "SSP2") "SSP2EU" else ssp, "-NDC")
cfg$gms$c60_2ndgen_biodem <- cfg$gms$c56_pollutant_prices
start_run(cfg, codeCheck = FALSE)

cfg$title <- .title(cfg, paste(ssp, "PkBudg650", sep = "-"))
cfg <- gms::setScenario(cfg, c(ssp, "NDC", "rcp1p9"))
cfg$gms$c56_mute_ghgprices_until <- "y2030"
cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp == "SSP2") "SSP2EU" else ssp, "-PkBudg650")
cfg$gms$c60_2ndgen_biodem <- cfg$gms$c56_pollutant_prices
start_run(cfg, codeCheck = FALSE)
}
}
26 changes: 26 additions & 0 deletions scripts/start/extra/testRunsRelease.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
# | authors, and contributors see CITATION.cff file. This file is part
# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
# | AGPL-3.0, you are granted additional permissions described in the
# | MAgPIE License Exception, version 1.0 (see LICENSE file).
# | Contact: [email protected]

# ----------------------------------------------------------
# description: Test routine for standardized test runs for each release
# ----------------------------------------------------------

arguments <- commandArgs(trailingOnly = TRUE)
if (length(arguments) != 1) {
stop("Please provide the release number as argument, for example:\n",
"Rscript scripts/start/extra/testRunsRelease.R 4.9.3")
}

source("config/default.cfg")

source("scripts/start_functions.R")
download_and_update(cfg)

cfg$info$flag <- paste0("release-", arguments)

source("scripts/runTestRuns.R")
runTestRuns(cfg)
41 changes: 2 additions & 39 deletions scripts/start/test_runs.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,45 +26,8 @@ download_and_update(cfg)
# create additional information to describe the runs
cfg$info$flag <- "weeklyTests"

cfg$results_folder <- "output/:title:"
cfg$force_replace <- TRUE

# support function to create standardized title
.title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...))

# Single time step run
timeSteps <- cfg$gms$c_timesteps
cfg$gms$c_timesteps <- 1
cfg$title <- .title(cfg, "singleTimeStep")
start_run(cfg, codeCheck = TRUE)
cfg$gms$c_timesteps <- timeSteps


# Reference and Policy run for SSP1, SSP2 and SSP5
for(ssp in c("SSP1","SSP2","SSP5")) {

cfg$title <- .title(cfg, paste(ssp,"Ref",sep="-"))
cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0"))
cfg$gms$c56_mute_ghgprices_until <- "y2150"
cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NPi")
cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NPi")
start_run(cfg, codeCheck = FALSE)

cfg$title <- .title(cfg, paste(ssp,"NDC",sep="-"))
cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5"))
cfg$gms$c56_mute_ghgprices_until <- "y2150"
cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC")
cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC")
start_run(cfg, codeCheck = FALSE)

cfg$title <- .title(cfg, paste(ssp,"PkBudg650",sep="-"))
cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9"))
cfg$gms$c56_mute_ghgprices_until <- "y2030"
cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650")
cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650")
start_run(cfg, codeCheck = FALSE)

}
source("scripts/runTestRuns.R")
runTestRuns(cfg)

#####################################################
### FSEC Test runs (BAU + FSDP) with FSEC regions ###
Expand Down