Skip to content

Commit

Permalink
Merge pull request #766 from pvjeetze/f_MitiConsv
Browse files Browse the repository at this point in the history
fixes start script & reverting some default land conversion cost calibration settings
  • Loading branch information
pvjeetze authored Jan 28, 2025
2 parents fb39ad6 + ccb6b2c commit 267ac50
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 33 deletions.
6 changes: 3 additions & 3 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ cfg$calib_accuracy_landconversion_cost <- 0.01 # def = 0.01
# What is the maximum number of iterations if the precision goal is not reached?
cfg$calib_maxiter_landconversion_cost <- 40 # def = 40
# Restart from existing calibration factors (TRUE or FALSE)
cfg$restart_landconversion_cost <- TRUE # def = TRUE
cfg$restart_landconversion_cost <- FALSE # def = FALSE
# Number of lowpass filter iterations applied on calibration factors
# for time steps 1995-2015
cfg$lowpass_filter_landconversion_cost <- 5 # def= 5
cfg$lowpass_filter_landconversion_cost <- 1 # def= 1
# Set upper limit for cropland calibration factor
cfg$cost_calib_max_landconversion_cost <- 3 # def= 3
# Set lower limit for cropland calibration factor
cfg$cost_calib_min_landconversion_cost <- 0.05 # def= 0.05
# Selection type of calibration factors.
# If FALSE, calibration factors from the last iteration are used.
# If TRUE, calibration factors from the iteration with the lowest divergence are used.
cfg$best_calib_landconversion_cost <- TRUE # def = TRUE
cfg$best_calib_landconversion_cost <- FALSE # def = FALSE

# Settings for NPI/NDC recalculation
# * (TRUE): NPI/NDC recalculation will be performed
Expand Down
1 change: 1 addition & 0 deletions config/projects/scenario_config_miti_consv.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
;MitiConsv;MitiConsv-NoBuff
gms$s56_buffer_aff;0.2;0
input['calibration'];calibration_rev16_MitiConsv_22Jan25.tgz;calibration_rev16_MitiConsv_22Jan25.tgz
70 changes: 40 additions & 30 deletions scripts/start/projects/paper_MitiConsv.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# description: Land-based mitigation and habitat conservation
# -------------------------------------------------------------

rev <- "rev14"
rev <- "rev16"

cres <- "c200"

Expand All @@ -31,15 +31,20 @@ source("scripts/start_functions.R")

source("config/default.cfg")

cfg$title <- "calib_run"
cfg$title <- paste0(rev, "_calib_MitiConsv")
cfg$output <- c("rds_report", "validation_short")
cfg$force_replace <- TRUE

cfg$best_calib <- TRUE
# land conversion cost calibration settings
cfg$recalibrate_landconversion_cost <- TRUE
cfg$restart_landconversion_cost <- FALSE
cfg$best_calib_landconversion_cost <- FALSE

cfg$calib_accuracy_landconversion_cost <- 0.01
cfg$lowpass_filter_landconversion_cost <- 1

# cc is new default
cfg <- setScenario(cfg, c("SSP2","nocc_hist", "NPI", "ForestryExo"))
cfg <- setScenario(cfg, c("SSP2EU", "nocc_hist", "NPI", "ForestryExo"))
cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv")

# sticky
Expand All @@ -61,20 +66,20 @@ calib_tgz <- magpie4::submitCalibration(paste(rev, "MitiConsv", sep = "_"))
prefix <- paste(rev, "MitiConsv", cres, sep = "_")

scenarios <- c(
"SSP2-REF", "SSP2-PB650-PriceAR", "SSP2-PB650-PriceProt",
"SSP2-PB1000-PriceAR", "SSP2-PB1000-PriceProt",
"SSP2-PB650-PriceAR-30by30", "SSP2-PB650-PriceProt-30by30",
"SSP2-PB650-PriceAR-BH", "SSP2-PB650-PriceProt-BH",
"SSP2-PB1000-PriceAR-30by30", "SSP2-PB1000-PriceProt-30by30",
"SSP2-PB1000-PriceAR-BH", "SSP2-PB1000-PriceProt-BH"
"SSP2-REF", "SSP2-PB650-AR", "SSP2-PB650-AvC",
"SSP2-PB1000-AR", "SSP2-PB1000-AvC",
"SSP2-PB650-AR-BH", "SSP2-PB650-AvC-BH",
"SSP2-PB1000-AR-BH", "SSP2-PB1000-AvC-BH",
"SSP2-PB650-AR-KBA", "SSP2-PB650-AvC-KBA",
"SSP2-PB1000-AR-KBA", "SSP2-PB1000-AvC-KBA"
)

for (scen in scenarios) {
scen <- unlist(strsplit(scen, "-"))
ssp <- scen[grepl("SSP", scen)]

if (length(ssp) == 0) {
ssp <- "SSP2"
if (length(ssp) == 0 || ssp == "SSP2") {
ssp <- "SSP2EU"
}

source("config/default.cfg")
Expand All @@ -87,57 +92,62 @@ for (scen in scenarios) {
"output_check", "extra/disaggregation", "rds_report", "extra/runSEALSallocation"
)

cfg$input["calibration"] <- calib_tgz

# Climate change switched off for these runs
cfg <- setScenario(cfg, c(ssp, "nocc_hist", "NPI", "ForestryExo"))
cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv")

# Calibration settings
cfg$input["calibration"] <- calib_tgz

# sticky
cfg$gms$factor_costs <- "sticky_feb18"

# SNV habitat defintion
cfg$gms$land_snv <- "secdforest, other"

# Set path to coupled output
pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Jan25/remind/output/C_rev6_MitiConsv_SSP2-NPi-rem-12/REMIND_generic_C_rev6_MitiConsv_SSP2-NPi-rem-12.mif"

# No ghg price in NPI run
cfg$gms$c56_mute_ghgprices_until <- "y2100"

if ("PB650" %in% scen) {
cfg <- setScenario(cfg, "NDC")
# Update path to coupled output
pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Dec24/remind/output/C_rev5_MitiConsv_SSP2-PkBudg650-rem-12/REMIND_generic_C_rev5_MitiConsv_SSP2-PkBudg650-rem-12.mif"
# Settings taken from coupled runs
cfg$gms$c56_pollutant_prices <- "coupling"
cfg$gms$c60_2ndgen_biodem <- "coupling"
cfg$path_to_report_ghgprices <- pathToCoupledOutput
cfg$path_to_report_bioenergy <- pathToCoupledOutput
pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Jan25/remind/output/C_rev6_MitiConsv_SSP2-PkBudg650-rem-12/REMIND_generic_C_rev6_MitiConsv_SSP2-PkBudg650-rem-12.mif"
cfg$gms$c56_mute_ghgprices_until <- "y2030"
}

if ("PB1000" %in% scen) {
cfg <- setScenario(cfg, "NDC")
# Update path to coupled output
pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Dec24/remind/output/C_rev5_MitiConsv_SSP2-PkBudg1000-rem-12/REMIND_generic_C_rev5_MitiConsv_SSP2-PkBudg1000-rem-12.mif"
# Settings taken from coupled runs
cfg$gms$c56_pollutant_prices <- "coupling"
cfg$gms$c60_2ndgen_biodem <- "coupling"
cfg$path_to_report_ghgprices <- pathToCoupledOutput
cfg$path_to_report_bioenergy <- pathToCoupledOutput
pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Jan25/remind/output/C_rev6_MitiConsv_SSP2-PkBudg1000-rem-12/REMIND_generic_C_rev6_MitiConsv_SSP2-PkBudg1000-rem-12.mif"
cfg$gms$c56_mute_ghgprices_until <- "y2030"
}

if ("PriceAR" %in% scen) {
if ("AR" %in% scen) {
cfg$gms$c56_emis_policy <- "redd+natveg_nosoil"
}

if ("PriceProt" %in% scen) {
if ("AvC" %in% scen) {
cfg$gms$c56_emis_policy <- "redd+natveg_nosoil"
cfg$gms$s56_c_price_induced_aff <- 0
}

if ("30by30" %in% scen) {
cfg$gms$c22_protect_scenario <- "30by30"
if ("KBA" %in% scen) {
cfg$gms$c22_protect_scenario <- "KBA"
}

if ("BH" %in% scen) {
cfg$gms$c22_protect_scenario <- "BH"
}

# Settings taken from coupled runs
cfg$gms$c56_pollutant_prices <- "coupling"
cfg$gms$c60_2ndgen_biodem <- "coupling"
cfg$path_to_report_ghgprices <- pathToCoupledOutput
cfg$path_to_report_bioenergy <- pathToCoupledOutput

cfg$title <- paste0(prefix, "_", paste(scen, collapse = "-"))
start_run(cfg = cfg, codeCheck = FALSE)
}

0 comments on commit 267ac50

Please sign in to comment.