Skip to content

Commit

Permalink
bugfix macc USD + land conversions cost calib
Browse files Browse the repository at this point in the history
  • Loading branch information
flohump committed Sep 27, 2024
1 parent bf485ed commit 11de788
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 15 deletions.
10 changes: 5 additions & 5 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cfg$input <- c(regional = "rev4.112_h12_magpie.tgz",
cellular = "rev4.112_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz",
validation = "rev4.112_h12_magpie.tgz",
additional = "additional_data_rev4.56.tgz",
calibration = "calibration_H12_26Mar24_fixed.tgz")
calibration = "calibration_H12_27Sep24.tgz")

# NOTE: It is recommended to recalibrate the model when changing cellular input data
# as well as for any other setting that would affect initial values in the model,
Expand Down Expand Up @@ -93,22 +93,22 @@ cfg$best_calib <- TRUE # def = TRUE
# * (FALSE): Land conversion cost calibration will not be performed
cfg$recalibrate_landconversion_cost <- "ifneeded" #def "ifneeded"
# Up to which accuracy shall be recalibrated?
cfg$calib_accuracy_landconversion_cost <- 0.05 # def = 0.05
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 <- FALSE # def = FALSE
cfg$restart_landconversion_cost <- TRUE # def = TRUE
# Number of lowpass filter iterations applied on calibration factors
# for time steps 1995-2015
cfg$lowpass_filter_landconversion_cost <- 1 # def= 1
cfg$lowpass_filter_landconversion_cost <- 5 # def= 5
# 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 <- FALSE # def = FALSE
cfg$best_calib_landconversion_cost <- TRUE # def = TRUE

# Settings for NPI/NDC recalculation
# * (TRUE): NPI/NDC recalculation will be performed
Expand Down
4 changes: 2 additions & 2 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ $title magpie
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
* Used data set: additional_data_rev4.55.tgz
* Used data set: additional_data_rev4.56.tgz
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
* Used data set: calibration_H12_26Mar24_fixed.tgz
* Used data set: calibration_H12_27Sep24.tgz
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
Expand Down
10 changes: 5 additions & 5 deletions modules/57_maccs/on_aug22/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

* inflated using USD05 --> USD17 MER rate: 5 * 1.23
$if "%c57_macc_version%" == "PBL_2007" s57_step_length = 6.15;
* inflated using USD10 --> USD17 MER rate: 20 * 1
$if "%c57_macc_version%" == "PBL_2019" s57_step_length = 20;
* inflated using USD10 --> USD17 MER rate: 20 * 1
$if "%c57_macc_version%" == "PBL_2022" s57_step_length = 20;
* inflated using USD10 --> USD17 MER rate: 20 * 1.12
$if "%c57_macc_version%" == "PBL_2019" s57_step_length = 22.4;
* inflated using USD10 --> USD17 MER rate: 20 * 1.12
$if "%c57_macc_version%" == "PBL_2022" s57_step_length = 22.4;

$ontext
Determine level of GHG emission abatement depending on GHG prices.
There are 201 abatement steps. Each step is 6.15 USD17MER per tC eq in case of PBL_2007 and
20 USD17MER per tC eq in case of PBL_2019.
22.4 USD17MER per tC eq in case of PBL_2019.
Since the GHG prices are in USD per ton N and USD per ton CH4, conversion to USD per ton C eq is needed.
In this realization, the IPCC AR4 global warming potential factor for N2O (298) and CH4 (25) are used because
PBL used these parameters to convert USD per ton N2O and USD per ton CH4 into USD per ton C eq.
Expand Down
33 changes: 33 additions & 0 deletions scripts/start/extra/recalibrateH16.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# | (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: calculate and store new land conversion cost calibration factors for default setup (time consuming; up to 40 model runs with 5 time steps)
# --------------------------------------------------------

library(magpie4)
library(magclass)

# Load start_run(cfg) function which is needed to start MAgPIE runs
source("scripts/start_functions.R")

#start MAgPIE run
source("config/default.cfg")
cfg$input['regional'] <- "rev4.112_36f73207_magpie.tgz"
cfg$input['validation'] <- "rev4.112_36f73207_validation.tgz"
cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz"
cfg$input['cellular'] <- "rev4.112_36f73207_44a213b6_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz"

cfg$results_folder <- "output/:title:"
cfg$recalibrate <- FALSE
cfg$recalibrate_landconversion_cost <- TRUE
cfg$title <- "calib_run_H16"
cfg$output <- c("rds_report")
cfg$force_replace <- TRUE
cfg$qos <- "priority"
start_run(cfg,codeCheck=FALSE)
magpie4::submitCalibration("H16")
4 changes: 2 additions & 2 deletions scripts/start/extra/recalibrate_FSEC.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ source("scripts/projects/fsec.R")

# Calibration run
cfg <- fsecScenario(scenario = "c_BAU")
cfg$title <- "FSEC23Mar2024"
cfg$title <- "calib_run_FSEC"
cfg$results_folder <- "output/:title:"
cfg$recalibrate <- TRUE # required when penality_apr22 activated
cfg$best_calib <- TRUE
cfg$recalibrate_landconversion_cost <- TRUE
cfg$best_calib_landconversion_cost <- FALSE
cfg$best_calib_landconversion_cost <- TRUE
cfg$output <- c("rds_report")
cfg$force_replace <- TRUE
cfg$qos <- "priority"
Expand Down
2 changes: 1 addition & 1 deletion scripts/start/extra/recalibrate_default.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ source("config/default.cfg")
cfg$results_folder <- "output/:title:"
cfg$recalibrate <- FALSE
cfg$recalibrate_landconversion_cost <- TRUE
cfg$title <- "calib_run"
cfg$title <- "calib_run_H12"
cfg$output <- c("rds_report")
cfg$force_replace <- TRUE
cfg$qos <- "priority"
Expand Down

0 comments on commit 11de788

Please sign in to comment.