From 0b8bd7d505666f2c17f684ed3037c60267d199d1 Mon Sep 17 00:00:00 2001 From: gabriel-abrahao Date: Thu, 23 Nov 2023 21:54:17 +0100 Subject: [PATCH 01/76] Created ar6Climate to run climate assessment --- scripts/output/single/ar6Climate.R | 151 +++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 scripts/output/single/ar6Climate.R diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R new file mode 100644 index 000000000..d5dc7454f --- /dev/null +++ b/scripts/output/single/ar6Climate.R @@ -0,0 +1,151 @@ +library(madrat) +library(remind2) +library(quitte) +library(piamInterfaces) +library(yaml) +library(lucode2) +library(readxl) # GA: Wont be necessary after https://github.com/iiasa/climate-assessment/pull/43 goes into release + +############################# BASIC CONFIGURATION ############################# +gdx_name <- "fulldata.gdx" # name of the gdx +cfg_name <- "cfg.txt" # cfg file for getting file paths + + +if(!exists("source_include")) { + # Define arguments that can be read from command line + outputdir <- "." + readArgs("outputdir", "gdx_name", "gdx_ref_name", "gdx_refpolicycost_name") +} + +gdx <- file.path(outputdir, gdx_name) +cfg_path <- file.path(outputdir, cfg_name) +logfile <- file.path(outputdir, "climate.log") # specific log for python steps +scenario <- getScenNames(outputdir) +remind_reporting_file <- file.path(outputdir,paste0("REMIND_generic_", scenario,".mif")) + +print(getwd()) +############################# PREPARING EMISSIONS INPUT ############################# + +# Read the cfg to get the location of MAGICC-related files +cfg <- read_yaml(cfg_path) +#######################################################################DELETEME MOVE TO DEFAULT.CFG!!!!!!!!!!!!!!!!!! +cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" +#######################################################################DELETEME MOVE TO DEFAULT.CFG!!!!!!!!!!!!!!!!!! + +# Read the GDX and run reportEmi +# gdxpath <- "fulldata.gdx" +cat(date()," ar6Climate.R: Running reportEmi \n") +emimag <- reportEmi(gdx) + +# Convert to quitte and add metadata +emimif <- as.quitte(emimag) +emimif["scenario"] <- scenario #TODO: Get scenario name from cfg + +# Write the raw emissions mif +# TODO: This wouldn't be necessary if we added an option to generateIIASASubmission +# to work with a quitte object directly, not a file path +cat(date()," ar6Climate.R: Writing raw emissions mif in file: \n") +emimifpath <- paste0(outputdir,"/","emimif_raw_",scenario,".mif") +cat(date()," ar6Climate.R: ", emimifpath, "\n") +write.mif(emimif,emimifpath) + +# Get the emissions in AR6 format +# This seems to work with just the reportEmi mif +cat(date()," ar6Climate.R: Running generateIIASASubmission to generate AR6 mif in file:\n") +emimifar6fpath <- paste0(outputdir,"/","emimif_ar6_",scenario,".mif") +cat(date()," ar6Climate.R: ", emimifar6fpath, "\n") +generateIIASASubmission(emimifpath, mapping = "AR6", outputDirectory = outputdir, outputFilename = basename(emimifar6fpath), logFile = paste0(outputdir, "/missing.log")) + +# Read in AR6 mif +cat(date()," ar6Climate.R: Reading AR6 mif and preparing csv for climate-assessment\n") +ar6mif <- read.quitte(emimifar6fpath) + +# Get it ready for climate-assessment: capitalized titles, just World, comma separator +colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep="") +ar6mif <- ar6mif[ar6mif$Region %in% c("GLO","World"),] +ar6mif$Region = "World" + +# Long to wide +outcsv <- reshape(as.data.frame(ar6mif), direction = "wide", timevar = "Period", v.names = "Value", idvar = c("Model","Variable","Scenario","Region","Unit")) +colnames(outcsv) <- gsub("Value.","",colnames(outcsv)) + +# Write output in csv for climate-assessment +cat(date()," ar6Climate.R: Writing csv for climate-assessment\n") +ar6csvfpath <- paste0(outputdir,"/","ar6csv_",scenario,".csv") +write.csv(outcsv, ar6csvfpath, row.names=F, quote=F) + +############################# PYTHON/MAGICC SETUP ############################# +# These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure +# TODO: Make this even more flexible by explictly setting them in default.cfg +probabilistic_file <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") +infilling_database_file <- file.path(cfg$climate_assessment_files_dir,"/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") +magicc_bin_file <- file.path(cfg$climate_assessment_files_dir,"/magicc-v7.5.3/bin/magicc") + +# Create working folder for climate-assessment files +workfolder <- file.path(outputdir, "climate-temp") +dir.create(workfolder, showWarnings = F) + +# Set relevant environment variables and create a MAGICC worker directory +Sys.setenv(MAGICC_EXECUTABLE_7=magicc_bin_file) +Sys.setenv(MAGICC_WORKER_ROOT_DIR=normalizePath(paste0(workfolder,"/workers/"))) # Has to be an absolute path +Sys.setenv(MAGICC_WORKER_NUMBER=1) # TODO: Get this from slurm or nproc + +dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = T, showWarnings = F) + +# The base name, that climate-assessment uses to derive it's output names +basefname <- sub("\\.csv$","",basename(ar6csvfpath)) + +# Set up another log file for the python output +logmsg <- paste0(date(), " Created log\n================================ EXECUTING climate-assessment scripts =================================\n") +cat(logmsg) +capture.output(cat(logmsg), file = logfile, append = F) + +# TODO: Activate venv and get the script from the right location +# Get the available climate-assessment module location and its scripts folder +root_climate_assessment <- system('python -c "import importlib; print(importlib.util.find_spec(\\"climate_assessment\\").submodule_search_locations[0])"', intern = T) +# sfolder <- file.path(root_climate_assessment, "scripts/") +sfolder="/p/projects/piam/abrahao/scratch/iiasa/climate-assessment/scripts/" #TODO: Get the one used in the renv + + +############################# HARMONIZATION/INFILLING ############################# +logmsg <- paste0(date(), " Started harmonization\n") +cat(logmsg) +capture.output(cat(logmsg), file = logfile, append = T) + +cmd <- paste0("python ", sfolder, "run_harm_inf.py ", ar6csvfpath, " ", workfolder, " ", "--no-inputcheck --infilling-database ", infilling_database_file) +system(cmd) + +############################# RUNNING MODEL ############################# +logmsg <- paste0(date(), " Started runs\n") +cat(logmsg) +capture.output(cat(logmsg), file = logfile, append = T) + +cmd <- paste0("python ", sfolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilistic_file) +# cmd <- paste0("python ", sfolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilistic_file, " --save-csv-combined-output") +system(cmd) + +############################# READING CLIMATE OUTPUT ############################# +climoutfpath <- file.path(workfolder, paste0(basefname, "_harmonized_infilled_IAMC_climateassessment.xlsx")) +climdata <- read.quitte(climoutfpath) + +############################# APPEND TO REMIND MIF ############################# +# Filter only periods used in REMIND, so that it doesn't expand the original mif +useperiods <- unique(read.quitte(remind_reporting_file)$period) +climdata <- climdata[climdata$period %in% useperiods,] +climdata <- interpolate_missing_periods(climdata, useperiods, expand.values = F) +write.mif(climdata, remind_reporting_file, append = T) + + + + + + + + + + + + + + + From b60089df843b47cba79067732dc4db8c3b321c74 Mon Sep 17 00:00:00 2001 From: gabriel-abrahao Date: Thu, 23 Nov 2023 22:01:19 +0100 Subject: [PATCH 02/76] Moved climate_assessment_files_dir to cfg --- config/default.cfg | 4 ++++ scripts/output/single/ar6Climate.R | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 941aaca3e..73cda5f68 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -49,6 +49,10 @@ cfg$runstatistics <- "/p/projects/rd3mod/models/statistics/remind" # copied into remind when starting a run and required to calcualte climate responses (e.g. temperature). cfg$magicc_template <- "/p/projects/rd3mod/magicc/" +#### Folder containing files for climate-assessment that cannot be published with REMIND +# These files currently all have permissive licenses and can be easily found online +cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" + #### Output folder of the modeltests generated by running config/scenario_config_AMT.csv # start.R searches in this folder for finished runs to be used as path_gdx... cfg$modeltests_folder <- "/p/projects/remind/modeltests/remind/output" diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index d5dc7454f..2b1f223ee 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -28,9 +28,6 @@ print(getwd()) # Read the cfg to get the location of MAGICC-related files cfg <- read_yaml(cfg_path) -#######################################################################DELETEME MOVE TO DEFAULT.CFG!!!!!!!!!!!!!!!!!! -cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" -#######################################################################DELETEME MOVE TO DEFAULT.CFG!!!!!!!!!!!!!!!!!! # Read the GDX and run reportEmi # gdxpath <- "fulldata.gdx" From 6a94be0066d38ad03d53edbad18591cdae140202 Mon Sep 17 00:00:00 2001 From: gabriel-abrahao Date: Thu, 23 Nov 2023 22:16:09 +0100 Subject: [PATCH 03/76] Commenting cfg output to emphasize the new option --- config/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index 73cda5f68..6f840cb8d 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -114,7 +114,7 @@ cfg$logoption <- 2 # Just list the name of the output scripts that should be used by output.R # At the moment there are several R-scripts located in scripts/output/ -cfg$output <- c("reporting","reportCEScalib","rds_report","fixOnRef") #,"validation","emulator","reportCEScalib","validationSummary","dashboard") +cfg$output <- c("reporting","reportCEScalib","rds_report","fixOnRef") #"ar6Climate","validation","emulator","reportCEScalib","validationSummary","dashboard") # Set the format for the results folder, type string :date: in order to use the current time stamp in the folder name (e.g. "results:date:") use :title: to use the current title in the folder name cfg$results_folder <- "output/:title::date:" From cb545aac00275b21c44813af6962736bc151442f Mon Sep 17 00:00:00 2001 From: gabriel-abrahao Date: Thu, 23 Nov 2023 22:16:19 +0100 Subject: [PATCH 04/76] Using full paramater set --- scripts/output/single/ar6Climate.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 2b1f223ee..14ccc353d 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -74,7 +74,8 @@ write.csv(outcsv, ar6csvfpath, row.names=F, quote=F) ############################# PYTHON/MAGICC SETUP ############################# # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure # TODO: Make this even more flexible by explictly setting them in default.cfg -probabilistic_file <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") +# probabilistic_file <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") +probabilistic_file <- file.path(cfg$climate_assessment_files_dir,"/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") infilling_database_file <- file.path(cfg$climate_assessment_files_dir,"/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") magicc_bin_file <- file.path(cfg$climate_assessment_files_dir,"/magicc-v7.5.3/bin/magicc") From 051e54761027490e5c50710cd7d647aa18a05248 Mon Sep 17 00:00:00 2001 From: gabriel-abrahao Date: Thu, 23 Nov 2023 22:43:01 +0100 Subject: [PATCH 05/76] Correcting --num-cfgs --- scripts/output/single/ar6Climate.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 14ccc353d..451ec9050 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -118,7 +118,10 @@ logmsg <- paste0(date(), " Started runs\n") cat(logmsg) capture.output(cat(logmsg), file = logfile, append = T) -cmd <- paste0("python ", sfolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilistic_file) +# Read parameter sets file to ascertain how many parsets there are +allparsets <- read_yaml(probabilistic_file) +nparsets <- length(allparsets$configurations) +cmd <- paste0("python ", sfolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs ",nparsets," --scenario-batch-size ", 1, " --probabilistic-file ", probabilistic_file) # cmd <- paste0("python ", sfolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilistic_file, " --save-csv-combined-output") system(cmd) From 13bcaa8e1b3ad79930f858cf10c6a1b6709e3d1d Mon Sep 17 00:00:00 2001 From: orichters Date: Mon, 4 Dec 2023 10:44:43 +0100 Subject: [PATCH 06/76] allow 12 tasks slurm option for MAGICC7.5.3 in output.R --- output.R | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/output.R b/output.R index 70f18887f..240b4618c 100755 --- a/output.R +++ b/output.R @@ -67,6 +67,8 @@ library(lucode2) library(gms) require(stringr, quietly = TRUE) +invisible(sapply(list.files("scripts/start", pattern = "\\.R$", full.names = TRUE), source)) + flags <- NULL ### Define arguments that can be read from command line if (!exists("source_include")) { @@ -81,13 +83,13 @@ if ("--help" %in% flags) { q() } -choose_slurmConfig_output <- function(slurmExceptions = NULL) { +choose_slurmConfig_output <- function(output) { slurm_options <- c("--qos=priority", "--qos=short", "--qos=standby", "--qos=priority --mem=8000", "--qos=short --mem=8000", - "--qos=standby --mem=8000", "--qos=priority --mem=32000", "direct") - if (!is.null(slurmExceptions)) { - slurm_options <- unique(c(grep(slurmExceptions, slurm_options, value = TRUE), "direct")) - } + "--qos=standby --mem=8000", "--qos=priority --mem=32000", + if ("ar6Climate" %in% output) "--qos=priority --tasks-per-node=12", + "direct") + if ("reporting" %in% output) slurm_options <- unique(c(grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE), "direct")) if (length(slurm_options) == 1) { return(slurm_options[[1]]) } @@ -165,7 +167,7 @@ if (comp %in% c("comparison", "export")) { # choose the slurm options. If you use command line arguments, use slurmConfig=priority or standby modules_using_slurmConfig <- c("compareScenarios2") if (!exists("slurmConfig") && any(modules_using_slurmConfig %in% output)) { - slurmConfig <- choose_slurmConfig_output() + slurmConfig <- choose_slurmConfig_output(output = output) } if (exists("slurmConfig")) { if (slurmConfig %in% c("priority", "short", "standby")) { @@ -200,7 +202,6 @@ if (comp %in% c("comparison", "export")) { outputInteractive <- c("plotIterations", "fixOnRef") if (! exists("source_include")) { # for selected output scripts, only slurm configurations matching these regex are available - slurmExceptions <- if ("reporting" %in% output) "--mem=[0-9]*[0-9]{3}" else NULL if (any(output %in% outputInteractive)) { slurmConfig <- "direct" flags <- c(flags, "--interactive") # to tell scripts they can run in interactive mode @@ -208,8 +209,8 @@ if (comp %in% c("comparison", "export")) { # if this script is not being sourced by another script but called from the command line via Rscript let the user # choose the slurm options if (!exists("slurmConfig")) { - slurmConfig <- choose_slurmConfig_output(slurmExceptions = slurmExceptions) - if (slurmConfig != "direct") slurmConfig <- paste(slurmConfig, "--nodes=1 --tasks-per-node=1") + slurmConfig <- choose_slurmConfig_output(output = output) + if (slurmConfig != "direct") slurmConfig <- combine_slurmConfig("--nodes=1 --tasks-per-node=1", slurmConfig) } if (slurmConfig %in% c("priority", "short", "standby")) { slurmConfig <- paste0("--qos=", slurmConfig, " --nodes=1 --tasks-per-node=1") From 62c21e4e99f4936f6be989f81ce9bb5c8b90caca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Wed, 17 Jan 2024 17:30:28 +0100 Subject: [PATCH 07/76] Call normalizePath on workfolder when setting MAGICC_WORKER_ROOT_DIR --- scripts/output/single/ar6Climate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 451ec9050..8c1e4d26a 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -85,7 +85,7 @@ dir.create(workfolder, showWarnings = F) # Set relevant environment variables and create a MAGICC worker directory Sys.setenv(MAGICC_EXECUTABLE_7=magicc_bin_file) -Sys.setenv(MAGICC_WORKER_ROOT_DIR=normalizePath(paste0(workfolder,"/workers/"))) # Has to be an absolute path +Sys.setenv(MAGICC_WORKER_ROOT_DIR=paste0(normalizePath(workfolder),"/workers/")) # Has to be an absolute path Sys.setenv(MAGICC_WORKER_NUMBER=1) # TODO: Get this from slurm or nproc dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = T, showWarnings = F) From ef916071dd631d1dd72121ceb68450901c9c8f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 17:00:38 +0100 Subject: [PATCH 08/76] Introduce dedicated climate_assessment folder, move variable names to camelCase --- scripts/output/single/ar6Climate.R | 48 +++++++++++++----------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 8c1e4d26a..4c6806a64 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -7,27 +7,27 @@ library(lucode2) library(readxl) # GA: Wont be necessary after https://github.com/iiasa/climate-assessment/pull/43 goes into release ############################# BASIC CONFIGURATION ############################# -gdx_name <- "fulldata.gdx" # name of the gdx -cfg_name <- "cfg.txt" # cfg file for getting file paths +gdxName <- "fulldata.gdx" # name of the gdx +cfgName <- "cfg.txt" # cfg file for getting file paths if(!exists("source_include")) { # Define arguments that can be read from command line outputdir <- "." - readArgs("outputdir", "gdx_name", "gdx_ref_name", "gdx_refpolicycost_name") + readArgs("outputdir", "gdxName", "gdx_ref_name", "gdx_refpolicycost_name") } -gdx <- file.path(outputdir, gdx_name) -cfg_path <- file.path(outputdir, cfg_name) -logfile <- file.path(outputdir, "climate.log") # specific log for python steps -scenario <- getScenNames(outputdir) -remind_reporting_file <- file.path(outputdir,paste0("REMIND_generic_", scenario,".mif")) +gdx <- file.path(outputdir, gdxName) +cfgPath <- file.path(outputdir, cfgName) +logfile <- file.path(outputdir, "climate.log") # specific log for python steps +scenario <- getScenNames(outputdir) +remindReportingFile <- file.path(outputdir,paste0("REMIND_generic_", scenario,".mif")) print(getwd()) ############################# PREPARING EMISSIONS INPUT ############################# # Read the cfg to get the location of MAGICC-related files -cfg <- read_yaml(cfg_path) +cfg <- read_yaml(cfgPath) # Read the GDX and run reportEmi # gdxpath <- "fulldata.gdx" @@ -74,17 +74,18 @@ write.csv(outcsv, ar6csvfpath, row.names=F, quote=F) ############################# PYTHON/MAGICC SETUP ############################# # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure # TODO: Make this even more flexible by explictly setting them in default.cfg -# probabilistic_file <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") -probabilistic_file <- file.path(cfg$climate_assessment_files_dir,"/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") -infilling_database_file <- file.path(cfg$climate_assessment_files_dir,"/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") -magicc_bin_file <- file.path(cfg$climate_assessment_files_dir,"/magicc-v7.5.3/bin/magicc") +# probabilisticFile <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") +probabilisticFile <- file.path(cfg$climate_assessment_files_dir,"/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") +infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir,"/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") +magiccBinFile <- file.path(cfg$climate_assessment_files_dir, "/magicc-v7.5.3/bin/magicc") +scriptsFolder <- "/p/projects/rd3mod/python/climate-assessment/scripts" # Create working folder for climate-assessment files workfolder <- file.path(outputdir, "climate-temp") dir.create(workfolder, showWarnings = F) # Set relevant environment variables and create a MAGICC worker directory -Sys.setenv(MAGICC_EXECUTABLE_7=magicc_bin_file) +Sys.setenv(MAGICC_EXECUTABLE_7=magiccBinFile) Sys.setenv(MAGICC_WORKER_ROOT_DIR=paste0(normalizePath(workfolder),"/workers/")) # Has to be an absolute path Sys.setenv(MAGICC_WORKER_NUMBER=1) # TODO: Get this from slurm or nproc @@ -98,19 +99,12 @@ logmsg <- paste0(date(), " Created log\n================================ EXECUTI cat(logmsg) capture.output(cat(logmsg), file = logfile, append = F) -# TODO: Activate venv and get the script from the right location -# Get the available climate-assessment module location and its scripts folder -root_climate_assessment <- system('python -c "import importlib; print(importlib.util.find_spec(\\"climate_assessment\\").submodule_search_locations[0])"', intern = T) -# sfolder <- file.path(root_climate_assessment, "scripts/") -sfolder="/p/projects/piam/abrahao/scratch/iiasa/climate-assessment/scripts/" #TODO: Get the one used in the renv - - ############################# HARMONIZATION/INFILLING ############################# logmsg <- paste0(date(), " Started harmonization\n") cat(logmsg) capture.output(cat(logmsg), file = logfile, append = T) -cmd <- paste0("python ", sfolder, "run_harm_inf.py ", ar6csvfpath, " ", workfolder, " ", "--no-inputcheck --infilling-database ", infilling_database_file) +cmd <- paste0("python ", scriptsFolder, "run_harm_inf.py ", ar6csvfpath, " ", workfolder, " ", "--no-inputcheck --infilling-database ", infillingDatabaseFile) system(cmd) ############################# RUNNING MODEL ############################# @@ -119,10 +113,10 @@ cat(logmsg) capture.output(cat(logmsg), file = logfile, append = T) # Read parameter sets file to ascertain how many parsets there are -allparsets <- read_yaml(probabilistic_file) +allparsets <- read_yaml(probabilisticFile) nparsets <- length(allparsets$configurations) -cmd <- paste0("python ", sfolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs ",nparsets," --scenario-batch-size ", 1, " --probabilistic-file ", probabilistic_file) -# cmd <- paste0("python ", sfolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilistic_file, " --save-csv-combined-output") +cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs ",nparsets," --scenario-batch-size ", 1, " --probabilistic-file ", probabilisticFile) +# cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilisticFile, " --save-csv-combined-output") system(cmd) ############################# READING CLIMATE OUTPUT ############################# @@ -131,10 +125,10 @@ climdata <- read.quitte(climoutfpath) ############################# APPEND TO REMIND MIF ############################# # Filter only periods used in REMIND, so that it doesn't expand the original mif -useperiods <- unique(read.quitte(remind_reporting_file)$period) +useperiods <- unique(read.quitte(remindReportingFile)$period) climdata <- climdata[climdata$period %in% useperiods,] climdata <- interpolate_missing_periods(climdata, useperiods, expand.values = F) -write.mif(climdata, remind_reporting_file, append = T) +write.mif(climdata, remindReportingFile, append = T) From a2b67758ae0d3743b5dc221efb41a506f1764f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 17:34:21 +0100 Subject: [PATCH 09/76] Linting: Added missing whitespaces --- scripts/output/single/ar6Climate.R | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 4c6806a64..308bfc44d 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -21,7 +21,7 @@ gdx <- file.path(outputdir, gdxName) cfgPath <- file.path(outputdir, cfgName) logfile <- file.path(outputdir, "climate.log") # specific log for python steps scenario <- getScenNames(outputdir) -remindReportingFile <- file.path(outputdir,paste0("REMIND_generic_", scenario,".mif")) +remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) print(getwd()) ############################# PREPARING EMISSIONS INPUT ############################# @@ -41,16 +41,16 @@ emimif["scenario"] <- scenario #TODO: Get scenario name from cfg # Write the raw emissions mif # TODO: This wouldn't be necessary if we added an option to generateIIASASubmission # to work with a quitte object directly, not a file path -cat(date()," ar6Climate.R: Writing raw emissions mif in file: \n") -emimifpath <- paste0(outputdir,"/","emimif_raw_",scenario,".mif") -cat(date()," ar6Climate.R: ", emimifpath, "\n") -write.mif(emimif,emimifpath) +cat(date(), " ar6Climate.R: Writing raw emissions mif in file: \n") +emimifpath <- paste0(outputdir ,"/", "emimif_raw_", scenario, ".mif") +cat(date(), " ar6Climate.R: ", emimifpath, "\n") +write.mif(emimif, emimifpath) # Get the emissions in AR6 format # This seems to work with just the reportEmi mif cat(date()," ar6Climate.R: Running generateIIASASubmission to generate AR6 mif in file:\n") -emimifar6fpath <- paste0(outputdir,"/","emimif_ar6_",scenario,".mif") -cat(date()," ar6Climate.R: ", emimifar6fpath, "\n") +emimifar6fpath <- paste0(outputdir, "/", "emimif_ar6_", scenario, ".mif") +cat(date(), " ar6Climate.R: ", emimifar6fpath, "\n") generateIIASASubmission(emimifpath, mapping = "AR6", outputDirectory = outputdir, outputFilename = basename(emimifar6fpath), logFile = paste0(outputdir, "/missing.log")) # Read in AR6 mif @@ -59,16 +59,16 @@ ar6mif <- read.quitte(emimifar6fpath) # Get it ready for climate-assessment: capitalized titles, just World, comma separator colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep="") -ar6mif <- ar6mif[ar6mif$Region %in% c("GLO","World"),] +ar6mif <- ar6mif[ar6mif$Region %in% c("GLO", "World"),] ar6mif$Region = "World" # Long to wide -outcsv <- reshape(as.data.frame(ar6mif), direction = "wide", timevar = "Period", v.names = "Value", idvar = c("Model","Variable","Scenario","Region","Unit")) -colnames(outcsv) <- gsub("Value.","",colnames(outcsv)) +outcsv <- reshape(as.data.frame(ar6mif), direction = "wide", timevar = "Period", v.names = "Value", idvar = c("Model", "Variable", "Scenario", "Region", "Unit")) +colnames(outcsv) <- gsub("Value.", "", colnames(outcsv)) # Write output in csv for climate-assessment -cat(date()," ar6Climate.R: Writing csv for climate-assessment\n") -ar6csvfpath <- paste0(outputdir,"/","ar6csv_",scenario,".csv") +cat(date(), " ar6Climate.R: Writing csv for climate-assessment\n") +ar6csvfpath <- paste0(outputdir, "/", "ar6csv_", scenario, ".csv") write.csv(outcsv, ar6csvfpath, row.names=F, quote=F) ############################# PYTHON/MAGICC SETUP ############################# @@ -92,7 +92,7 @@ Sys.setenv(MAGICC_WORKER_NUMBER=1) # TODO: Get this from slurm or nproc dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = T, showWarnings = F) # The base name, that climate-assessment uses to derive it's output names -basefname <- sub("\\.csv$","",basename(ar6csvfpath)) +basefname <- sub("\\.csv$", "", basename(ar6csvfpath)) # Set up another log file for the python output logmsg <- paste0(date(), " Created log\n================================ EXECUTING climate-assessment scripts =================================\n") @@ -126,7 +126,7 @@ climdata <- read.quitte(climoutfpath) ############################# APPEND TO REMIND MIF ############################# # Filter only periods used in REMIND, so that it doesn't expand the original mif useperiods <- unique(read.quitte(remindReportingFile)$period) -climdata <- climdata[climdata$period %in% useperiods,] +climdata <- climdata[climdata$period %in% useperiods, ] climdata <- interpolate_missing_periods(climdata, useperiods, expand.values = F) write.mif(climdata, remindReportingFile, append = T) From 149711608b5dabde2937eaa67e8f784c709b4956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 17:34:57 +0100 Subject: [PATCH 10/76] Added license --- scripts/output/single/ar6Climate.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 308bfc44d..8a79609b3 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -1,3 +1,9 @@ +# | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | REMIND License Exception, version 1.0 (see LICENSE file). +# | Contact: remind@pik-potsdam.de library(madrat) library(remind2) library(quitte) From 68a9c5c644fe834faa278a19b6f25d812cb24444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 17:40:22 +0100 Subject: [PATCH 11/76] Linting: T/F to TRUE/FALSE --- scripts/output/single/ar6Climate.R | 31 ++++++++---------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 8a79609b3..2eefd2a3c 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -75,7 +75,7 @@ colnames(outcsv) <- gsub("Value.", "", colnames(outcsv)) # Write output in csv for climate-assessment cat(date(), " ar6Climate.R: Writing csv for climate-assessment\n") ar6csvfpath <- paste0(outputdir, "/", "ar6csv_", scenario, ".csv") -write.csv(outcsv, ar6csvfpath, row.names=F, quote=F) +write.csv(outcsv, ar6csvfpath, row.names = FALSE, quote = FALSE) ############################# PYTHON/MAGICC SETUP ############################# # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure @@ -88,14 +88,14 @@ scriptsFolder <- "/p/projects/rd3mod/python/climate-assessment/scripts" # Create working folder for climate-assessment files workfolder <- file.path(outputdir, "climate-temp") -dir.create(workfolder, showWarnings = F) +dir.create(workfolder, showWarnings = FALSE) # Set relevant environment variables and create a MAGICC worker directory Sys.setenv(MAGICC_EXECUTABLE_7=magiccBinFile) Sys.setenv(MAGICC_WORKER_ROOT_DIR=paste0(normalizePath(workfolder),"/workers/")) # Has to be an absolute path Sys.setenv(MAGICC_WORKER_NUMBER=1) # TODO: Get this from slurm or nproc -dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = T, showWarnings = F) +dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = TRUE, showWarnings = FALSE) # The base name, that climate-assessment uses to derive it's output names basefname <- sub("\\.csv$", "", basename(ar6csvfpath)) @@ -103,12 +103,12 @@ basefname <- sub("\\.csv$", "", basename(ar6csvfpath)) # Set up another log file for the python output logmsg <- paste0(date(), " Created log\n================================ EXECUTING climate-assessment scripts =================================\n") cat(logmsg) -capture.output(cat(logmsg), file = logfile, append = F) +capture.output(cat(logmsg), file = logfile, append = FALSE) ############################# HARMONIZATION/INFILLING ############################# logmsg <- paste0(date(), " Started harmonization\n") cat(logmsg) -capture.output(cat(logmsg), file = logfile, append = T) +capture.output(cat(logmsg), file = logfile, append = TRUE) cmd <- paste0("python ", scriptsFolder, "run_harm_inf.py ", ar6csvfpath, " ", workfolder, " ", "--no-inputcheck --infilling-database ", infillingDatabaseFile) system(cmd) @@ -116,7 +116,7 @@ system(cmd) ############################# RUNNING MODEL ############################# logmsg <- paste0(date(), " Started runs\n") cat(logmsg) -capture.output(cat(logmsg), file = logfile, append = T) +capture.output(cat(logmsg), file = logfile, append = TRUE) # Read parameter sets file to ascertain how many parsets there are allparsets <- read_yaml(probabilisticFile) @@ -133,20 +133,5 @@ climdata <- read.quitte(climoutfpath) # Filter only periods used in REMIND, so that it doesn't expand the original mif useperiods <- unique(read.quitte(remindReportingFile)$period) climdata <- climdata[climdata$period %in% useperiods, ] -climdata <- interpolate_missing_periods(climdata, useperiods, expand.values = F) -write.mif(climdata, remindReportingFile, append = T) - - - - - - - - - - - - - - - +climdata <- interpolate_missing_periods(climdata, useperiods, expand.values = FALSE) +write.mif(climdata, remindReportingFile, append = TRUE) From 24ea21333aeb6debbe9c1220caeab6296f002867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 17:44:48 +0100 Subject: [PATCH 12/76] Linting: More whitespaces --- scripts/output/single/ar6Climate.R | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 2eefd2a3c..10c8afd23 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -17,7 +17,7 @@ gdxName <- "fulldata.gdx" # name of the gdx cfgName <- "cfg.txt" # cfg file for getting file paths -if(!exists("source_include")) { +if (!exists("source_include")) { # Define arguments that can be read from command line outputdir <- "." readArgs("outputdir", "gdxName", "gdx_ref_name", "gdx_refpolicycost_name") @@ -37,7 +37,7 @@ cfg <- read_yaml(cfgPath) # Read the GDX and run reportEmi # gdxpath <- "fulldata.gdx" -cat(date()," ar6Climate.R: Running reportEmi \n") +cat(date(), " ar6Climate.R: Running reportEmi \n") emimag <- reportEmi(gdx) # Convert to quitte and add metadata @@ -48,23 +48,23 @@ emimif["scenario"] <- scenario #TODO: Get scenario name from cfg # TODO: This wouldn't be necessary if we added an option to generateIIASASubmission # to work with a quitte object directly, not a file path cat(date(), " ar6Climate.R: Writing raw emissions mif in file: \n") -emimifpath <- paste0(outputdir ,"/", "emimif_raw_", scenario, ".mif") +emimifpath <- paste0(outputdir, "/", "emimif_raw_", scenario, ".mif") cat(date(), " ar6Climate.R: ", emimifpath, "\n") write.mif(emimif, emimifpath) # Get the emissions in AR6 format # This seems to work with just the reportEmi mif -cat(date()," ar6Climate.R: Running generateIIASASubmission to generate AR6 mif in file:\n") +cat(date(), " ar6Climate.R: Running generateIIASASubmission to generate AR6 mif in file:\n") emimifar6fpath <- paste0(outputdir, "/", "emimif_ar6_", scenario, ".mif") cat(date(), " ar6Climate.R: ", emimifar6fpath, "\n") generateIIASASubmission(emimifpath, mapping = "AR6", outputDirectory = outputdir, outputFilename = basename(emimifar6fpath), logFile = paste0(outputdir, "/missing.log")) # Read in AR6 mif -cat(date()," ar6Climate.R: Reading AR6 mif and preparing csv for climate-assessment\n") +cat(date(), " ar6Climate.R: Reading AR6 mif and preparing csv for climate-assessment\n") ar6mif <- read.quitte(emimifar6fpath) # Get it ready for climate-assessment: capitalized titles, just World, comma separator -colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep="") +colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep = "") ar6mif <- ar6mif[ar6mif$Region %in% c("GLO", "World"),] ar6mif$Region = "World" @@ -81,8 +81,8 @@ write.csv(outcsv, ar6csvfpath, row.names = FALSE, quote = FALSE) # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure # TODO: Make this even more flexible by explictly setting them in default.cfg # probabilisticFile <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") -probabilisticFile <- file.path(cfg$climate_assessment_files_dir,"/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") -infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir,"/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") +probabilisticFile <- file.path(cfg$climate_assessment_files_dir, "/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") +infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, "/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") magiccBinFile <- file.path(cfg$climate_assessment_files_dir, "/magicc-v7.5.3/bin/magicc") scriptsFolder <- "/p/projects/rd3mod/python/climate-assessment/scripts" @@ -91,9 +91,9 @@ workfolder <- file.path(outputdir, "climate-temp") dir.create(workfolder, showWarnings = FALSE) # Set relevant environment variables and create a MAGICC worker directory -Sys.setenv(MAGICC_EXECUTABLE_7=magiccBinFile) -Sys.setenv(MAGICC_WORKER_ROOT_DIR=paste0(normalizePath(workfolder),"/workers/")) # Has to be an absolute path -Sys.setenv(MAGICC_WORKER_NUMBER=1) # TODO: Get this from slurm or nproc +Sys.setenv(MAGICC_EXECUTABLE_7 = magiccBinFile) +Sys.setenv(MAGICC_WORKER_ROOT_DIR = paste0(normalizePath(workfolder), "/workers/")) # Has to be an absolute path +Sys.setenv(MAGICC_WORKER_NUMBER = 1) # TODO: Get this from slurm or nproc dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = TRUE, showWarnings = FALSE) From 92b8cb9b75a4cb3e3369c76f566a1473a60a6a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 17:48:09 +0100 Subject: [PATCH 13/76] Linting: Assignment via <- operator --- scripts/output/single/ar6Climate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 10c8afd23..c43fd3634 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -66,7 +66,7 @@ ar6mif <- read.quitte(emimifar6fpath) # Get it ready for climate-assessment: capitalized titles, just World, comma separator colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep = "") ar6mif <- ar6mif[ar6mif$Region %in% c("GLO", "World"),] -ar6mif$Region = "World" +ar6mif$Region <- "World" # Long to wide outcsv <- reshape(as.data.frame(ar6mif), direction = "wide", timevar = "Period", v.names = "Value", idvar = c("Model", "Variable", "Scenario", "Region", "Unit")) From 7440247d2286eaa1e83addb9e59ee06bd27e21e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 18:02:54 +0100 Subject: [PATCH 14/76] Linting: Wrapped overly long lines --- scripts/output/single/ar6Climate.R | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index c43fd3634..f532ccc43 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -57,19 +57,23 @@ write.mif(emimif, emimifpath) cat(date(), " ar6Climate.R: Running generateIIASASubmission to generate AR6 mif in file:\n") emimifar6fpath <- paste0(outputdir, "/", "emimif_ar6_", scenario, ".mif") cat(date(), " ar6Climate.R: ", emimifar6fpath, "\n") -generateIIASASubmission(emimifpath, mapping = "AR6", outputDirectory = outputdir, outputFilename = basename(emimifar6fpath), logFile = paste0(outputdir, "/missing.log")) +generateIIASASubmission(emimifpath, mapping = "AR6", outputDirectory = outputdir, + outputFilename = basename(emimifar6fpath), logFile = paste0(outputdir, "/missing.log")) # Read in AR6 mif cat(date(), " ar6Climate.R: Reading AR6 mif and preparing csv for climate-assessment\n") ar6mif <- read.quitte(emimifar6fpath) # Get it ready for climate-assessment: capitalized titles, just World, comma separator -colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep = "") -ar6mif <- ar6mif[ar6mif$Region %in% c("GLO", "World"),] +colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), + substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep = "") +ar6mif <- ar6mif[ar6mif$Region %in% c("GLO", "World"), ] ar6mif$Region <- "World" # Long to wide -outcsv <- reshape(as.data.frame(ar6mif), direction = "wide", timevar = "Period", v.names = "Value", idvar = c("Model", "Variable", "Scenario", "Region", "Unit")) +outcsv <- reshape(as.data.frame(ar6mif), + direction = "wide", timevar = "Period", v.names = "Value", + idvar = c("Model", "Variable", "Scenario", "Region", "Unit")) colnames(outcsv) <- gsub("Value.", "", colnames(outcsv)) # Write output in csv for climate-assessment @@ -81,8 +85,10 @@ write.csv(outcsv, ar6csvfpath, row.names = FALSE, quote = FALSE) # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure # TODO: Make this even more flexible by explictly setting them in default.cfg # probabilisticFile <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") -probabilisticFile <- file.path(cfg$climate_assessment_files_dir, "/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") -infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, "/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") +probabilisticFile <- file.path(cfg$climate_assessment_files_dir, + "/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") +infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, + "/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") magiccBinFile <- file.path(cfg$climate_assessment_files_dir, "/magicc-v7.5.3/bin/magicc") scriptsFolder <- "/p/projects/rd3mod/python/climate-assessment/scripts" @@ -101,7 +107,7 @@ dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = TRUE, showWarnings basefname <- sub("\\.csv$", "", basename(ar6csvfpath)) # Set up another log file for the python output -logmsg <- paste0(date(), " Created log\n================================ EXECUTING climate-assessment scripts =================================\n") +logmsg <- paste0(date(), " Created log\n=================== EXECUTING climate-assessment scripts ===================n") cat(logmsg) capture.output(cat(logmsg), file = logfile, append = FALSE) @@ -110,7 +116,8 @@ logmsg <- paste0(date(), " Started harmonization\n") cat(logmsg) capture.output(cat(logmsg), file = logfile, append = TRUE) -cmd <- paste0("python ", scriptsFolder, "run_harm_inf.py ", ar6csvfpath, " ", workfolder, " ", "--no-inputcheck --infilling-database ", infillingDatabaseFile) +cmd <- paste0("python ", scriptsFolder, "run_harm_inf.py ", ar6csvfpath, " ", workfolder, " ", + "--no-inputcheck --infilling-database ", infillingDatabaseFile) system(cmd) ############################# RUNNING MODEL ############################# @@ -121,7 +128,9 @@ capture.output(cat(logmsg), file = logfile, append = TRUE) # Read parameter sets file to ascertain how many parsets there are allparsets <- read_yaml(probabilisticFile) nparsets <- length(allparsets$configurations) -cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs ",nparsets," --scenario-batch-size ", 1, " --probabilistic-file ", probabilisticFile) +cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, + "_harmonized_infilled.csv ", workfolder, " --num-cfgs ",nparsets," --scenario-batch-size ", 1, + " --probabilistic-file ", probabilisticFile) # cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilisticFile, " --save-csv-combined-output") system(cmd) From bad6bc9f168ecea694962a1254fea00f9cf6f2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 22 Jan 2024 18:05:50 +0100 Subject: [PATCH 15/76] Linting: Removed commented code, kept Todos --- scripts/output/single/ar6Climate.R | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index f532ccc43..b2c2ed72a 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -18,9 +18,9 @@ cfgName <- "cfg.txt" # cfg file for getting file paths if (!exists("source_include")) { - # Define arguments that can be read from command line - outputdir <- "." - readArgs("outputdir", "gdxName", "gdx_ref_name", "gdx_refpolicycost_name") + # Define arguments that can be read from command line + outputdir <- "." + readArgs("outputdir", "gdxName", "gdx_ref_name", "gdx_refpolicycost_name") } gdx <- file.path(outputdir, gdxName) @@ -36,7 +36,6 @@ print(getwd()) cfg <- read_yaml(cfgPath) # Read the GDX and run reportEmi -# gdxpath <- "fulldata.gdx" cat(date(), " ar6Climate.R: Running reportEmi \n") emimag <- reportEmi(gdx) @@ -84,7 +83,6 @@ write.csv(outcsv, ar6csvfpath, row.names = FALSE, quote = FALSE) ############################# PYTHON/MAGICC SETUP ############################# # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure # TODO: Make this even more flexible by explictly setting them in default.cfg -# probabilisticFile <- file.path(cfg$climate_assessment_files_dir,"/parsets/RCP20_50.json") probabilisticFile <- file.path(cfg$climate_assessment_files_dir, "/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, @@ -129,9 +127,8 @@ capture.output(cat(logmsg), file = logfile, append = TRUE) allparsets <- read_yaml(probabilisticFile) nparsets <- length(allparsets$configurations) cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, - "_harmonized_infilled.csv ", workfolder, " --num-cfgs ",nparsets," --scenario-batch-size ", 1, + "_harmonized_infilled.csv ", workfolder, " --num-cfgs ", nparsets, " --scenario-batch-size ", 1, " --probabilistic-file ", probabilisticFile) -# cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, "_harmonized_infilled.csv ", workfolder, " --num-cfgs 1 --scenario-batch-size ", 1, " --probabilistic-file ", probabilisticFile, " --save-csv-combined-output") system(cmd) ############################# READING CLIMATE OUTPUT ############################# From ee64dbc502fa138c3902daa502c340f750d1f1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Tue, 23 Jan 2024 10:02:26 +0100 Subject: [PATCH 16/76] Renamed logfile to log_climate.txt --- scripts/output/single/ar6Climate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index b2c2ed72a..3bdd454d1 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -25,7 +25,7 @@ if (!exists("source_include")) { gdx <- file.path(outputdir, gdxName) cfgPath <- file.path(outputdir, cfgName) -logfile <- file.path(outputdir, "climate.log") # specific log for python steps +logfile <- file.path(outputdir, "log_climate.txt") # specific log for python steps scenario <- getScenNames(outputdir) remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) From b5886d5fe51fdb5a4f3e07ea9601674a37bf6023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Tue, 23 Jan 2024 11:00:18 +0100 Subject: [PATCH 17/76] Added --mem=32000 to slurm options --- output.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output.R b/output.R index 240b4618c..e1c344e0b 100755 --- a/output.R +++ b/output.R @@ -87,7 +87,7 @@ choose_slurmConfig_output <- function(output) { slurm_options <- c("--qos=priority", "--qos=short", "--qos=standby", "--qos=priority --mem=8000", "--qos=short --mem=8000", "--qos=standby --mem=8000", "--qos=priority --mem=32000", - if ("ar6Climate" %in% output) "--qos=priority --tasks-per-node=12", + if ("ar6Climate" %in% output) "--qos=priority --tasks-per-node=12 --mem=32000", "direct") if ("reporting" %in% output) slurm_options <- unique(c(grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE), "direct")) if (length(slurm_options) == 1) { From 0804c7c702adc90d9b0f5d272ab5844e713caaa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Tue, 23 Jan 2024 16:55:38 +0100 Subject: [PATCH 18/76] Provide climate-assessment path via default.cfg --- config/default.cfg | 1 + scripts/output/single/ar6Climate.R | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index 6f840cb8d..8d8f5b1a9 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -51,6 +51,7 @@ cfg$magicc_template <- "/p/projects/rd3mod/magicc/" #### Folder containing files for climate-assessment that cannot be published with REMIND # These files currently all have permissive licenses and can be easily found online +cfg$climate_assessment_root <- "/p/projects/rd3mod/python/climate-assessment/" cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" #### Output folder of the modeltests generated by running config/scenario_config_AMT.csv diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 3bdd454d1..1c89e0b7e 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -88,7 +88,7 @@ probabilisticFile <- file.path(cfg$climate_assessment_files_dir, infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, "/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") magiccBinFile <- file.path(cfg$climate_assessment_files_dir, "/magicc-v7.5.3/bin/magicc") -scriptsFolder <- "/p/projects/rd3mod/python/climate-assessment/scripts" +scriptsFolder <- file.path(cfg$climate_assessment_root, "scripts/") # Create working folder for climate-assessment files workfolder <- file.path(outputdir, "climate-temp") From 3c8a40289b83a5a86789b69ecc17abd41f820075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Thu, 25 Jan 2024 18:02:06 +0100 Subject: [PATCH 19/76] Streamlined emission data extraction required by climate-assessment --- scripts/output/single/ar6Climate.R | 85 ++++++++++-------------------- 1 file changed, 29 insertions(+), 56 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 1c89e0b7e..418c68913 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -9,83 +9,56 @@ library(remind2) library(quitte) library(piamInterfaces) library(yaml) -library(lucode2) -library(readxl) # GA: Wont be necessary after https://github.com/iiasa/climate-assessment/pull/43 goes into release + +# TODO: REMOVE THIS LINE. piamInterfaces should be installed as a package on the cluster +devtools::load_all("/p/tmp/tonnru/piamInterfaces/") ############################# BASIC CONFIGURATION ############################# gdxName <- "fulldata.gdx" # name of the gdx cfgName <- "cfg.txt" # cfg file for getting file paths - if (!exists("source_include")) { # Define arguments that can be read from command line outputdir <- "." readArgs("outputdir", "gdxName", "gdx_ref_name", "gdx_refpolicycost_name") } -gdx <- file.path(outputdir, gdxName) -cfgPath <- file.path(outputdir, cfgName) -logfile <- file.path(outputdir, "log_climate.txt") # specific log for python steps -scenario <- getScenNames(outputdir) -remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) - -print(getwd()) -############################# PREPARING EMISSIONS INPUT ############################# +cfgPath <- file.path(outputdir, cfgName) +logfile <- file.path(outputdir, "log_climate.txt") # specific log for python steps +scenario <- getScenNames(outputdir) +remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) +climateAssessmentYaml <- file.path(system.file("iiasaTemplates", package = "piamInterfaces"), + "climate_assessment_variables.yaml") +climateAssessmentCSV <- file.path(outputdir, paste0("ar6csv_", scenario, ".csv")) # Read the cfg to get the location of MAGICC-related files cfg <- read_yaml(cfgPath) -# Read the GDX and run reportEmi -cat(date(), " ar6Climate.R: Running reportEmi \n") -emimag <- reportEmi(gdx) - -# Convert to quitte and add metadata -emimif <- as.quitte(emimag) -emimif["scenario"] <- scenario #TODO: Get scenario name from cfg - -# Write the raw emissions mif -# TODO: This wouldn't be necessary if we added an option to generateIIASASubmission -# to work with a quitte object directly, not a file path -cat(date(), " ar6Climate.R: Writing raw emissions mif in file: \n") -emimifpath <- paste0(outputdir, "/", "emimif_raw_", scenario, ".mif") -cat(date(), " ar6Climate.R: ", emimifpath, "\n") -write.mif(emimif, emimifpath) - -# Get the emissions in AR6 format -# This seems to work with just the reportEmi mif -cat(date(), " ar6Climate.R: Running generateIIASASubmission to generate AR6 mif in file:\n") -emimifar6fpath <- paste0(outputdir, "/", "emimif_ar6_", scenario, ".mif") -cat(date(), " ar6Climate.R: ", emimifar6fpath, "\n") -generateIIASASubmission(emimifpath, mapping = "AR6", outputDirectory = outputdir, - outputFilename = basename(emimifar6fpath), logFile = paste0(outputdir, "/missing.log")) - -# Read in AR6 mif -cat(date(), " ar6Climate.R: Reading AR6 mif and preparing csv for climate-assessment\n") -ar6mif <- read.quitte(emimifar6fpath) - -# Get it ready for climate-assessment: capitalized titles, just World, comma separator -colnames(ar6mif) <- paste(toupper(substr(colnames(ar6mif), 1, 1)), - substr(colnames(ar6mif), 2, nchar(colnames(ar6mif))), sep = "") -ar6mif <- ar6mif[ar6mif$Region %in% c("GLO", "World"), ] -ar6mif$Region <- "World" - -# Long to wide -outcsv <- reshape(as.data.frame(ar6mif), - direction = "wide", timevar = "Period", v.names = "Value", - idvar = c("Model", "Variable", "Scenario", "Region", "Unit")) -colnames(outcsv) <- gsub("Value.", "", colnames(outcsv)) - -# Write output in csv for climate-assessment -cat(date(), " ar6Climate.R: Writing csv for climate-assessment\n") -ar6csvfpath <- paste0(outputdir, "/", "ar6csv_", scenario, ".csv") -write.csv(outcsv, ar6csvfpath, row.names = FALSE, quote = FALSE) +############################# PREPARING EMISSIONS INPUT ############################# + +cat(date(), " ar6Climate.R: Extracting REMIND emission data\n") + +climateAssessmentInputData <- as.quitte(remindReportingFile) %>% + filter(region %in% c("GLO", "World")) %>% + generateIIASASubmission( + mapping = "AR6", + outputFilename = NULL, + iiasatemplate = climateAssessmentYaml, + logFile = logfile + ) %>% + mutate(region = factor("World")) %>% + rename_with(str_to_title) %>% + pivot_wider(names_from = "Period", values_from = "Value") %>% + write_csv(climateAssessmentCSV, quote = "none") + +cat(date(), paste0(" ar6Climate.R: Wrote to'", climateAssessmentCSV, "' for climate-assessment\n")) ############################# PYTHON/MAGICC SETUP ############################# # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure # TODO: Make this even more flexible by explictly setting them in default.cfg probabilisticFile <- file.path(cfg$climate_assessment_files_dir, "/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") -infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, +infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, "/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") magiccBinFile <- file.path(cfg$climate_assessment_files_dir, "/magicc-v7.5.3/bin/magicc") scriptsFolder <- file.path(cfg$climate_assessment_root, "scripts/") From 5bcc1e34f86f5a1684d4d3bf81995c4ccca1fdc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Fri, 26 Jan 2024 10:39:38 +0100 Subject: [PATCH 20/76] Put back in some dependencies --- scripts/output/single/ar6Climate.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 418c68913..88109a974 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -9,6 +9,9 @@ library(remind2) library(quitte) library(piamInterfaces) library(yaml) +library(readr) +library(lucode2) +library(stringr) # TODO: REMOVE THIS LINE. piamInterfaces should be installed as a package on the cluster devtools::load_all("/p/tmp/tonnru/piamInterfaces/") From b7a76f4205d7aa9060b1c987d1adf4cf23b1b83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Fri, 26 Jan 2024 16:30:05 +0100 Subject: [PATCH 21/76] Explicitly state path to magicc executable to avoid version and platform issues --- config/default.cfg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 8d8f5b1a9..edaa77c6a 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -51,8 +51,9 @@ cfg$magicc_template <- "/p/projects/rd3mod/magicc/" #### Folder containing files for climate-assessment that cannot be published with REMIND # These files currently all have permissive licenses and can be easily found online -cfg$climate_assessment_root <- "/p/projects/rd3mod/python/climate-assessment/" -cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" +cfg$climate_assessment_root <- "/p/projects/rd3mod/python/climate-assessment/" +cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" +cfg$climate_assessment_magicc_bin <- "/p/projects/rd3mod/climate-assessment-files/magicc-v7.5.3/bin/magicc" #### Output folder of the modeltests generated by running config/scenario_config_AMT.csv # start.R searches in this folder for finished runs to be used as path_gdx... From 11aeb6e3e2acfe7b5d192cec9b42bb4f56376ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Fri, 26 Jan 2024 18:25:05 +0100 Subject: [PATCH 22/76] Cleaned up: restructured logging, descriptive variables, use tidyverse where applicable --- scripts/output/single/ar6Climate.R | 175 +++++++++++++++++++++-------- 1 file changed, 126 insertions(+), 49 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 88109a974..980ca8158 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -17,6 +17,11 @@ library(stringr) devtools::load_all("/p/tmp/tonnru/piamInterfaces/") ############################# BASIC CONFIGURATION ############################# + +logmsg <- paste0(date(), " =================== CONFIGURATION STARTED ==================================\n") +cat(logmsg) +capture.output(cat(logmsg), file = logFile, append = FALSE) + gdxName <- "fulldata.gdx" # name of the gdx cfgName <- "cfg.txt" # cfg file for getting file paths @@ -27,19 +32,27 @@ if (!exists("source_include")) { } cfgPath <- file.path(outputdir, cfgName) -logfile <- file.path(outputdir, "log_climate.txt") # specific log for python steps +logFile <- file.path(outputdir, "log_climate.txt") # specific log for python steps scenario <- getScenNames(outputdir) remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) climateAssessmentYaml <- file.path(system.file("iiasaTemplates", package = "piamInterfaces"), "climate_assessment_variables.yaml") -climateAssessmentCSV <- file.path(outputdir, paste0("ar6csv_", scenario, ".csv")) - -# Read the cfg to get the location of MAGICC-related files -cfg <- read_yaml(cfgPath) +climateAssessmentEmi <- file.path(outputdir, paste0("ar6_climate_assessment_", scenario, ".csv")) ############################# PREPARING EMISSIONS INPUT ############################# -cat(date(), " ar6Climate.R: Extracting REMIND emission data\n") +logmsg <- paste0( + " cfgPath = '", cfgPath, "' exists? ", file.exists(cfgPath), "\n", + " logFile = '", logFile, "' exists? ", file.exists(logFile), "\n", + " scenario = '", scenario, "\n", + " remindReportingFile = '", remindReportingFile, "' exists? ", file.exists(remindReportingFile), "\n", + " climateAssessmentYaml = '", climateAssessmentYaml, "' exists? ", file.exists(climateAssessmentYaml), "\n", + " climateAssessmentEmi = '", climateAssessmentEmi, "' exists? ", file.exists(climateAssessmentEmi), "\n", + date(), " =================== EXTRACT REMIND emission data ===========================\n", + " ar6Climate.R: Extracting REMIND emission data\n" +) +cat(logmsg) +capture.output(cat(logmsg), file = logFile, append = FALSE) climateAssessmentInputData <- as.quitte(remindReportingFile) %>% filter(region %in% c("GLO", "World")) %>% @@ -47,73 +60,137 @@ climateAssessmentInputData <- as.quitte(remindReportingFile) %>% mapping = "AR6", outputFilename = NULL, iiasatemplate = climateAssessmentYaml, - logFile = logfile + logFile = logFile ) %>% mutate(region = factor("World")) %>% rename_with(str_to_title) %>% pivot_wider(names_from = "Period", values_from = "Value") %>% - write_csv(climateAssessmentCSV, quote = "none") + write_csv(climateAssessmentEmi, quote = "none") -cat(date(), paste0(" ar6Climate.R: Wrote to'", climateAssessmentCSV, "' for climate-assessment\n")) +logmsg <- paste0( + date(), " ar6Climate.R: Wrote REMIND emission data to '", climateAssessmentEmi, "' for climate-assessment\n" +) +cat(logmsg) +capture.output(cat(logmsg), file = logFile, append = FALSE) ############################# PYTHON/MAGICC SETUP ############################# + +# Read the cfg to get the location of MAGICC-related files +cfg <- read_yaml(cfgPath) + +# All climate-assessment files will be written to this folder +climateAssessmentFolder <- normalizePath(file.path(outputdir, "climate-assessment-data")) +dir.create(climateAssessmentFolder, showWarnings = FALSE) + +# The base name, that climate-assessment uses to derive it's output names +baseFileName <- sub("\\.csv$", "", basename(climateAssessmentEmi)) + # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure -# TODO: Make this even more flexible by explictly setting them in default.cfg -probabilisticFile <- file.path(cfg$climate_assessment_files_dir, - "/parsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json") -infillingDatabaseFile <- file.path(cfg$climate_assessment_files_dir, - "/1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv") -magiccBinFile <- file.path(cfg$climate_assessment_files_dir, "/magicc-v7.5.3/bin/magicc") -scriptsFolder <- file.path(cfg$climate_assessment_root, "scripts/") +probabilisticFile <- normalizePath(file.path(cfg$climate_assessment_files_dir, + "parsets", "0fd0f62-derived-metrics-id-f023edb-drawnset.json")) +infillingDatabaseFile <- normalizePath(file.path(cfg$climate_assessment_files_dir, + "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv")) +scriptsFolder <- normalizePath(file.path(cfg$climate_assessment_root, "scripts")) +magiccBinFile <- normalizePath(file.path(cfg$climate_assessment_magicc_bin)) +magiccWorkersFolder <- file.path(normalizePath(climateAssessmentFolder), "workers") + +logmsg <- paste0(date(), " =================== SET UP climate-assessment scripts environment ===================\n") +cat(logmsg) +capture.output(cat(logmsg), file = logFile, append = FALSE) # Create working folder for climate-assessment files -workfolder <- file.path(outputdir, "climate-temp") -dir.create(workfolder, showWarnings = FALSE) +dir.create(magiccWorkersFolder, recursive = TRUE, showWarnings = FALSE) # Set relevant environment variables and create a MAGICC worker directory Sys.setenv(MAGICC_EXECUTABLE_7 = magiccBinFile) -Sys.setenv(MAGICC_WORKER_ROOT_DIR = paste0(normalizePath(workfolder), "/workers/")) # Has to be an absolute path +Sys.setenv(MAGICC_WORKER_ROOT_DIR = magiccWorkersFolder) # Has to be an absolute path Sys.setenv(MAGICC_WORKER_NUMBER = 1) # TODO: Get this from slurm or nproc -dir.create(Sys.getenv("MAGICC_WORKER_ROOT_DIR"), recursive = TRUE, showWarnings = FALSE) - -# The base name, that climate-assessment uses to derive it's output names -basefname <- sub("\\.csv$", "", basename(ar6csvfpath)) - -# Set up another log file for the python output -logmsg <- paste0(date(), " Created log\n=================== EXECUTING climate-assessment scripts ===================n") +logmsg <- paste0( + " climateAssessmentFolder = '", climateAssessmentFolder, "' exists? ", dir.exists(climateAssessmentFolder), "\n", + " baseFileName = '", baseFileName, "\n", + " probabilisticFile = '", probabilisticFile, "' exists? ", file.exists(probabilisticFile), "\n", + " infillingDatabaseFile = '", infillingDatabaseFile, "' exists? ", file.exists(infillingDatabaseFile), "\n", + " scriptsFolder = '", scriptsFolder, "' exists? ", dir.exists(scriptsFolder), "\n", + " magiccBinFile = '", magiccBinFile, "' exists? ", file.exists(magiccBinFile), "\n", + " magiccWorkersFolder = '", magiccWorkersFolder, "' exists? ", dir.exists(magiccWorkersFolder), "\n\n", + " ENVIRONMENT VARIABLES:\n", + " MAGICC_EXECUTABLE_7 = ", Sys.getenv("MAGICC_EXECUTABLE_7") ,"\n", + " MAGICC_WORKER_ROOT_DIR = ", Sys.getenv("MAGICC_WORKER_ROOT_DIR") ,"\n", + " MAGICC_WORKER_NUMBER = ", Sys.getenv("MAGICC_WORKER_NUMBER") ,"\n", + date(), " =================== EXECUTING climate-assessment scripts ===================\n" +) cat(logmsg) -capture.output(cat(logmsg), file = logfile, append = FALSE) +capture.output(cat(logmsg), file = logFile, append = FALSE) ############################# HARMONIZATION/INFILLING ############################# -logmsg <- paste0(date(), " Started harmonization\n") +logmsg <- paste0(date(), " Startclimate-assessment harmonization\n") cat(logmsg) -capture.output(cat(logmsg), file = logfile, append = TRUE) - -cmd <- paste0("python ", scriptsFolder, "run_harm_inf.py ", ar6csvfpath, " ", workfolder, " ", - "--no-inputcheck --infilling-database ", infillingDatabaseFile) -system(cmd) +capture.output(cat(logmsg), file = logFile, append = TRUE) + +run_harm_inf_cmd <- paste( + "python", file.path(scriptsFolder, "run_harm_inf.py"), + climateAssessmentEmi, + climateAssessmentFolder, + "--no-inputcheck", + "--infilling-database", infillingDatabaseFile +) +cat(run_harm_inf_cmd, "\n") +# system(run_harm_inf_cmd) ############################# RUNNING MODEL ############################# -logmsg <- paste0(date(), " Started runs\n") -cat(logmsg) -capture.output(cat(logmsg), file = logfile, append = TRUE) - # Read parameter sets file to ascertain how many parsets there are allparsets <- read_yaml(probabilisticFile) -nparsets <- length(allparsets$configurations) -cmd <- paste0("python ", scriptsFolder, "run_clim.py ", workfolder, "/", basefname, - "_harmonized_infilled.csv ", workfolder, " --num-cfgs ", nparsets, " --scenario-batch-size ", 1, - " --probabilistic-file ", probabilisticFile) -system(cmd) +nparsets <- length(allparsets$configurations) + +logmsg <- paste0( + date(), " Found ", nparsets, " nparsets, start climate-assessment model runs\n", run_harm_inf_cmd, "\n") +cat(logmsg) +capture.output(cat(logmsg), file = logFile, append = TRUE) + +run_clim_cmd <- paste( + "python", file.path(scriptsFolder, "run_clim.py"), + normalizePath(file.path(climateAssessmentFolder, paste0(baseFileName, "_harmonized_infilled.csv"))), + climateAssessmentFolder, + "--num-cfgs", nparsets, + "--scenario-batch-size", 1, + "--probabilistic-file", probabilisticFile +) +cat(run_clim_cmd, "\n") +# system(run_clim_cmd) + +############################# POSTPROCESS CLIMATE OUTPUT ############################# +climateAssessmentOutput <- file.path( + climateAssessmentFolder, + paste0(baseFileName, "_harmonized_infilled_IAMC_climateassessment.xlsx") +) + +logmsg <- paste0( + date(), " climate-assessment finished\n", + date(), " =================== POSTPROCESS climate-assessment output ==================\n", + " climateAssessmentOutput = '", climateAssessmentOutput, "' exists? ", dir.exists(climateAssessmentOutput), "\n" +) +cat(logmsg) +capture.output(cat(logmsg), file = logFile, append = TRUE) -############################# READING CLIMATE OUTPUT ############################# -climoutfpath <- file.path(workfolder, paste0(basefname, "_harmonized_infilled_IAMC_climateassessment.xlsx")) -climdata <- read.quitte(climoutfpath) ############################# APPEND TO REMIND MIF ############################# # Filter only periods used in REMIND, so that it doesn't expand the original mif -useperiods <- unique(read.quitte(remindReportingFile)$period) -climdata <- climdata[climdata$period %in% useperiods, ] -climdata <- interpolate_missing_periods(climdata, useperiods, expand.values = FALSE) -write.mif(climdata, remindReportingFile, append = TRUE) +usePeriods <- unique(read.quitte(remindReportingFile)$period) + +# climateAssessmentData <- read.quitte(climateAssessmentOutput) +# climateAssessmentData <- climateAssessmentData[climateAssessmentData$period %in% usePeriods, ] +# climateAssessmentData <- interpolate_missing_periods(climateAssessmentData, usePeriods, expand.values = FALSE) +# write.mif(climateAssessmentData, remindReportingFile, append = TRUE) + +climateAssessmentData <- read.quitte(climateAssessmentOutput) %>% + filter(period %in% usePeriods) %>% + interpolate_missing_periods(usePeriods, expand.values = FALSE) %>% + write.mif(remindReportingFile, append = TRUE) + +logmsg <- paste0( + date(), " postprocessing done! Results appended to REMIND mif '", remindReportingFile, "'\n", + "ar6Climate.R finished\n" +) +cat(logmsg) +capture.output(cat(logmsg), file = logFile, append = TRUE) From d1fb06b4d794f09f4c50bc736f4a1277590655e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Fri, 26 Jan 2024 18:45:11 +0100 Subject: [PATCH 23/76] Alternate approach to checking for applicable years --- scripts/output/single/ar6Climate.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 980ca8158..50ed1e588 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -173,10 +173,11 @@ logmsg <- paste0( cat(logmsg) capture.output(cat(logmsg), file = logFile, append = TRUE) - ############################# APPEND TO REMIND MIF ############################# # Filter only periods used in REMIND, so that it doesn't expand the original mif usePeriods <- unique(read.quitte(remindReportingFile)$period) +# TODO: Get years from someplace else? Above approach take a long time, instead maybe: +# sort(as.integer(colnames(climateAssessmentInputData %>% select(matches("^[0-9]"))))) # climateAssessmentData <- read.quitte(climateAssessmentOutput) # climateAssessmentData <- climateAssessmentData[climateAssessmentData$period %in% usePeriods, ] From 3c5d23a86b19ddb8aabcfbb34eb2cc2a419044e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 29 Jan 2024 18:30:59 +0100 Subject: [PATCH 24/76] climate_assessment_root changed --- config/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index edaa77c6a..dbe402f73 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -51,7 +51,7 @@ cfg$magicc_template <- "/p/projects/rd3mod/magicc/" #### Folder containing files for climate-assessment that cannot be published with REMIND # These files currently all have permissive licenses and can be easily found online -cfg$climate_assessment_root <- "/p/projects/rd3mod/python/climate-assessment/" +cfg$climate_assessment_root <- "/p/projects/rd3mod/python/climate-assessment/src/" cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" cfg$climate_assessment_magicc_bin <- "/p/projects/rd3mod/climate-assessment-files/magicc-v7.5.3/bin/magicc" From f5f4993050be0ebfcfeef4255e090d19363a1fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 29 Jan 2024 18:47:05 +0100 Subject: [PATCH 25/76] Restructured script execution, introduced venv handling --- scripts/output/single/ar6Climate.R | 83 +++++++++++++++++++----------- 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 50ed1e588..e6cae8e7d 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -37,7 +37,8 @@ scenario <- getScenNames(outputdir) remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) climateAssessmentYaml <- file.path(system.file("iiasaTemplates", package = "piamInterfaces"), "climate_assessment_variables.yaml") -climateAssessmentEmi <- file.path(outputdir, paste0("ar6_climate_assessment_", scenario, ".csv")) +climateAssessmentEmi <- normalizePath(file.path(outputdir, paste0("ar6_climate_assessment_", scenario, ".csv")), + mustWork = FALSE) ############################# PREPARING EMISSIONS INPUT ############################# @@ -92,7 +93,11 @@ infillingDatabaseFile <- normalizePath(file.path(cfg$climate_assessment_files_di "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv")) scriptsFolder <- normalizePath(file.path(cfg$climate_assessment_root, "scripts")) magiccBinFile <- normalizePath(file.path(cfg$climate_assessment_magicc_bin)) -magiccWorkersFolder <- file.path(normalizePath(climateAssessmentFolder), "workers") +magiccWorkersFolder <- file.path(normalizePath(climateAssessmentFolder), "workers") + +# Read parameter sets file to ascertain how many parsets there are +allparsets <- read_yaml(probabilisticFile) +nparsets <- length(allparsets$configurations) logmsg <- paste0(date(), " =================== SET UP climate-assessment scripts environment ===================\n") cat(logmsg) @@ -106,9 +111,35 @@ Sys.setenv(MAGICC_EXECUTABLE_7 = magiccBinFile) Sys.setenv(MAGICC_WORKER_ROOT_DIR = magiccWorkersFolder) # Has to be an absolute path Sys.setenv(MAGICC_WORKER_NUMBER = 1) # TODO: Get this from slurm or nproc +# Specify the commands to (de-)activate the venv & run the harmonization/infilling/model scripts +# TODO: This makes assumptions about the users climate-assessment installation. There are a couple of options: +# A) Remove entirely and assume that the user has set up their environment correctly +# B) Make this more flexible by explictly setting them in default.cfg +activate_venv_cmd <- paste("source", normalizePath(file.path(cfg$climate_assessment_root, "..", "venv", "bin", "activate"))) +deactivate_venv_cmd <- "deactivate" + +run_harm_inf_cmd <- paste( + "python", file.path(scriptsFolder, "run_harm_inf.py"), + climateAssessmentEmi, + climateAssessmentFolder, + "--no-inputcheck", + "--infilling-database", infillingDatabaseFile +) +# cat(run_harm_inf_cmd, "\n") + +run_clim_cmd <- paste( + "python", file.path(scriptsFolder, "run_clim.py"), + normalizePath(file.path(climateAssessmentFolder, paste0(baseFileName, "_harmonized_infilled.csv"))), + climateAssessmentFolder, + "--num-cfgs", nparsets, + "--scenario-batch-size", 1, + "--probabilistic-file", probabilisticFile +) +# cat(run_clim_cmd, "\n") + logmsg <- paste0( " climateAssessmentFolder = '", climateAssessmentFolder, "' exists? ", dir.exists(climateAssessmentFolder), "\n", - " baseFileName = '", baseFileName, "\n", + " baseFileName = '", baseFileName, "'\n", " probabilisticFile = '", probabilisticFile, "' exists? ", file.exists(probabilisticFile), "\n", " infillingDatabaseFile = '", infillingDatabaseFile, "' exists? ", file.exists(infillingDatabaseFile), "\n", " scriptsFolder = '", scriptsFolder, "' exists? ", dir.exists(scriptsFolder), "\n", @@ -118,46 +149,36 @@ logmsg <- paste0( " MAGICC_EXECUTABLE_7 = ", Sys.getenv("MAGICC_EXECUTABLE_7") ,"\n", " MAGICC_WORKER_ROOT_DIR = ", Sys.getenv("MAGICC_WORKER_ROOT_DIR") ,"\n", " MAGICC_WORKER_NUMBER = ", Sys.getenv("MAGICC_WORKER_NUMBER") ,"\n", - date(), " =================== EXECUTING climate-assessment scripts ===================\n" + date(), " =================== RUN climate-assessment infilling & harmonization ===================\n", + " activate_venv_cmd = '", activate_venv_cmd, "'\n", + run_harm_inf_cmd, "'\n" ) cat(logmsg) capture.output(cat(logmsg), file = logFile, append = FALSE) +############################# ACTIVATE VENV ############################# + +system(activate_venv_cmd) + ############################# HARMONIZATION/INFILLING ############################# -logmsg <- paste0(date(), " Startclimate-assessment harmonization\n") + +system(run_harm_inf_cmd) + +logmsg <- paste0(date(), " Done with harmonization & infilling\n") cat(logmsg) capture.output(cat(logmsg), file = logFile, append = TRUE) -run_harm_inf_cmd <- paste( - "python", file.path(scriptsFolder, "run_harm_inf.py"), - climateAssessmentEmi, - climateAssessmentFolder, - "--no-inputcheck", - "--infilling-database", infillingDatabaseFile -) -cat(run_harm_inf_cmd, "\n") -# system(run_harm_inf_cmd) - ############################# RUNNING MODEL ############################# -# Read parameter sets file to ascertain how many parsets there are -allparsets <- read_yaml(probabilisticFile) -nparsets <- length(allparsets$configurations) logmsg <- paste0( - date(), " Found ", nparsets, " nparsets, start climate-assessment model runs\n", run_harm_inf_cmd, "\n") + date(), " Found ", nparsets, " nparsets, start climate-assessment model runs\n", run_harm_inf_cmd, "\n", + date(), " =================== RUN climate-assessment model ============================\n", + run_clim_cmd, "'\n" +) cat(logmsg) capture.output(cat(logmsg), file = logFile, append = TRUE) -run_clim_cmd <- paste( - "python", file.path(scriptsFolder, "run_clim.py"), - normalizePath(file.path(climateAssessmentFolder, paste0(baseFileName, "_harmonized_infilled.csv"))), - climateAssessmentFolder, - "--num-cfgs", nparsets, - "--scenario-batch-size", 1, - "--probabilistic-file", probabilisticFile -) -cat(run_clim_cmd, "\n") -# system(run_clim_cmd) +system(run_clim_cmd) ############################# POSTPROCESS CLIMATE OUTPUT ############################# climateAssessmentOutput <- file.path( @@ -176,7 +197,7 @@ capture.output(cat(logmsg), file = logFile, append = TRUE) ############################# APPEND TO REMIND MIF ############################# # Filter only periods used in REMIND, so that it doesn't expand the original mif usePeriods <- unique(read.quitte(remindReportingFile)$period) -# TODO: Get years from someplace else? Above approach take a long time, instead maybe: +# TODO: Get years from someplace else? Above approach takes a long time, instead maybe: # sort(as.integer(colnames(climateAssessmentInputData %>% select(matches("^[0-9]"))))) # climateAssessmentData <- read.quitte(climateAssessmentOutput) @@ -195,3 +216,5 @@ logmsg <- paste0( ) cat(logmsg) capture.output(cat(logmsg), file = logFile, append = TRUE) + +system(deactivate_venv_cmd) \ No newline at end of file From 20f35f1624488bafcab94dbb9bf93d76eb1a2488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 29 Jan 2024 19:06:10 +0100 Subject: [PATCH 26/76] Remove venv handling --- scripts/output/single/ar6Climate.R | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index e6cae8e7d..53e99883d 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -115,8 +115,8 @@ Sys.setenv(MAGICC_WORKER_NUMBER = 1) # TODO: Get this from slurm or nproc # TODO: This makes assumptions about the users climate-assessment installation. There are a couple of options: # A) Remove entirely and assume that the user has set up their environment correctly # B) Make this more flexible by explictly setting them in default.cfg -activate_venv_cmd <- paste("source", normalizePath(file.path(cfg$climate_assessment_root, "..", "venv", "bin", "activate"))) -deactivate_venv_cmd <- "deactivate" +#activate_venv_cmd <- paste("source", normalizePath(file.path(cfg$climate_assessment_root, "..", "venv", "bin", "activate"))) +#deactivate_venv_cmd <- "deactivate" run_harm_inf_cmd <- paste( "python", file.path(scriptsFolder, "run_harm_inf.py"), @@ -156,10 +156,6 @@ logmsg <- paste0( cat(logmsg) capture.output(cat(logmsg), file = logFile, append = FALSE) -############################# ACTIVATE VENV ############################# - -system(activate_venv_cmd) - ############################# HARMONIZATION/INFILLING ############################# system(run_harm_inf_cmd) @@ -189,7 +185,7 @@ climateAssessmentOutput <- file.path( logmsg <- paste0( date(), " climate-assessment finished\n", date(), " =================== POSTPROCESS climate-assessment output ==================\n", - " climateAssessmentOutput = '", climateAssessmentOutput, "' exists? ", dir.exists(climateAssessmentOutput), "\n" + " climateAssessmentOutput = '", climateAssessmentOutput, "'\n" ) cat(logmsg) capture.output(cat(logmsg), file = logFile, append = TRUE) @@ -216,5 +212,3 @@ logmsg <- paste0( ) cat(logmsg) capture.output(cat(logmsg), file = logFile, append = TRUE) - -system(deactivate_venv_cmd) \ No newline at end of file From d7d70bbb854b7d3017749c121a90252de6d5e34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 29 Jan 2024 19:54:53 +0100 Subject: [PATCH 27/76] Logfile issue, piamInterface not updated yet, remove venv command --- scripts/output/single/ar6Climate.R | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 53e99883d..22b8686c2 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -8,9 +8,10 @@ library(madrat) library(remind2) library(quitte) library(piamInterfaces) +library(lucode2) library(yaml) +library(tidyverse) library(readr) -library(lucode2) library(stringr) # TODO: REMOVE THIS LINE. piamInterfaces should be installed as a package on the cluster @@ -18,10 +19,6 @@ devtools::load_all("/p/tmp/tonnru/piamInterfaces/") ############################# BASIC CONFIGURATION ############################# -logmsg <- paste0(date(), " =================== CONFIGURATION STARTED ==================================\n") -cat(logmsg) -capture.output(cat(logmsg), file = logFile, append = FALSE) - gdxName <- "fulldata.gdx" # name of the gdx cfgName <- "cfg.txt" # cfg file for getting file paths @@ -35,14 +32,15 @@ cfgPath <- file.path(outputdir, cfgName) logFile <- file.path(outputdir, "log_climate.txt") # specific log for python steps scenario <- getScenNames(outputdir) remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) -climateAssessmentYaml <- file.path(system.file("iiasaTemplates", package = "piamInterfaces"), - "climate_assessment_variables.yaml") -climateAssessmentEmi <- normalizePath(file.path(outputdir, paste0("ar6_climate_assessment_", scenario, ".csv")), - mustWork = FALSE) +climateAssessmentYaml <- file.path(system.file(package = "piamInterfaces"), + "iiasaTemplates", "climate_assessment_variables.yaml") +climateAssessmentEmi <- normalizePath(file.path(outputdir, paste0("ar6_climate_assessment_", scenario, ".csv")), + mustWork = FALSE) ############################# PREPARING EMISSIONS INPUT ############################# logmsg <- paste0( + date(), " =================== CONFIGURATION STARTED ==================================\n", " cfgPath = '", cfgPath, "' exists? ", file.exists(cfgPath), "\n", " logFile = '", logFile, "' exists? ", file.exists(logFile), "\n", " scenario = '", scenario, "\n", @@ -90,7 +88,7 @@ baseFileName <- sub("\\.csv$", "", basename(climateAssessmentEmi)) probabilisticFile <- normalizePath(file.path(cfg$climate_assessment_files_dir, "parsets", "0fd0f62-derived-metrics-id-f023edb-drawnset.json")) infillingDatabaseFile <- normalizePath(file.path(cfg$climate_assessment_files_dir, - "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv")) + "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv")) scriptsFolder <- normalizePath(file.path(cfg$climate_assessment_root, "scripts")) magiccBinFile <- normalizePath(file.path(cfg$climate_assessment_magicc_bin)) magiccWorkersFolder <- file.path(normalizePath(climateAssessmentFolder), "workers") @@ -150,7 +148,7 @@ logmsg <- paste0( " MAGICC_WORKER_ROOT_DIR = ", Sys.getenv("MAGICC_WORKER_ROOT_DIR") ,"\n", " MAGICC_WORKER_NUMBER = ", Sys.getenv("MAGICC_WORKER_NUMBER") ,"\n", date(), " =================== RUN climate-assessment infilling & harmonization ===================\n", - " activate_venv_cmd = '", activate_venv_cmd, "'\n", + #" activate_venv_cmd = '", activate_venv_cmd, "'\n", run_harm_inf_cmd, "'\n" ) cat(logmsg) From 9f352a2b7372f21762bb3618d2f942da8f76a3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Tue, 30 Jan 2024 17:44:47 +0100 Subject: [PATCH 28/76] Added documentation --- scripts/output/single/ar6Climate.R | 32 +++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 22b8686c2..3deee815c 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -4,6 +4,21 @@ # | AGPL-3.0, you are granted additional permissions described in the # | REMIND License Exception, version 1.0 (see LICENSE file). # | Contact: remind@pik-potsdam.de + +#' @title AR6 climate assessment +#' @description Assessment of new emissions pathways consistent with the climate variable data from the working group +#' III contribution to the IPCC Sixth Assessment (AR6) report. The script uses REMIND emissions data to perform +#' harmonization and infilling based on the IIASA [climate-assessment](https://climate-assessment.readthedocs.io) +#' package. The harmonized and infilled emissions are then used as input to the +#' [MAGICC7 simple climate model](https://magicc.org/). Results are postprocessed and appended to the REMIND model +#' intercomparison file (MIF). +#' +#' @author Gabriel Abrahao, Oliver Richters, Tonn Rüter +#' +#' @param outputdir Directory where REMIND MIF file is located. Output files generated in the process will be written +#' to a subfolder "climate-assessment-data" in this directory. Defaults to "." +#' @param gdxName Name of the REMIND GDX file. Defaults to "fulldata.gdx" + library(madrat) library(remind2) library(quitte) @@ -14,9 +29,6 @@ library(tidyverse) library(readr) library(stringr) -# TODO: REMOVE THIS LINE. piamInterfaces should be installed as a package on the cluster -devtools::load_all("/p/tmp/tonnru/piamInterfaces/") - ############################# BASIC CONFIGURATION ############################# gdxName <- "fulldata.gdx" # name of the gdx @@ -32,10 +44,12 @@ cfgPath <- file.path(outputdir, cfgName) logFile <- file.path(outputdir, "log_climate.txt") # specific log for python steps scenario <- getScenNames(outputdir) remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) -climateAssessmentYaml <- file.path(system.file(package = "piamInterfaces"), - "iiasaTemplates", "climate_assessment_variables.yaml") climateAssessmentEmi <- normalizePath(file.path(outputdir, paste0("ar6_climate_assessment_", scenario, ".csv")), mustWork = FALSE) +# TODO: REMOVE THE NEXT LINE. piamInterfaces should be installed as a package on the cluster +devtools::load_all("/p/tmp/tonnru/piamInterfaces/") +climateAssessmentYaml <- file.path(system.file(package = "piamInterfaces"), + "iiasaTemplates", "climate_assessment_variables.yaml") ############################# PREPARING EMISSIONS INPUT ############################# @@ -54,7 +68,10 @@ cat(logmsg) capture.output(cat(logmsg), file = logFile, append = FALSE) climateAssessmentInputData <- as.quitte(remindReportingFile) %>% + # Consider only the global region filter(region %in% c("GLO", "World")) %>% + # Extract only the variables needed for climate-assessment. These are provided from the iiasaTemplates in the + # piamInterfaces package: https://github.com/pik-piam/piamInterfaces/blob/master/inst/iiasaTemplates/climate_assessment_variables.yaml generateIIASASubmission( mapping = "AR6", outputFilename = NULL, @@ -62,7 +79,10 @@ climateAssessmentInputData <- as.quitte(remindReportingFile) %>% logFile = logFile ) %>% mutate(region = factor("World")) %>% + # Rename the columns using str_to_title which capitalizes the first letter of each word rename_with(str_to_title) %>% + # Transforms the yearly values for each variable from a long to a wide format. The resulting data frame then has + # one column for each year and one row for each variable pivot_wider(names_from = "Period", values_from = "Value") %>% write_csv(climateAssessmentEmi, quote = "none") @@ -89,6 +109,8 @@ probabilisticFile <- normalizePath(file.path(cfg$climate_assessment_files_di "parsets", "0fd0f62-derived-metrics-id-f023edb-drawnset.json")) infillingDatabaseFile <- normalizePath(file.path(cfg$climate_assessment_files_dir, "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv")) + +# Extract the location of the climate-assessment scripts and the MAGICC binary from cfg.txt scriptsFolder <- normalizePath(file.path(cfg$climate_assessment_root, "scripts")) magiccBinFile <- normalizePath(file.path(cfg$climate_assessment_magicc_bin)) magiccWorkersFolder <- file.path(normalizePath(climateAssessmentFolder), "workers") From acf3264d75184294e4d14bbd64384a7fbc4bc829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 5 Feb 2024 13:47:02 +0100 Subject: [PATCH 29/76] Ensure availability of climateAssessment.yaml --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 11a4ce98f..50ba4f8c8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -51,10 +51,10 @@ Imports: nleqslv, optparse, piamenv (>= 0.4.0), - piamInterfaces (>= 0.5.0), + piamInterfaces (>= 0.12.6), plotly, purrr, - quitte (>= 0.3123.0), + quitte (>= 0.3128.4), R.utils, raster, readr, From b617f2f4240a65d57a55207efddbb6e8eca1b788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Mon, 5 Feb 2024 13:53:29 +0100 Subject: [PATCH 30/76] Use read_mif_header to determine period --- scripts/output/single/ar6Climate.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 3deee815c..8c9c53b5a 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -48,6 +48,7 @@ climateAssessmentEmi <- normalizePath(file.path(outputdir, paste0("ar6_climate_ mustWork = FALSE) # TODO: REMOVE THE NEXT LINE. piamInterfaces should be installed as a package on the cluster devtools::load_all("/p/tmp/tonnru/piamInterfaces/") +devtools::load_all("/p/tmp/tonnru/quitte/") climateAssessmentYaml <- file.path(system.file(package = "piamInterfaces"), "iiasaTemplates", "climate_assessment_variables.yaml") @@ -212,9 +213,8 @@ capture.output(cat(logmsg), file = logFile, append = TRUE) ############################# APPEND TO REMIND MIF ############################# # Filter only periods used in REMIND, so that it doesn't expand the original mif -usePeriods <- unique(read.quitte(remindReportingFile)$period) -# TODO: Get years from someplace else? Above approach takes a long time, instead maybe: -# sort(as.integer(colnames(climateAssessmentInputData %>% select(matches("^[0-9]"))))) +#usePeriods <- unique(read.quitte(remindReportingFile)$period) +usePeriods <- as.numeric(grep("[0-9]+", quitte::read_mif_header(remindReportingFile)$header, value = TRUE)) # climateAssessmentData <- read.quitte(climateAssessmentOutput) # climateAssessmentData <- climateAssessmentData[climateAssessmentData$period %in% usePeriods, ] From 97b7aa101ed17fff0b278600d11f6ae436ab46b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Thu, 8 Feb 2024 15:23:17 +0100 Subject: [PATCH 31/76] Reduce slurm option selection when running ar6 reporting --- output.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/output.R b/output.R index e1c344e0b..68ab19a49 100755 --- a/output.R +++ b/output.R @@ -87,9 +87,12 @@ choose_slurmConfig_output <- function(output) { slurm_options <- c("--qos=priority", "--qos=short", "--qos=standby", "--qos=priority --mem=8000", "--qos=short --mem=8000", "--qos=standby --mem=8000", "--qos=priority --mem=32000", - if ("ar6Climate" %in% output) "--qos=priority --tasks-per-node=12 --mem=32000", "direct") if ("reporting" %in% output) slurm_options <- unique(c(grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE), "direct")) + # Modify slurm options for ar6 reporting, since we want to run MAGICC in parallel and we'll need a lot of memory + if ("ar6Climate" %in% output) slurm_options <- c("--qos=priority --tasks-per-node=12 --mem=32000", + "--qos=short --tasks-per-node=12 --mem=32000", + "--qos=standby --tasks-per-node=12 --mem=32000") if (length(slurm_options) == 1) { return(slurm_options[[1]]) } From 5aea216c521f9980c506b1f2194a7bd2cadf1864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Thu, 8 Feb 2024 15:38:07 +0100 Subject: [PATCH 32/76] Cleaned up some TODOs --- scripts/output/single/ar6Climate.R | 33 ++++++++++++------------------ 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index 8c9c53b5a..bf2fac36a 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -46,9 +46,6 @@ scenario <- getScenNames(outputdir) remindReportingFile <- file.path(outputdir, paste0("REMIND_generic_", scenario, ".mif")) climateAssessmentEmi <- normalizePath(file.path(outputdir, paste0("ar6_climate_assessment_", scenario, ".csv")), mustWork = FALSE) -# TODO: REMOVE THE NEXT LINE. piamInterfaces should be installed as a package on the cluster -devtools::load_all("/p/tmp/tonnru/piamInterfaces/") -devtools::load_all("/p/tmp/tonnru/quitte/") climateAssessmentYaml <- file.path(system.file(package = "piamInterfaces"), "iiasaTemplates", "climate_assessment_variables.yaml") @@ -71,8 +68,9 @@ capture.output(cat(logmsg), file = logFile, append = FALSE) climateAssessmentInputData <- as.quitte(remindReportingFile) %>% # Consider only the global region filter(region %in% c("GLO", "World")) %>% - # Extract only the variables needed for climate-assessment. These are provided from the iiasaTemplates in the - # piamInterfaces package: https://github.com/pik-piam/piamInterfaces/blob/master/inst/iiasaTemplates/climate_assessment_variables.yaml + # Extract only the variables needed for climate-assessment. These are provided from the iiasaTemplates in the + # piamInterfaces package. See also: + # https://github.com/pik-piam/piamInterfaces/blob/master/inst/iiasaTemplates/climate_assessment_variables.yaml generateIIASASubmission( mapping = "AR6", outputFilename = NULL, @@ -106,14 +104,18 @@ dir.create(climateAssessmentFolder, showWarnings = FALSE) baseFileName <- sub("\\.csv$", "", basename(climateAssessmentEmi)) # These files are supposed to be all inside cfg$climate_assessment_files_dir in a certain structure -probabilisticFile <- normalizePath(file.path(cfg$climate_assessment_files_dir, - "parsets", "0fd0f62-derived-metrics-id-f023edb-drawnset.json")) -infillingDatabaseFile <- normalizePath(file.path(cfg$climate_assessment_files_dir, - "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv")) +probabilisticFile <- normalizePath(file.path( + cfg$climate_assessment_files_dir, + "parsets", "0fd0f62-derived-metrics-id-f023edb-drawnset.json" +)) +infillingDatabaseFile <- normalizePath(file.path( + cfg$climate_assessment_files_dir, + "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv" +)) # Extract the location of the climate-assessment scripts and the MAGICC binary from cfg.txt -scriptsFolder <- normalizePath(file.path(cfg$climate_assessment_root, "scripts")) -magiccBinFile <- normalizePath(file.path(cfg$climate_assessment_magicc_bin)) +scriptsFolder <- normalizePath(file.path(cfg$climate_assessment_root, "scripts")) +magiccBinFile <- normalizePath(file.path(cfg$climate_assessment_magicc_bin)) magiccWorkersFolder <- file.path(normalizePath(climateAssessmentFolder), "workers") # Read parameter sets file to ascertain how many parsets there are @@ -146,7 +148,6 @@ run_harm_inf_cmd <- paste( "--no-inputcheck", "--infilling-database", infillingDatabaseFile ) -# cat(run_harm_inf_cmd, "\n") run_clim_cmd <- paste( "python", file.path(scriptsFolder, "run_clim.py"), @@ -156,7 +157,6 @@ run_clim_cmd <- paste( "--scenario-batch-size", 1, "--probabilistic-file", probabilisticFile ) -# cat(run_clim_cmd, "\n") logmsg <- paste0( " climateAssessmentFolder = '", climateAssessmentFolder, "' exists? ", dir.exists(climateAssessmentFolder), "\n", @@ -171,7 +171,6 @@ logmsg <- paste0( " MAGICC_WORKER_ROOT_DIR = ", Sys.getenv("MAGICC_WORKER_ROOT_DIR") ,"\n", " MAGICC_WORKER_NUMBER = ", Sys.getenv("MAGICC_WORKER_NUMBER") ,"\n", date(), " =================== RUN climate-assessment infilling & harmonization ===================\n", - #" activate_venv_cmd = '", activate_venv_cmd, "'\n", run_harm_inf_cmd, "'\n" ) cat(logmsg) @@ -213,14 +212,8 @@ capture.output(cat(logmsg), file = logFile, append = TRUE) ############################# APPEND TO REMIND MIF ############################# # Filter only periods used in REMIND, so that it doesn't expand the original mif -#usePeriods <- unique(read.quitte(remindReportingFile)$period) usePeriods <- as.numeric(grep("[0-9]+", quitte::read_mif_header(remindReportingFile)$header, value = TRUE)) -# climateAssessmentData <- read.quitte(climateAssessmentOutput) -# climateAssessmentData <- climateAssessmentData[climateAssessmentData$period %in% usePeriods, ] -# climateAssessmentData <- interpolate_missing_periods(climateAssessmentData, usePeriods, expand.values = FALSE) -# write.mif(climateAssessmentData, remindReportingFile, append = TRUE) - climateAssessmentData <- read.quitte(climateAssessmentOutput) %>% filter(period %in% usePeriods) %>% interpolate_missing_periods(usePeriods, expand.values = FALSE) %>% From 29235ea3c7662d8efff6a02c32090956dad3cee2 Mon Sep 17 00:00:00 2001 From: tonnrueter <5398375+tonnrueter@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:38:42 +0100 Subject: [PATCH 33/76] Generate ar6 reporting slurm options from existing Co-authored-by: orichters <90761609+orichters@users.noreply.github.com> --- output.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/output.R b/output.R index 68ab19a49..2dbd531c0 100755 --- a/output.R +++ b/output.R @@ -90,9 +90,7 @@ choose_slurmConfig_output <- function(output) { "direct") if ("reporting" %in% output) slurm_options <- unique(c(grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE), "direct")) # Modify slurm options for ar6 reporting, since we want to run MAGICC in parallel and we'll need a lot of memory - if ("ar6Climate" %in% output) slurm_options <- c("--qos=priority --tasks-per-node=12 --mem=32000", - "--qos=short --tasks-per-node=12 --mem=32000", - "--qos=standby --tasks-per-node=12 --mem=32000") + if ("ar6Climate" %in% output) slurm_options <- paste(slurm_options[1:3], "--tasks-per-node=12 --mem=32000") if (length(slurm_options) == 1) { return(slurm_options[[1]]) } From 9dd8e275900891820a6359996805b7d6a3318c1c Mon Sep 17 00:00:00 2001 From: Chen Gong <> Date: Tue, 20 Feb 2024 15:02:45 +0100 Subject: [PATCH 34/76] small patches to refactoring cost input data --- core/datainput.gms | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index 3c58e7603..c767b4277 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -130,9 +130,9 @@ pm_shGasLiq_fe_up(ttot,regi,sector)=0; pm_shGasLiq_fe_lo(ttot,regi,sector)=0; -******************************************************************************* -************** Technology data input read-in and manipulation ******* -******************************************************************************* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++ Technology cost data input read-in and manipulation ++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *** Note: future to be its own module perhaps *** Note: in module 5 there are more cost manipulation after initial capacities are calculated, be aware those can overwrite your technology values for policy runs if you set them here in the core ***--------------------------------------------------------------------------- @@ -153,8 +153,12 @@ table f_dataglob_SSP5(char,all_te) "Techno-economic assumptions consisten $include "./core/input/generisdata_tech_SSP5.prn" ; -$IFTHEN.WindOff %cm_wind_offshore% == "1" +*JH* New nuclear assumption for SSP5 +if (cm_nucscen eq 6, + f_dataglob_SSP5("inco0","tnrs") = 6270; !! increased from 4000 to 6270 with the update of technology costs in REMIND 1.7 to keep the percentage increase between SSP2 and SSP5 constant +); +$IFTHEN.WindOff %cm_wind_offshore% == "1" *CG* set wind offshore, storage and grid to be the same as wind onshore (later should be integrated into input data) * main difference between onshore and offshore is the difference in f32_factorStorage fm_dataglob(char,"storwindoff") = fm_dataglob(char,"storwind"); @@ -182,9 +186,9 @@ $offdelim pm_esCapCost(tall,all_regi,all_teEs) = 0; ***--------------------------------------------------------------------------- -****** Manipulating technology data +++++** Manipulating technology cost data ***--------------------------------------------------------------------------- -*** Manipulating global or regional technology data - absolute value +*** Manipulating global or regional technology cost data - absolute value ***--------------------------------------------------------------------------- !! Modify spv and storspv parameters for optimistic VRE supply assumptions if (cm_VRE_supply_assumptions eq 1, @@ -212,9 +216,9 @@ if (c_techAssumptScen eq 3, display fm_dataglob; ***--------------------------------------------------------------------------- -*** Manipulating global or regional technology data - relative value +*** Manipulating global or regional technology cost data - relative value ***--------------------------------------------------------------------------- -*** Overwrite default technology parameter values based on specific scenario configs +*** Overwrite default technology cost parameter values based on specific scenario configs $if not "%cm_incolearn%" == "off" parameter p_new_incolearn(all_te) / %cm_incolearn% /; $if not "%cm_incolearn%" == "off" fm_dataglob("incolearn",te)$p_new_incolearn(te)=p_new_incolearn(te); $if not "%cm_inco0Factor%" == "off" parameter p_new_inco0Factor(all_te) / %cm_inco0Factor% /; @@ -245,14 +249,14 @@ fm_dataglob("incolearn","csp") = 0.7 * fm_dataglob("incolearn","csp"); *** -------------------------------------------------------------------------------- -****** Regionalize investment cost data +++++** Regionalize investment cost data *** ------------------------------------------------------------------------------- *** initialize regionalized data using global data pm_data(all_regi,char,te) = fm_dataglob(char,te); *** ------------------------------------------------------------------------------- -****** Regional risk premium during building time +++++** Regional risk premium during building time *** ------------------------------------------------------------------------------- *RP* calculate turnkey costs (which are the sum of the overnight costs in generisdata_tech and the "interest during construction” (IDC) ) @@ -406,12 +410,12 @@ loop (teNoLearn(te)$( sameas(te,"igcc") ), $endif.REG_techcosts -**************************************************************************************************** -*************************END of Technology data input read-in and manipulation in core ************* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++*END of Technology cost data input read-in and manipulation in core ++++++++++ *** Note: in modules/05_initialCap/on/preloop.gms, there are additional adjustment to investment *** cost in the near term due to calibration of historical energy conversion efficiencies based on *** initial capacities -**************************************************************************************************** +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *JH* Determine CCS injection rates From 95bfcd12d8e20b958918ea774ac2d1a4adb99393 Mon Sep 17 00:00:00 2001 From: Felix Schreyer Date: Sun, 21 Jan 2024 13:56:55 +0100 Subject: [PATCH 35/76] only overwrite pm_data in 05_initialCap module with values from reference GDX for chp eta entries which are the only ones that are being changed in this module. This avoids overwriting changes of pm_data by policy switches, e.g. for changing floor cost of learning technologies. --- modules/05_initialCap/on/declarations.gms | 1 + modules/05_initialCap/on/preloop.gms | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/05_initialCap/on/declarations.gms b/modules/05_initialCap/on/declarations.gms index 5c0453553..2118bcd46 100644 --- a/modules/05_initialCap/on/declarations.gms +++ b/modules/05_initialCap/on/declarations.gms @@ -28,6 +28,7 @@ Parameter $ifThen %cm_techcosts% == "GLO" p05_inco0_t_ref(ttot,all_regi,all_te) "auxiliary parameter to load pm_inco0_t from reference run if cm_startyear > 2005 and initialCap is therefore not run" $endIf + p05_pmdata_ref(all_regi,char,all_te) "auxiliary parameter to load pm_data from reference run if cm_startyear > 2005 and initialCap is therefore not run" ; Variables diff --git a/modules/05_initialCap/on/preloop.gms b/modules/05_initialCap/on/preloop.gms index e5fa84da9..c58d69abc 100644 --- a/modules/05_initialCap/on/preloop.gms +++ b/modules/05_initialCap/on/preloop.gms @@ -532,12 +532,24 @@ if (cm_startyear gt 2005, Execute_Loadpoint 'input_ref' pm_EN_demand_from_initialcap2 = pm_EN_demand_from_initialcap2; Execute_Loadpoint 'input_ref' pm_pedem_res = pm_pedem_res; Execute_Loadpoint 'input_ref' pm_dataeta = pm_dataeta; - Execute_Loadpoint 'input_ref' pm_data = pm_data; Execute_Loadpoint 'input_ref' pm_aux_capLowerLimit = pm_aux_capLowerLimit; Execute_Loadpoint 'input_ref' vm_deltaCap.l = vm_deltaCap.l; Execute_Loadpoint 'input_ref' vm_deltaCap.lo = vm_deltaCap.lo; Execute_Loadpoint 'input_ref' vm_deltaCap.up = vm_deltaCap.up; + + +*** load pm_data from input_ref.gdx and overwrite values +*** only for eta of chp technologies since they have been adapted in initialCap routine above +*** This is to avoid overwriting changes to pm_data by scenario switches + Execute_Loadpoint 'input_ref' p05_pmdata_ref = pm_data; + pm_data(regi,char,te)$( (sameas(te,"coalchp") + OR sameas(te,"gaschp") + OR sameas(te,"biochp") ) + AND sameas(char,"eta") ) = p05_pmdata_ref(regi,char,te); + + + *** if %cm_techcosts% == "GLO", load pm_inco0_t from input_ref.gdx and overwrite values *** only for pc, ngt, ngcc since they have been adapted in initialCap routine above *** This is to avoid overwriting changes to pm_inco0_t by scenario switches From acf6de5308606f09f9932d94a73340afe900d962 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Wed, 21 Feb 2024 19:11:26 +0100 Subject: [PATCH 36/76] small patch --- core/datainput.gms | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index 3c58e7603..5138e8633 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -182,9 +182,9 @@ $offdelim pm_esCapCost(tall,all_regi,all_teEs) = 0; ***--------------------------------------------------------------------------- -****** Manipulating technology data +****** Manipulating cost technology data ***--------------------------------------------------------------------------- -*** Manipulating global or regional technology data - absolute value +*** Manipulating global or regional cost technology data - absolute value ***--------------------------------------------------------------------------- !! Modify spv and storspv parameters for optimistic VRE supply assumptions if (cm_VRE_supply_assumptions eq 1, @@ -201,6 +201,10 @@ if (cm_VRE_supply_assumptions eq 3, ); +*JH* New nuclear assumption for SSP5 +if (cm_nucscen eq 6, + f_dataglob_SSP5("inco0","tnrs") = 6270; !! increased from 4000 to 6270 with the update of technology costs in REMIND 1.7 to keep the percentage increase between SSP2 and SSP5 constant +); if (c_techAssumptScen eq 2, fm_dataglob(char,te) = f_dataglob_SSP1(char,te) @@ -212,7 +216,7 @@ if (c_techAssumptScen eq 3, display fm_dataglob; ***--------------------------------------------------------------------------- -*** Manipulating global or regional technology data - relative value +*** Manipulating global or regional cost technology data - relative value ***--------------------------------------------------------------------------- *** Overwrite default technology parameter values based on specific scenario configs $if not "%cm_incolearn%" == "off" parameter p_new_incolearn(all_te) / %cm_incolearn% /; From f36c4f2d4b8f9e889b278313395932ca07bf4faf Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Fri, 23 Feb 2024 10:38:27 +0100 Subject: [PATCH 37/76] patches and diagnosis --- core/datainput.gms | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/core/datainput.gms b/core/datainput.gms index 5138e8633..24c2c5870 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -148,9 +148,11 @@ $include "./core/input/generisdata_trade.prn" *JH* SSP energy technology scenario table f_dataglob_SSP1(char,all_te) "Techno-economic assumptions consistent with SSP1" $include "./core/input/generisdata_tech_SSP1.prn" +$include "./core/input/generisdata_trade.prn" ; table f_dataglob_SSP5(char,all_te) "Techno-economic assumptions consistent with SSP5" $include "./core/input/generisdata_tech_SSP5.prn" +$include "./core/input/generisdata_trade.prn" ; $IFTHEN.WindOff %cm_wind_offshore% == "1" @@ -159,6 +161,10 @@ $IFTHEN.WindOff %cm_wind_offshore% == "1" * main difference between onshore and offshore is the difference in f32_factorStorage fm_dataglob(char,"storwindoff") = fm_dataglob(char,"storwind"); fm_dataglob(char,"gridwindoff") = fm_dataglob(char,"gridwind"); +f_dataglob_SSP1(char,"storwindoff") = f_dataglob_SSP1(char,"storwind"); +f_dataglob_SSP1(char,"gridwindoff") = f_dataglob_SSP1(char,"gridwind"); +f_dataglob_SSP5(char,"storwindoff") = f_dataglob_SSP5(char,"storwind"); +f_dataglob_SSP5(char,"gridwindoff") = f_dataglob_SSP5(char,"gridwind"); $ENDIF.WindOff *RP* include global flexibility parameters @@ -166,6 +172,10 @@ $include "./core/input/generisdata_flexibility.prn" $IFTHEN.WindOff %cm_wind_offshore% == "1" fm_dataglob("flexibility","storwindoff") = 1.93; fm_dataglob("flexibility","windoff") = -1; +f_dataglob_SSP1("flexibility","storwindoff") = 1.93; +f_dataglob_SSP1("flexibility","windoff") = -1; +f_dataglob_SSP5("flexibility","storwindoff") = 1.93; +f_dataglob_SSP5("flexibility","windoff") = -1; $ENDIF.WindOff ***--------------------------------------------------------------------------- *** Reading in and initializing regional data @@ -1549,5 +1559,33 @@ p_prodAllReference(t,regi,te) = *' initialize vm_changeProdStartyearCost for tax calculation vm_changeProdStartyearCost.l(t,regi,te) = 0; +file compare_refac; +put compare_refac; +put "te", @15, "regi", @20, "pm_data", @27, "inco0", @27, "pm_inco0_t"//; +loop(regi, + loop(te, + put te.tl, @ 15, regi.tl, @20, pm_data(regi,"inco0",te), @65 /; + ) +); + +loop(regi, + loop(te, + loop(ttot, + put ttot.tl @15, te.tl, @ 15, regi.tl, @20, pm_inco0_t(ttot,regi,te), @65 /; + ) + ) +); + +loop(regi, + loop(te, + loop(ttot, + put ttot.tl @15, te.tl, @ 15, regi.tl, @20, p_inco0(ttot,regi,te), @65 /; + ) + ) +); + +putclose compare_refac; + + *** EOF ./core/datainput.gms From 4088683c47b82558855eb08ce81a8ce91709ab1d Mon Sep 17 00:00:00 2001 From: Michaja Pehl Date: Fri, 23 Feb 2024 14:35:03 +0100 Subject: [PATCH 38/76] fix negative fossil emissions in industry - add negative emissions from biomass plastics - fix biomass/synfuels feedstock emission balance, enforce identical shares to FE --- core/equations.gms | 31 +++++++++++-------- .../37_industry/subsectors/declarations.gms | 1 + modules/37_industry/subsectors/equations.gms | 15 +++++++++ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/core/equations.gms b/core/equations.gms index 3ce4a6dec..c8f58cade 100644 --- a/core/equations.gms +++ b/core/equations.gms @@ -519,11 +519,11 @@ q_emiTeDetailMkt(t,regi,enty,enty2,te,enty3,emiMkt)$( OR (pe2se(enty,enty2,te) AND sameas(enty3,"cco2")) ) .. vm_emiTeDetailMkt(t,regi,enty,enty2,te,enty3,emiMkt) =e= - sum(emi2te(enty,enty2,te,enty3), - ( sum(pe2se(enty,enty2,te), - pm_emifac(t,regi,enty,enty2,te,enty3) - * vm_demPE(t,regi,enty,enty2,te) - ) + sum(emi2te(enty,enty2,te,enty3), + ( sum(pe2se(enty,enty2,te), + pm_emifac(t,regi,enty,enty2,te,enty3) + * vm_demPE(t,regi,enty,enty2,te) + ) + sum((ccs2Leak(enty,enty2,te,enty3),teCCS2rlf(te,rlf)), pm_emifac(t,regi,enty,enty2,te,enty3) * vm_co2CCS(t,regi,enty,enty2,te,rlf) @@ -531,16 +531,21 @@ q_emiTeDetailMkt(t,regi,enty,enty2,te,enty3,emiMkt)$( )$( sameas(emiMkt,"ETS") ) + sum(se2fe(enty,enty2,te), pm_emifac(t,regi,enty,enty2,te,enty3) - * sum(sector$( entyFe2Sector(enty2,sector) - AND sector2emiMkt(sector,emiMkt) ), - vm_demFeSector(t,regi,enty,enty2,sector,emiMkt) - !! substract FE used for non-energy purposes (as feedstocks) so it does - !! not create energy-related emissions - - sum(entyFe2sector2emiMkt_NonEn(enty2,sector,emiMkt), - vm_demFENonEnergySector(t,regi,enty,enty2,sector,emiMkt)) - ) + * ( sum(sector$( entyFe2Sector(enty2,sector) + AND sector2emiMkt(sector,emiMkt) ), + vm_demFeSector(t,regi,enty,enty2,sector,emiMkt) + !! substract FE used for non-energy purposes (as feedstocks) so i + !! does not create energy-related emissions + !! FE from seXXbio, seXXsyn (not included in emi2te, therefore se2fe2) + !! create negative emissions + - sum((se2fe2(entySe,enty2,te2), + entyFe2sector2emiMkt_NonEn(entyFe,sector2emiMkt(sector,emiMkt))), + vm_demFENonEnergySector(t,regi,entySe,enty2,sector,emiMkt) + ) + ) ) ) + ) ; ***-------------------------------------------------- diff --git a/modules/37_industry/subsectors/declarations.gms b/modules/37_industry/subsectors/declarations.gms index e3921521f..9a358054d 100644 --- a/modules/37_industry/subsectors/declarations.gms +++ b/modules/37_industry/subsectors/declarations.gms @@ -104,6 +104,7 @@ $endif.no_calibration q37_nonIncineratedPlastics(ttot,all_regi,all_enty,all_enty,all_emiMkt) "calculate carbon contained in plastics that are not incinerated [GtC]" q37_feedstockEmiUnknownFate(ttot,all_regi,all_enty,all_enty,all_emiMkt) "calculate carbon contained in chemical feedstock with unknown fate [GtC]" q37_feedstocksLimit(ttot,all_regi,all_enty,all_enty,all_emiMkt) "restrict feedstocks flow to total energy flows into industry" + q37_feedstocksShares(ttot,all_regi,all_enty,all_enty,all_emiMkt) "identical fossil/biomass/synfuel shares for FE and feedstocks" !! process-based implementation q37_demMatPrc(tall,all_regi,mat) "Material demand of processes" diff --git a/modules/37_industry/subsectors/equations.gms b/modules/37_industry/subsectors/equations.gms index 1a53977b1..ffa917e6d 100644 --- a/modules/37_industry/subsectors/equations.gms +++ b/modules/37_industry/subsectors/equations.gms @@ -242,6 +242,21 @@ q37_feedstocksLimit(ttot,regi,entySE,entyFE,emiMkt)$( vm_demFENonEnergySector(ttot,regi,entySE,entyFE,"indst",emiMkt) ; +*' Feedstocks have identical fossil/biomass/synfuel shares as industry FE +q37_feedstocksShares(t,regi,entySE,entyFE,emiMkt)$( + sum(te, se2fe(entySE,entyFE,te)) ) .. + vm_demFEsector_afterTax(t,regi,entySE,entyFE,"indst",emiMkt) + * sum(se2fe(entySE2,entyFE,te), + vm_demFENonEnergySector(t,regi,entySE2,entyFE,"indst",emiMkt) + ) + =e= + vm_demFENonEnergySector(t,regi,entySE,entyFE,"indst",emiMkt) + * sum(se2fe2(entySE2,entyFE,te), + vm_demFEsector_afterTax(t,regi,entySE2,entyFE,"indst",emiMkt) + ) +; + + *' Calculate mass of carbon contained in chemical feedstocks q37_FeedstocksCarbon(ttot,regi,sefe(entySE,entyFE),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFE,"indst",emiMkt) ) .. From d2f85cedb3c968132a4f4a2036e9b6946b3ac89e Mon Sep 17 00:00:00 2001 From: Michaja Pehl Date: Fri, 23 Feb 2024 14:36:00 +0100 Subject: [PATCH 39/76] boyscout --- core/equations.gms | 30 +++++++++++++++++++----------- core/sets.gms | 3 ++- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/core/equations.gms b/core/equations.gms index c8f58cade..d7875915f 100644 --- a/core/equations.gms +++ b/core/equations.gms @@ -764,18 +764,22 @@ q_emiAll(t,regi,emi(enty)).. ***------------------------------------------------------ *mlb 8/2010* extension for multigas accounting/trading *cb only "static" equation to be active before cm_startyear, as multigasscen could be different from a scenario to another that is fixed on the first - q_co2eq(ttot,regi)$(ttot.val ge cm_startyear).. - vm_co2eq(ttot,regi) - =e= - sum(emiMkt, vm_co2eqMkt(ttot,regi,emiMkt)); +q_co2eq(ttot,regi)$(ttot.val ge cm_startyear).. + vm_co2eq(ttot,regi) + =e= + sum(emiMkt, vm_co2eqMkt(ttot,regi,emiMkt)) +; - q_co2eqMkt(ttot,regi,emiMkt)$(ttot.val ge cm_startyear).. +q_co2eqMkt(ttot,regi,emiMkt)$(ttot.val ge cm_startyear).. vm_co2eqMkt(ttot,regi,emiMkt) =e= - vm_emiAllMkt(ttot,regi,"co2",emiMkt) - + (sm_tgn_2_pgc * vm_emiAllMkt(ttot,regi,"n2o",emiMkt) + - sm_tgch4_2_pgc * vm_emiAllMkt(ttot,regi,"ch4",emiMkt)) $(cm_multigasscen eq 2 or cm_multigasscen eq 3) - - vm_emiMacSector(ttot,regi,"co2luc") $((cm_multigasscen eq 3) AND (sameas(emiMkt,"other"))); + vm_emiAllMkt(ttot,regi,"co2",emiMkt) + + ( sm_tgn_2_pgc * vm_emiAllMkt(ttot,regi,"n2o",emiMkt) + + sm_tgch4_2_pgc * vm_emiAllMkt(ttot,regi,"ch4",emiMkt) + )$( cm_multigasscen eq 2 or cm_multigasscen eq 3 ) + - vm_emiMacSector(ttot,regi,"co2luc")$( + cm_multigasscen eq 3 AND sameas(emiMkt,"other") ) +; ***------------------------------------------------------ *' Total global emissions in CO2 equivalents that are part of the climate policy also take into account foreign emissions. @@ -789,8 +793,12 @@ q_emiAll(t,regi,emi(enty)).. ***------------------------------------ *mh for each region and time step: emissions + permit trade balance < emission cap q_emiCap(t,regi) .. - vm_co2eq(t,regi) + vm_Xport(t,regi,"perm") - vm_Mport(t,regi,"perm") - =l= vm_perm(t,regi); + vm_co2eq(t,regi) + + vm_Xport(t,regi,"perm") + - vm_Mport(t,regi,"perm") + =l= + vm_perm(t,regi) +; ***----------------------------------------------------------------- *** Budgets on GHG emissions (single or two subsequent time periods) diff --git a/core/sets.gms b/core/sets.gms index 7aaccb20f..6d84499b9 100755 --- a/core/sets.gms +++ b/core/sets.gms @@ -921,6 +921,7 @@ $endif.altFeEmiFac ***######################## R SECTION START (MODULES) ############################### *** THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY *** ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT MODEL START +*** CHANGES CAN BE DONE USING THE RESPECTIVE LINES IN scripts/start/prepare.R sets @@ -960,7 +961,7 @@ sets codePerformance / - module2realisation(modules,*) "mapping of modules and active realisations" / +module2realisation(modules,*) "mapping of modules and active realisations" / macro . %macro% welfare . %welfare% PE_FE_parameters . %PE_FE_parameters% From a00ef4d41782db282846d5cc94c1730076943df7 Mon Sep 17 00:00:00 2001 From: Michaja Pehl Date: Tue, 27 Feb 2024 10:00:40 +0100 Subject: [PATCH 40/76] reset q_emiTeDetailMkt --- core/equations.gms | 61 ++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/core/equations.gms b/core/equations.gms index d7875915f..3ce4a6dec 100644 --- a/core/equations.gms +++ b/core/equations.gms @@ -519,11 +519,11 @@ q_emiTeDetailMkt(t,regi,enty,enty2,te,enty3,emiMkt)$( OR (pe2se(enty,enty2,te) AND sameas(enty3,"cco2")) ) .. vm_emiTeDetailMkt(t,regi,enty,enty2,te,enty3,emiMkt) =e= - sum(emi2te(enty,enty2,te,enty3), - ( sum(pe2se(enty,enty2,te), - pm_emifac(t,regi,enty,enty2,te,enty3) - * vm_demPE(t,regi,enty,enty2,te) - ) + sum(emi2te(enty,enty2,te,enty3), + ( sum(pe2se(enty,enty2,te), + pm_emifac(t,regi,enty,enty2,te,enty3) + * vm_demPE(t,regi,enty,enty2,te) + ) + sum((ccs2Leak(enty,enty2,te,enty3),teCCS2rlf(te,rlf)), pm_emifac(t,regi,enty,enty2,te,enty3) * vm_co2CCS(t,regi,enty,enty2,te,rlf) @@ -531,21 +531,16 @@ q_emiTeDetailMkt(t,regi,enty,enty2,te,enty3,emiMkt)$( )$( sameas(emiMkt,"ETS") ) + sum(se2fe(enty,enty2,te), pm_emifac(t,regi,enty,enty2,te,enty3) - * ( sum(sector$( entyFe2Sector(enty2,sector) - AND sector2emiMkt(sector,emiMkt) ), - vm_demFeSector(t,regi,enty,enty2,sector,emiMkt) - !! substract FE used for non-energy purposes (as feedstocks) so i - !! does not create energy-related emissions - !! FE from seXXbio, seXXsyn (not included in emi2te, therefore se2fe2) - !! create negative emissions - - sum((se2fe2(entySe,enty2,te2), - entyFe2sector2emiMkt_NonEn(entyFe,sector2emiMkt(sector,emiMkt))), - vm_demFENonEnergySector(t,regi,entySe,enty2,sector,emiMkt) - ) - ) + * sum(sector$( entyFe2Sector(enty2,sector) + AND sector2emiMkt(sector,emiMkt) ), + vm_demFeSector(t,regi,enty,enty2,sector,emiMkt) + !! substract FE used for non-energy purposes (as feedstocks) so it does + !! not create energy-related emissions + - sum(entyFe2sector2emiMkt_NonEn(enty2,sector,emiMkt), + vm_demFENonEnergySector(t,regi,enty,enty2,sector,emiMkt)) + ) ) ) - ) ; ***-------------------------------------------------- @@ -764,22 +759,18 @@ q_emiAll(t,regi,emi(enty)).. ***------------------------------------------------------ *mlb 8/2010* extension for multigas accounting/trading *cb only "static" equation to be active before cm_startyear, as multigasscen could be different from a scenario to another that is fixed on the first -q_co2eq(ttot,regi)$(ttot.val ge cm_startyear).. - vm_co2eq(ttot,regi) - =e= - sum(emiMkt, vm_co2eqMkt(ttot,regi,emiMkt)) -; + q_co2eq(ttot,regi)$(ttot.val ge cm_startyear).. + vm_co2eq(ttot,regi) + =e= + sum(emiMkt, vm_co2eqMkt(ttot,regi,emiMkt)); -q_co2eqMkt(ttot,regi,emiMkt)$(ttot.val ge cm_startyear).. + q_co2eqMkt(ttot,regi,emiMkt)$(ttot.val ge cm_startyear).. vm_co2eqMkt(ttot,regi,emiMkt) =e= - vm_emiAllMkt(ttot,regi,"co2",emiMkt) - + ( sm_tgn_2_pgc * vm_emiAllMkt(ttot,regi,"n2o",emiMkt) - + sm_tgch4_2_pgc * vm_emiAllMkt(ttot,regi,"ch4",emiMkt) - )$( cm_multigasscen eq 2 or cm_multigasscen eq 3 ) - - vm_emiMacSector(ttot,regi,"co2luc")$( - cm_multigasscen eq 3 AND sameas(emiMkt,"other") ) -; + vm_emiAllMkt(ttot,regi,"co2",emiMkt) + + (sm_tgn_2_pgc * vm_emiAllMkt(ttot,regi,"n2o",emiMkt) + + sm_tgch4_2_pgc * vm_emiAllMkt(ttot,regi,"ch4",emiMkt)) $(cm_multigasscen eq 2 or cm_multigasscen eq 3) + - vm_emiMacSector(ttot,regi,"co2luc") $((cm_multigasscen eq 3) AND (sameas(emiMkt,"other"))); ***------------------------------------------------------ *' Total global emissions in CO2 equivalents that are part of the climate policy also take into account foreign emissions. @@ -793,12 +784,8 @@ q_co2eqMkt(ttot,regi,emiMkt)$(ttot.val ge cm_startyear).. ***------------------------------------ *mh for each region and time step: emissions + permit trade balance < emission cap q_emiCap(t,regi) .. - vm_co2eq(t,regi) - + vm_Xport(t,regi,"perm") - - vm_Mport(t,regi,"perm") - =l= - vm_perm(t,regi) -; + vm_co2eq(t,regi) + vm_Xport(t,regi,"perm") - vm_Mport(t,regi,"perm") + =l= vm_perm(t,regi); ***----------------------------------------------------------------- *** Budgets on GHG emissions (single or two subsequent time periods) From 6c7723705e6969b58a8f30da7d4cd65980a1fb34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Tue, 27 Feb 2024 10:49:18 +0100 Subject: [PATCH 41/76] Make sure log output is appended to file --- scripts/output/single/ar6Climate.R | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index bf2fac36a..c754753bd 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -53,9 +53,10 @@ climateAssessmentYaml <- file.path(system.file(package = "piamInterfaces"), logmsg <- paste0( date(), " =================== CONFIGURATION STARTED ==================================\n", - " cfgPath = '", cfgPath, "' exists? ", file.exists(cfgPath), "\n", - " logFile = '", logFile, "' exists? ", file.exists(logFile), "\n", - " scenario = '", scenario, "\n", + " outputdir = '", outputdir, "' exists? ", file.exists(outputdir), "\n", + " cfgPath = '", cfgPath, "' exists? ", file.exists(cfgPath), "\n", + " logFile = '", logFile, "' exists? ", file.exists(logFile), "\n", + " scenario = '", scenario, "'\n", " remindReportingFile = '", remindReportingFile, "' exists? ", file.exists(remindReportingFile), "\n", " climateAssessmentYaml = '", climateAssessmentYaml, "' exists? ", file.exists(climateAssessmentYaml), "\n", " climateAssessmentEmi = '", climateAssessmentEmi, "' exists? ", file.exists(climateAssessmentEmi), "\n", @@ -63,7 +64,7 @@ logmsg <- paste0( " ar6Climate.R: Extracting REMIND emission data\n" ) cat(logmsg) -capture.output(cat(logmsg), file = logFile, append = FALSE) +capture.output(cat(logmsg), file = logFile, append = TRUE) climateAssessmentInputData <- as.quitte(remindReportingFile) %>% # Consider only the global region @@ -89,7 +90,7 @@ logmsg <- paste0( date(), " ar6Climate.R: Wrote REMIND emission data to '", climateAssessmentEmi, "' for climate-assessment\n" ) cat(logmsg) -capture.output(cat(logmsg), file = logFile, append = FALSE) +capture.output(cat(logmsg), file = logFile, append = TRUE) ############################# PYTHON/MAGICC SETUP ############################# @@ -124,7 +125,7 @@ nparsets <- length(allparsets$configurations) logmsg <- paste0(date(), " =================== SET UP climate-assessment scripts environment ===================\n") cat(logmsg) -capture.output(cat(logmsg), file = logFile, append = FALSE) +capture.output(cat(logmsg), file = logFile, append = TRUE) # Create working folder for climate-assessment files dir.create(magiccWorkersFolder, recursive = TRUE, showWarnings = FALSE) @@ -174,7 +175,7 @@ logmsg <- paste0( run_harm_inf_cmd, "'\n" ) cat(logmsg) -capture.output(cat(logmsg), file = logFile, append = FALSE) +capture.output(cat(logmsg), file = logFile, append = TRUE) ############################# HARMONIZATION/INFILLING ############################# From acf875a16e61acf7f7cbd7cd34525e8375884890 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Tue, 27 Feb 2024 14:59:18 +0100 Subject: [PATCH 42/76] patch to SSP1/5 run --- core/datainput.gms | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index cce25264e..dedd94bbe 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -130,9 +130,9 @@ pm_shGasLiq_fe_up(ttot,regi,sector)=0; pm_shGasLiq_fe_lo(ttot,regi,sector)=0; -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -++++++++++ Technology cost data input read-in and manipulation ++++ -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*++++++++++ Technology cost data input read-in and manipulation ++++ +*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *** Note: future to be its own module perhaps *** Note: in module 5 there are more cost manipulation after initial capacities are calculated, be aware those can overwrite your technology values for policy runs if you set them here in the core ***--------------------------------------------------------------------------- @@ -171,16 +171,6 @@ f_dataglob_SSP5(char,"storwindoff") = f_dataglob_SSP5(char,"storwind"); f_dataglob_SSP5(char,"gridwindoff") = f_dataglob_SSP5(char,"gridwind"); $ENDIF.WindOff -*RP* include global flexibility parameters -$include "./core/input/generisdata_flexibility.prn" -$IFTHEN.WindOff %cm_wind_offshore% == "1" -fm_dataglob("flexibility","storwindoff") = 1.93; -fm_dataglob("flexibility","windoff") = -1; -f_dataglob_SSP1("flexibility","storwindoff") = 1.93; -f_dataglob_SSP1("flexibility","windoff") = -1; -f_dataglob_SSP5("flexibility","storwindoff") = 1.93; -f_dataglob_SSP5("flexibility","windoff") = -1; -$ENDIF.WindOff ***--------------------------------------------------------------------------- *** Reading in and initializing regional data ***--------------------------------------------------------------------------- @@ -196,7 +186,7 @@ $offdelim pm_esCapCost(tall,all_regi,all_teEs) = 0; ***--------------------------------------------------------------------------- -++++** Manipulating technology cost data +*++++** Manipulating technology cost data ***--------------------------------------------------------------------------- *** Manipulating global or regional technology cost data - absolute value ***--------------------------------------------------------------------------- @@ -227,6 +217,13 @@ if (c_techAssumptScen eq 3, fm_dataglob(char,te) = f_dataglob_SSP5(char,te) ); +*RP* include global flexibility parameters +$include "./core/input/generisdata_flexibility.prn" +$IFTHEN.WindOff %cm_wind_offshore% == "1" +fm_dataglob("flexibility","storwindoff") = 1.93; +fm_dataglob("flexibility","windoff") = -1; +$ENDIF.WindOff + display fm_dataglob; ***--------------------------------------------------------------------------- @@ -263,14 +260,14 @@ fm_dataglob("incolearn","csp") = 0.7 * fm_dataglob("incolearn","csp"); *** -------------------------------------------------------------------------------- -++++** Regionalize investment cost data +*++++** Regionalize investment cost data *** ------------------------------------------------------------------------------- *** initialize regionalized data using global data pm_data(all_regi,char,te) = fm_dataglob(char,te); *** ------------------------------------------------------------------------------- -++++** Regional risk premium during building time +*++++** Regional risk premium during building time *** ------------------------------------------------------------------------------- *RP* calculate turnkey costs (which are the sum of the overnight costs in generisdata_tech and the "interest during construction” (IDC) ) @@ -424,12 +421,12 @@ loop (teNoLearn(te)$( sameas(te,"igcc") ), $endif.REG_techcosts -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -++++++++++++++++++++*END of Technology cost data input read-in and manipulation in core ++++++++++ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*++++++++++++++++++++*END of Technology cost data input read-in and manipulation in core ++++++++++ *** Note: in modules/05_initialCap/on/preloop.gms, there are additional adjustment to investment *** cost in the near term due to calibration of historical energy conversion efficiencies based on *** initial capacities -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *JH* Determine CCS injection rates From cadc7f3c4225786ece110734fc2f690dd84c60ad Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Tue, 27 Feb 2024 15:04:22 +0100 Subject: [PATCH 43/76] change in-code comments --- core/datainput.gms | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index dedd94bbe..2e93ec465 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -130,9 +130,9 @@ pm_shGasLiq_fe_up(ttot,regi,sector)=0; pm_shGasLiq_fe_lo(ttot,regi,sector)=0; -*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -*++++++++++ Technology cost data input read-in and manipulation ++++ -*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*------------------------------------------------------------------------------------ +*** Technology data input read-in and manipulation +*------------------------------------------------------------------------------------ *** Note: future to be its own module perhaps *** Note: in module 5 there are more cost manipulation after initial capacities are calculated, be aware those can overwrite your technology values for policy runs if you set them here in the core ***--------------------------------------------------------------------------- @@ -172,7 +172,7 @@ f_dataglob_SSP5(char,"gridwindoff") = f_dataglob_SSP5(char,"gridwind"); $ENDIF.WindOff ***--------------------------------------------------------------------------- -*** Reading in and initializing regional data +*** Reading in and initializing regional cost data ***--------------------------------------------------------------------------- parameter p_inco0(ttot,all_regi,all_te) "regionalized technology costs Unit: USD$/KW" / @@ -186,9 +186,9 @@ $offdelim pm_esCapCost(tall,all_regi,all_teEs) = 0; ***--------------------------------------------------------------------------- -*++++** Manipulating technology cost data +*** Manipulating technology cost data ***--------------------------------------------------------------------------- -*** Manipulating global or regional technology cost data - absolute value +*** Manipulating global or regional cost technology data - absolute value ***--------------------------------------------------------------------------- !! Modify spv and storspv parameters for optimistic VRE supply assumptions if (cm_VRE_supply_assumptions eq 1, @@ -260,14 +260,14 @@ fm_dataglob("incolearn","csp") = 0.7 * fm_dataglob("incolearn","csp"); *** -------------------------------------------------------------------------------- -*++++** Regionalize investment cost data +*** Regionalize technology investment cost data *** ------------------------------------------------------------------------------- *** initialize regionalized data using global data pm_data(all_regi,char,te) = fm_dataglob(char,te); *** ------------------------------------------------------------------------------- -*++++** Regional risk premium during building time +*** Regional risk premium during building time *** ------------------------------------------------------------------------------- *RP* calculate turnkey costs (which are the sum of the overnight costs in generisdata_tech and the "interest during construction” (IDC) ) @@ -420,14 +420,13 @@ loop (teNoLearn(te)$( sameas(te,"igcc") ), ); $endif.REG_techcosts - -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -*++++++++++++++++++++*END of Technology cost data input read-in and manipulation in core ++++++++++ +*------------------------------------------------------------------------------------ +* END of Technology cost data input read-in and manipulation in core +*------------------------------------------------------------------------------------ *** Note: in modules/05_initialCap/on/preloop.gms, there are additional adjustment to investment *** cost in the near term due to calibration of historical energy conversion efficiencies based on *** initial capacities -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - +*------------------------------------------------------------------------------------ *JH* Determine CCS injection rates *LP* for c_ccsinjecratescen =0 the storing variable vm_co2CCS will be fixed to 0 in bounds.gms, the sm_ccsinjecrate=0 will cause a division by 0 error in the 21_tax module From 054a68429a4e4c0b57e51aedfcafae06889257bc Mon Sep 17 00:00:00 2001 From: orichters Date: Tue, 27 Feb 2024 12:18:03 +0100 Subject: [PATCH 44/76] let start_bundle_coupled not fail on missing magpie/output folder --- start_bundle_coupled.R | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/start_bundle_coupled.R b/start_bundle_coupled.R index 0ae554cd4..048685a35 100755 --- a/start_bundle_coupled.R +++ b/start_bundle_coupled.R @@ -124,16 +124,13 @@ NC <- "\033[0m" # No Color # define arguments that are accepted (test for backward compatibility) startgroup <- "1" -flags <- lucode2::readArgs("startgroup", .flags = c(h = "--help", g = "--gamscompile", i = "--interactive", p = "--parallel", t = "--test")) +flags <- lucode2::readArgs("startgroup", .flags = c(h = "--help", g = "--gamscompile", i = "--interactive", t = "--test")) if (! exists("argv")) argv <- commandArgs(trailingOnly = TRUE) if ("--help" %in% flags) { message(helpText) q() } if ("test" %in% argv) flags <- unique(c(flags, "--test")) -if ("--parallel" %in% flags) { - message("The flag --parallel is not necessary anymore, as this is default now") -} # load arguments from command line argv <- grep('(^-|=|^test$)', argv, value = TRUE, invert = TRUE) @@ -155,7 +152,8 @@ if (length(argv) > 0) { message("") } -if (! file.exists("output")) dir.create("output") +dir.create(file.path(path_remind, "output"), showWarnings = FALSE) +dir.create(file.path(path_magpie, "output"), showWarnings = FALSE) ensureRequirementsInstalled(rerunPrompt = "start_bundle_coupled.R") From 65c89408e37017fe069edf10cdaa8c2c1dbd8086 Mon Sep 17 00:00:00 2001 From: orichters Date: Tue, 27 Feb 2024 13:53:27 +0100 Subject: [PATCH 45/76] specify startgroup in coupled tests explicitly --- tests/testthat/test_20-coupled.R | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/testthat/test_20-coupled.R b/tests/testthat/test_20-coupled.R index dacd93c72..8b3a2548b 100644 --- a/tests/testthat/test_20-coupled.R +++ b/tests/testthat/test_20-coupled.R @@ -40,7 +40,7 @@ test_that("environment is suitable for coupled tests", { test_that("using start_bundle_coupled.R --gamscompile works", { skipIfPreviousFailed() # try compiling - output <- localSystem2("Rscript", c("start_bundle_coupled.R", "--gamscompile", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", "--gamscompile", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) printIfFailed(output) expectSuccessStatus(output) @@ -59,7 +59,7 @@ test_that("using start_bundle_coupled.R --gamscompile works", { test_that("using start_bundle_coupled.R --test works", { skipIfPreviousFailed() # just test the settings and RData files are written - output <- localSystem2("Rscript", c("start_bundle_coupled.R", "--test", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", "--test", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) printIfFailed(output) expectSuccessStatus(output) @@ -99,7 +99,7 @@ test_that("using start_bundle_coupled.R --test works", { test_that("runs coupled to MAgPIE work", { skipIfPreviousFailed() # try running actual runs - output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) printIfFailed(output) expectSuccessStatus(output) @@ -156,7 +156,7 @@ test_that("runs coupled to MAgPIE work", { test_that("don't run again if completed", { skipIfPreviousFailed() # do not delete anything to simulate re-running already completed run - output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) printIfFailed(output) writeLines(output, "C_TESTTHAT_startlog_1.txt") @@ -175,7 +175,7 @@ test_that("delete last REMIND run to simulate re-starting aborted run", { paste0("../../output/C_", scen, ".mif") ) expect_true(0 == unlink(filestodelete, recursive = TRUE)) - output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) writeLines(output, "C_TESTTHAT_startlog_2.txt") printIfFailed(output) @@ -186,7 +186,7 @@ test_that("delete last REMIND run to simulate re-starting aborted run", { # delete the last MAgPIE, but not the last REMIND scenario and expect fail filestodelete <- file.path(magpie_folder, "output", paste0("C_", scen, "-mag-", (max_iterations - 1))) expect_true(0 == unlink(filestodelete, recursive = TRUE)) - output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) writeLines(output, "C_TESTTHAT_startlog_3.txt") expectFailStatus(output) @@ -200,7 +200,7 @@ test_that("delete last REMIND run to simulate re-starting aborted run", { paste0("../../output/C_", scen, ".mif") ) expect_true(0 == unlink(filestodelete, recursive = TRUE)) - output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) printIfFailed(output) writeLines(output, "C_TESTTHAT_startlog_4.txt") @@ -212,7 +212,7 @@ test_that("delete last REMIND run to simulate re-starting aborted run", { # delete all REMIND, but not MAgPIE, and expect fail filestodelete <- paste0("../../output/C_", scen, "-rem-", seq(max_iterations)) expect_true(0 == unlink(filestodelete, recursive = TRUE)) - output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig), + output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), env = paste0("R_PROFILE_USER=", Rprofile)) writeLines(output, "C_TESTTHAT_startlog_5.txt") expectFailStatus(output) From a73d645ea99401ce1b4db1071133a91bd8d19885 Mon Sep 17 00:00:00 2001 From: orichters Date: Tue, 27 Feb 2024 16:15:02 +0100 Subject: [PATCH 46/76] repair reportingREMIND2MAgPIE --- scripts/output/export/xlsx_IIASA.R | 2 +- scripts/output/single/reporting.R | 15 +++----- .../output/single/reportingREMIND2MAgPIE.R | 35 +++++++++---------- start_bundle_coupled.R | 2 +- start_coupled.R | 4 +-- 5 files changed, 26 insertions(+), 32 deletions(-) diff --git a/scripts/output/export/xlsx_IIASA.R b/scripts/output/export/xlsx_IIASA.R index 485ba5c87..c7a612b83 100644 --- a/scripts/output/export/xlsx_IIASA.R +++ b/scripts/output/export/xlsx_IIASA.R @@ -67,7 +67,7 @@ lucode2::readArgs("outputdirs", "filename_prefix", "outputFilename", "model", if (is.null(mapping)) { mapping <- gms::chooseFromList(names(piamInterfaces::templateNames()), type = "mapping template") } -if (length(mapping) == 0 || ! all(file.exists(mapping) | mapping %in% names(templateNames()))) +if (length(mapping) == 0 || ! all(file.exists(mapping) | mapping %in% names(templateNames()))) { stop("mapping='", paste(mapping, collapse = ", "), "' not found.") } if (exists("iiasatemplate") && ! is.null(iiasatemplate) && ! file.exists(iiasatemplate)) { diff --git a/scripts/output/single/reporting.R b/scripts/output/single/reporting.R index dc2b42b80..6bf35f01e 100644 --- a/scripts/output/single/reporting.R +++ b/scripts/output/single/reporting.R @@ -50,11 +50,8 @@ load(configfile, envir = envir) # produce REMIND reporting *.mif based on gdx information message("\n### start generation of mif files at ", Sys.time()) -tmp <- try(convGDX2MIF(gdx, gdx_refpolicycost = gdx_refpolicycost, file = remind_reporting_file, - scenario = scenario, gdx_ref = gdx_ref)) # try to execute convGDX2MIF -if (inherits(tmp, "try-error")) { - convGDX2MIF_REMIND2MAgPIE(gdx, file = remind_reporting_file, scenario = scenario) -} +convGDX2MIF(gdx, gdx_refpolicycost = gdx_refpolicycost, file = remind_reporting_file, + scenario = scenario, gdx_ref = gdx_ref) # MAGICC code not working with REMIND-EU # generate MAGICC reporting and append to REMIND reporting @@ -122,11 +119,9 @@ if (! is.null(magpie_reporting_file) && file.exists(magpie_reporting_file)) { message("### end generation of mif files at ", Sys.time()) ## produce REMIND LCOE reporting *.csv based on gdx information -if (! isTRUE(envir$cfg$gms$c_empty_model == "on") || ! grepl("^C_TESTTHAT", scenario)) { - message("### start generation of LCOE reporting at ", Sys.time()) - tmp <- try(convGDX2CSV_LCOE(gdx,file=LCOE_reporting_file,scen=scenario)) # execute convGDX2MIF_LCOE - message("### end generation of LCOE reporting at ", Sys.time()) -} +message("### start generation of LCOE reporting at ", Sys.time()) +tmp <- try(convGDX2CSV_LCOE(gdx,file=LCOE_reporting_file,scen=scenario)) # execute convGDX2MIF_LCOE +message("### end generation of LCOE reporting at ", Sys.time()) ## generate DIETER reporting if it is needed ## the reporting is appended to REMIND_generic_.MIF in "DIETER" Sub Directory diff --git a/scripts/output/single/reportingREMIND2MAgPIE.R b/scripts/output/single/reportingREMIND2MAgPIE.R index 9fc92e542..48171e701 100644 --- a/scripts/output/single/reportingREMIND2MAgPIE.R +++ b/scripts/output/single/reportingREMIND2MAgPIE.R @@ -21,36 +21,35 @@ if(!exists("source_include")) { gdx <- file.path(outputdir,gdx_name) scenario <- getScenNames(outputdir) + +configfile <- file.path(outputdir, "config.Rdata") +envir <- new.env() +load(configfile, envir = envir) + ############################################################################### # paths of the reporting files remind_reporting_file <- file.path(outputdir,paste0("REMIND_generic_",scenario,".mif")) # produce REMIND reporting *.mif based on gdx information +message("\n### start generation of mif files at ", Sys.time()) convGDX2MIF_REMIND2MAgPIE(gdx, file = remind_reporting_file, scenario = scenario) -# create common REMIND-MAgPIE reporting by sticking individual REMIND and MAgPIE reporting mifs together -configfile <- file.path(outputdir, "config.Rdata") -envir <- new.env() -load(configfile, envir = envir) magpie_reporting_file <- envir$cfg$pathToMagpieReport if (! is.null(magpie_reporting_file) && file.exists(magpie_reporting_file)) { message("add MAgPIE reporting from ", magpie_reporting_file) - tmp_rem <- read.report(remind_reporting_file, as.list=FALSE) - tmp_mag <- read.report(magpie_reporting_file, as.list=FALSE)[, getYears(tmp_rem), ] + tmp_rem <- quitte::as.quitte(remind_reporting_file) + tmp_mag <- dplyr::filter(quitte::as.quitte(magpie_reporting_file), .data$period %in% unique(tmp_rem$period)) # remove population from magpie reporting to avoid duplication (units "million" vs. "million people") - tmp_mag <- tmp_mag[, , "Population (million people)", invert = TRUE] - # harmonize scenario name from -mag-xx to -rem-xx - getNames(tmp_mag, dim = 1) <- paste0(scenario) - tmp_rem_mag <- mbind(tmp_rem, tmp_mag) - # extract variable names without units for both models - remind_variables <- magclass::unitsplit(getNames(tmp_rem_mag[, , "REMIND"], dim = 3))$variable - magpie_variables <- magclass::unitsplit(getNames(tmp_rem_mag[, , "MAgPIE"], dim = 3))$variable - if (any(remind_variables %in% magpie_variables)) { - message("Cannot produce common REMIND-MAgPIE reporting because there are identical variable names in both models!") - } else { - write.report(tmp_rem_mag, file = remind_reporting_file, ndigit = 7) - deletePlus(remind_reporting_file, writemif = TRUE) + sharedvariables <- intersect(tmp_mag$variable, tmp_rem$variable) + if (length(sharedvariables) > 0) { + message("The following variables will be dropped from MAgPIE reporting because they are in REMIND reporting: ", paste(sharedvariables, collapse = ", ")) + tmp_mag <- dplyr::filter(tmp_mag, ! .data$variable %in% sharedvariables) } + # harmonize scenario name from -mag-xx to -rem-xx + tmp_mag$scenario <- paste0(scenario) + tmp_rem_mag <- rbind(tmp_rem, tmp_mag) + quitte::write.mif(tmp_rem_mag, path = remind_reporting_file) + deletePlus(remind_reporting_file, writemif = TRUE) } message("### end generation of mif files at ", Sys.time()) diff --git a/start_bundle_coupled.R b/start_bundle_coupled.R index 048685a35..c358dea34 100755 --- a/start_bundle_coupled.R +++ b/start_bundle_coupled.R @@ -641,7 +641,7 @@ for (scen in common) { } slurmOptions <- combine_slurmConfig(paste0("--qos=", runEnv$qos, " --job-name=", fullrunname, " --output=", logfile, " --open-mode=append --mail-type=END --comment=REMIND-MAgPIE --tasks-per-node=", runEnv$numberOfTasks, - if (runEnv$numberOfTasks == 1) " --mem=8000"), runEnv$sbatch) + if (runEnv$numberOfTasks == 1) " --mem=16000"), runEnv$sbatch) slurmCommand <- paste0("sbatch ", slurmOptions, " --wrap=\"Rscript start_coupled.R coupled_config=", Rdatafile, "\"") message(slurmCommand) exitCode <- system(slurmCommand) diff --git a/start_coupled.R b/start_coupled.R index 8854d71c1..b4be48fc9 100644 --- a/start_coupled.R +++ b/start_coupled.R @@ -74,7 +74,7 @@ start_coupled <- function(path_remind, path_magpie, cfg_rem, cfg_mag, runname, m # Switch off generation of needless output for all but the last REMIND iteration if (i < max_iterations) { - cfg_rem$output <- intersect(c("reporting", "emulator", "rds_report", "reportingREMIND2MAgPIE"), cfg_rem_original) + cfg_rem$output <- intersect(cfg_rem_original, c("reporting", "reportingREMIND2MAgPIE", "emulator", "rds_report")) } else { cfg_rem$output <- cfg_rem_original } @@ -260,7 +260,7 @@ start_coupled <- function(path_remind, path_magpie, cfg_rem, cfg_mag, runname, m } slurmOptions <- combine_slurmConfig(paste0("--qos=", subseq.env$qos, " --job-name=", subseq.env$fullrunname, " --output=", logfile, " --open-mode=append --mail-type=END --comment=REMIND-MAgPIE --tasks-per-node=", subseq.env$numberOfTasks, - if (subseq.env$numberOfTasks == 1) " --mem=8000"), subseq.env$sbatch) + if (subseq.env$numberOfTasks == 1) " --mem=16000"), subseq.env$sbatch) subsequentcommand <- paste0("sbatch ", slurmOptions, " --wrap=\"Rscript start_coupled.R coupled_config=", RData_file, "\"") message(subsequentcommand) if (length(needfulldatagdx) > 0) { From ba5b577b50ef330446900886644b52bc17005924 Mon Sep 17 00:00:00 2001 From: orichters Date: Tue, 27 Feb 2024 16:50:24 +0100 Subject: [PATCH 47/76] try to get test-coupled running --- config/scenario_config_GCS.csv | 48 ------------------- config/scenario_config_coupled_SHAPE.csv | 36 -------------- .../scenario_config_tradeCap_standalone.csv | 2 - tests/testthat/test_04-gamscompile.R | 3 -- tests/testthat/test_20-coupled.R | 4 +- 5 files changed, 2 insertions(+), 91 deletions(-) delete mode 100644 config/scenario_config_GCS.csv delete mode 100644 config/scenario_config_coupled_SHAPE.csv delete mode 100644 config/scenario_config_tradeCap_standalone.csv diff --git a/config/scenario_config_GCS.csv b/config/scenario_config_GCS.csv deleted file mode 100644 index e3e2724cd..000000000 --- a/config/scenario_config_GCS.csv +++ /dev/null @@ -1,48 +0,0 @@ -title;start;CES_parameters;cm_rcp_scen;climate;cm_magicc_config;cm_magicc_calibrateTemperature2000;downscaleTemperature;damages;cm_TCpers;cm_TCspec;cm_bioenergy_SustTax;cm_iterative_target_adj;subsidizeLearning;c_budgetCO2from2020;carbonprice;cm_co2_tax_2020;c_peakBudgYr;c_taxCO2inc_after_peakBudgYr;cm_emiscen;cm_flex_tax;cm_EDGEtr_scen;cm_build_H2costAddH2Inv;cm_CESMkup_build;cm_CESMkup_ind;cm_CESMkup_ind_data;cm_PriceDurSlope_elh2;techpol;cm_POPscen;cm_GDPscen;cm_demScen;cm_LU_emi_scen;c_techAssumptScen;cm_nucscen;cm_so2tax_scen;cm_multigasscen;cm_ccapturescen;c_ccsinjecratescen;CCU;cm_INCONV_PENALTY_FESwitch;cm_APscen;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_carbonprice -SSP2-Base;1;load;none;magicc;RCP26_50;HADCRUT4;CMIP5;off;9;mean;0;0;off;0;none;-1;2100;3;1;0;Mix1;0.2;standard;standard;;10;none;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2005;;;; -SSP2-Tall-PkBudg750;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;750;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-NDC;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;3;globallyOptimal;0;NDC;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-NPi;1;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;3;globallyOptimal;0;NPi;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2005;;;; -SSP2-ENEndc;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NDC -SSP2-ENEcp;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-ENEelec;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-ENEcp-ENEcc;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tene;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tpc;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDcp;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDndc;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDlbs;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDreseff;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDfood;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-Tland;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-nofood-Tland;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-Tene-LNDndc;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tene-LNDlbs;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tene-LNDreseff;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tene-LNDfood;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-nofood-Tene-Tland;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tene-Tland;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SDP-Tall-PkBudg750;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;750;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SDP;gdp_SDP;gdp_SDP;SDP;2;2;4;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SDP-Tall-exoCP;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SDP;gdp_SDP;gdp_SDP;SDP;2;2;4;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP1-Tall-exoCP;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP1;gdp_SSP1;gdp_SSP1;SSP1;2;2;4;2;1;1;on;off;SSP1;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tene-rcp45;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-Tpc-rcp45;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-Tland-rcp45;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDndc-rcp45;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDlbs-rcp45;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDreseff-rcp45;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-LNDfood-rcp45;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NPi -SSP2-basendc-Tene;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;manual;feel_steel_secondary 1.00, feel_steel_primary 1.00 , feelhth_chemicals 1.00, feelhth_otherInd 1.00, feh2_chemicals 0.87, feh2_steel 0.87, feh2_otherInd 0.87, feh2_cement 0.87;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-basendc-Tland;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.2;standard;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;2;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-NDC -SSP2-Tall-noTpc-PkBudg750;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;750;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-Tall-noDam-PkBudg750;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;off;9;mean;0;9;globallyOptimal;750;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-Tall-noDam-exoCP;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;off;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-NPi-noDam;0;load;rcp45;magicc;RCP26_50;HADCRUT4;CMIP5;off;9;mean;0;3;globallyOptimal;0;NPi;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2005;;;; -SSP2-notrans-PkBudg750;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;750;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix1;0.2;standard;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-notrans-PkBudg500;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;500;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix1;0.2;standard;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-CPonly;0;load;rcp26;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;0;globallyOptimal;0;exogenous;1;2100;3;9;0;Mix1;0.2;standard;standard;;10;NPi2018;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2EU;SSP2;1;2;1;3;2;0;off;off;SSP2;2025;;SSP2-NPi;SSP2-Base;SSP2-Tall-PkBudg750 -SSP2-lowEnBase;0;load;none;magicc;RCP26_50;HADCRUT4;CMIP5;off;9;mean;0;0;off;0;none;-1;2100;3;1;0;Mix1;0.2;standard;standard;;10;none;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;2;0;off;off;SSP2;2005;;;; -SSP2-sens-Tall-PkBudg750;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;750;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-sens-Tall-PkBudg700;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;700;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-sens-Tall-PkBudg650;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;650;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; -SSP2-sens-Tall-PkBudg600;0;load;rcp20;magicc;RCP26_50;HADCRUT4;CMIP5;KWTCint;9;mean;0;9;globallyOptimal;600;diffCurvPhaseIn2Lin;200;2045;3;9;0;Mix4;0.15;feelhpb 0.87;standard;;10;NDC;pop_SSP2EU;gdp_SSP2EU;gdp_SSP2_lowEn;SSP2;1;2;1;2;1;1;on;off;SSP2;2025;;SSP2-NPi;SSP2-Base; diff --git a/config/scenario_config_coupled_SHAPE.csv b/config/scenario_config_coupled_SHAPE.csv deleted file mode 100644 index 7dce22a13..000000000 --- a/config/scenario_config_coupled_SHAPE.csv +++ /dev/null @@ -1,36 +0,0 @@ -title;start;qos;oldrun;path_report;magpie_scen;no_ghgprices_land_until;path_gdx;path_gdx_ref;path_gdx_bau -SSP1-Base;1;short;;;SSP1|NPI|nocc_hist;y2150;;; -SSP1-NDC;0;short;;;SSP1|NDC|nocc_hist;y2150;;; -SSP1-NPi;1;short;;;SSP1|NPI|nocc_hist;y2150;;; -SSP1-PkBudg500;0;short;;;SSP1|NDC|nocc_hist;y2030;;; -SSP1-PkBudg650;1;short;;;SSP1|NDC|nocc_hist;y2030;;; -SSP2EU-Base;1;priority;;;SSP2|NPI|nocc_hist;y2150;;; -SSP2EU-NDC;1;priority;;;SSP2|NDC|nocc_hist;y2150;;; -SSP2EU-NPi;1;short;;;SSP2|NPI|nocc_hist;y2150;;; -SSP2EU-PkBudg500;1;short;;;SSP2|NDC|nocc_hist;y2030;;; -SSP2EU-PkBudg650;1;short;;;SSP2|NDC|nocc_hist;y2030;;; -SDP-Base;0;short;;;SDP|NPI|nocc_hist;y2150;;; -SDP-NDC;0;short;;;SDP|NDC|nocc_hist;y2150;;; -SDP-NPi;0;short;;;SDP|NPI|nocc_hist;y2150;;; -SDP-PkBudg500;0;short;;;SDP|NDC|nocc_hist;y2030;;; -SDP-PkBudg650;0;short;;;SDP|NDC|nocc_hist;y2030;;; -SDP_MC-Base;1;priority;;;SDP-MC|NPI|nocc_hist;y2150;;; -SDP_MC-NDC;1;short;;;SDP-MC|NDC|nocc_hist;y2150;;; -SDP_MC-NPi;1;short;;;SDP-MC|NPI|nocc_hist;y2150;;; -SDP_MC-PkBudg500;1;short;;;SDP-MC|NDC|nocc_hist;y2030;;; -SDP_MC-PkBudg650;1;short;;;SDP-MC|NDC|nocc_hist;y2030;;; -SDP_EI-Base;1;priority;;;SDP-EI|NPI|nocc_hist;y2150;;; -SDP_EI-NDC;1;short;;;SDP-EI|NDC|nocc_hist;y2150;;; -SDP_EI-NPi;1;short;;;SDP-EI|NPI|nocc_hist;y2150;;; -SDP_EI-PkBudg500;1;short;;;SDP-EI|NDC|nocc_hist;y2030;;; -SDP_EI-PkBudg650;1;short;;;SDP-EI|NDC|nocc_hist;y2030;;; -SDP_RC-Base;1;priority;;;SDP-RC|NPI|nocc_hist;y2150;;; -SDP_RC-NDC;1;short;;;SDP-RC|NDC|nocc_hist;y2150;;; -SDP_RC-NPi;1;short;;;SDP-RC|NPI|nocc_hist;y2150;;; -SDP_RC-PkBudg500;1;short;;;SDP-RC|NDC|nocc_hist;y2030;;; -SDP_RC-PkBudg650;1;short;;;SDP-RC|NDC|nocc_hist;y2030;;; -SDP_MC-PkBudg650-CCimp;1;short;;;SDP-MC|NDC|cc|rcp1p9;y2030;;; -SDP_EI-PkBudg650-CCimp;1;short;;;SDP-EI|NDC|cc|rcp1p9;y2030;;; -SDP_RC-PkBudg650-CCimp;1;short;;;SDP-RC|NDC|cc|rcp1p9;y2030;;; -SSP2EU-PkBudg650-CCimp;1;short;;;SSP2|NDC|cc|rcp1p9;y2030;;; -SSP2EU-NPi-CCimp;1;short;;;SSP2|NPI|cc|rcp4p5;y2150;;; diff --git a/config/scenario_config_tradeCap_standalone.csv b/config/scenario_config_tradeCap_standalone.csv deleted file mode 100644 index b391d2f77..000000000 --- a/config/scenario_config_tradeCap_standalone.csv +++ /dev/null @@ -1,2 +0,0 @@ -title;trade;start;model;output;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau -standalone_trade;capacity;1;standalone/trade/trade.gms;reporting_trade;2005;;; diff --git a/tests/testthat/test_04-gamscompile.R b/tests/testthat/test_04-gamscompile.R index f1b206fd8..f36ff5b1d 100644 --- a/tests/testthat/test_04-gamscompile.R +++ b/tests/testthat/test_04-gamscompile.R @@ -30,9 +30,6 @@ test_that("start.R --gamscompile works on all configs and scenarios", { file.path("../../config", "*", "scenario_config*.csv"))) } csvfiles <- normalizePath(grep("^scenario_config_coupled.*", csvfiles, invert = TRUE, value = TRUE)) - skipfiles <- c("scenario_config_tradeCap_standalone", - "scenario_config_GCS") - csvfiles <- grep(paste(skipfiles, collapse = "|"), csvfiles, invert = TRUE, value = TRUE) expect_true(length(csvfiles) > 0) testthat::with_mocked_bindings( for (csvfile in csvfiles) { diff --git a/tests/testthat/test_20-coupled.R b/tests/testthat/test_20-coupled.R index 8b3a2548b..c58c6e142 100644 --- a/tests/testthat/test_20-coupled.R +++ b/tests/testthat/test_20-coupled.R @@ -138,12 +138,12 @@ test_that("runs coupled to MAgPIE work", { expect_true(any(grepl("^REMIND", levels(qscen$model)))) expect_false(any(grepl("^MAgPIE", levels(qscen$model)))) lengthwithoutmag <- nrow(qscen) - expect_true(lengthwithoutmag > 700000) + expect_true(lengthwithoutmag > 70000) qscen <- quitte::as.quitte(paste0("../../output/C_", scen, "-rem-", max_iterations, "/REMIND_generic_C_", scen, "-rem-", max_iterations, ".mif")) expect_true(any(grepl("^REMIND", levels(qscen$model)))) expect_true(any(grepl("^MAgPIE", levels(qscen$model)))) lengthwithmag <- nrow(qscen) - expect_true(lengthwithmag > 850000 && lengthwithmag > lengthwithoutmag) + expect_true(lengthwithmag > lengthwithoutmag) qscen <- quitte::as.quitte(paste0("../../output/C_", scen, "-rem-1/REMIND_generic_C_", scen, "-rem-1.mif")) # check main mif qscen <- quitte::as.quitte(paste0("../../output/C_", scen, ".mif")) From 3de518cb38e59a32e3e24c55652982bdcbb25969 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Tue, 27 Feb 2024 17:30:07 +0100 Subject: [PATCH 48/76] small patch --- core/datainput.gms | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index 2e93ec465..b439d5370 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -155,11 +155,6 @@ $include "./core/input/generisdata_tech_SSP5.prn" $include "./core/input/generisdata_trade.prn" ; -*JH* New nuclear assumption for SSP5 -if (cm_nucscen eq 6, - f_dataglob_SSP5("inco0","tnrs") = 6270; !! increased from 4000 to 6270 with the update of technology costs in REMIND 1.7 to keep the percentage increase between SSP2 and SSP5 constant -); - $IFTHEN.WindOff %cm_wind_offshore% == "1" *CG* set wind offshore, storage and grid to be the same as wind onshore (later should be integrated into input data) * main difference between onshore and offshore is the difference in f32_factorStorage From 646571f7579f51e425855c2e9fb94a2c30f8d877 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Tue, 27 Feb 2024 17:31:34 +0100 Subject: [PATCH 49/76] remove print out of pm_data for comparing to refactor branch --- core/datainput.gms | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index b439d5370..2f04a870d 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -1554,33 +1554,5 @@ p_prodAllReference(t,regi,te) = *' initialize vm_changeProdStartyearCost for tax calculation vm_changeProdStartyearCost.l(t,regi,te) = 0; -file compare_refac; -put compare_refac; -put "te", @15, "regi", @20, "pm_data", @27, "inco0", @27, "pm_inco0_t"//; -loop(regi, - loop(te, - put te.tl, @ 15, regi.tl, @20, pm_data(regi,"inco0",te), @65 /; - ) -); - -loop(regi, - loop(te, - loop(ttot, - put ttot.tl @15, te.tl, @ 15, regi.tl, @20, pm_inco0_t(ttot,regi,te), @65 /; - ) - ) -); - -loop(regi, - loop(te, - loop(ttot, - put ttot.tl @15, te.tl, @ 15, regi.tl, @20, p_inco0(ttot,regi,te), @65 /; - ) - ) -); - -putclose compare_refac; - - *** EOF ./core/datainput.gms From 92e5bc922d6cf2bc694e3afa2d6cdeb5b2e34ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Tue, 27 Feb 2024 19:21:40 +0100 Subject: [PATCH 50/76] Fixed merge errors related to choose_slurmConfig_output --- output.R | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/output.R b/output.R index 90c01753f..ed87d8987 100755 --- a/output.R +++ b/output.R @@ -67,7 +67,8 @@ library(lucode2) library(gms) require(stringr, quietly = TRUE) -source("scripts/start/isSlurmAvailable.R") +# Import all functions from the scripts/start folder +invisible(sapply(list.files("scripts/start", pattern = "\\.R$", full.names = TRUE), source)) flags <- NULL ### Define arguments that can be read from command line @@ -86,17 +87,16 @@ if ("--help" %in% flags) { choose_slurmConfig_output <- function(output) { slurm_options <- c("--qos=priority", "--qos=short", "--qos=standby", "--qos=priority --mem=8000", "--qos=short --mem=8000", - "--qos=standby --mem=8000", "--qos=priority --mem=32000") - - # Modify slurm options for ar6 reporting, since we want to run MAGICC in parallel and we'll need a lot of memory - if ("ar6Climate" %in% output) slurm_options <- paste(slurm_options[1:3], "--tasks-per-node=12 --mem=32000") + "--qos=standby --mem=8000", "--qos=priority --mem=32000", + "direct") if (!isSlurmAvailable()) return("direct") - if (!is.null(slurmExceptions)) { - slurm_options <- grep(slurmExceptions, slurm_options, value = TRUE) - } + if ("reporting" %in% output) slurm_options <- unique(c(grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE), "direct")) + + # Modify slurm options for ar6 reporting, since we want to run MAGICC in parallel and we'll need a lot of memory + if ("ar6Climate" %in% output) slurm_options <- paste(slurm_options[1:3], "--tasks-per-node=12 --mem=32000") if (length(slurm_options) == 1) { return(slurm_options[[1]]) @@ -211,10 +211,9 @@ if (comp %in% c("comparison", "export")) { } } } else { # comp = single - # define slurm class or direct execution + # define slurm class or direct execution outputInteractive <- c("plotIterations", "fixOnRef", "integratedDamageCosts") if (! exists("source_include")) { - # for selected output scripts, only slurm configurations matching these regex are available if (any(output %in% outputInteractive)) { slurmConfig <- "direct" flags <- c(flags, "--interactive") # to tell scripts they can run in interactive mode From 2465a6cc0a3a4cbc07b7b82a7d6fb7568c4da4dd Mon Sep 17 00:00:00 2001 From: orichters <90761609+orichters@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:49:45 +0100 Subject: [PATCH 51/76] =?UTF-8?q?combine=5FslurmConfig=20does=20not=20work?= =?UTF-8?q?=20on=20vectors=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- output.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output.R b/output.R index 545637080..dc11348cb 100755 --- a/output.R +++ b/output.R @@ -93,7 +93,7 @@ choose_slurmConfig_output <- function(output) { return("direct") # Modify slurm options for ar6 reporting, since we want to run MAGICC in parallel and we'll need a lot of memory - if ("ar6Climate" %in% output) slurm_options <- combine_slurmConfig(slurm_options[1:3], "--tasks-per-node=12 --mem=32000") +if ("ar6Climate" %in% output) slurm_options <- paste(slurm_options[1:3], "--tasks-per-node=12 --mem=32000") # reporting.R, in particular remind2::convGDX2MIF, requires at least --mem=8000 of memory if ("reporting" %in% output) slurm_options <- grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE) From 9883c1dbe4a72df39d901858f77ede5551ca8d04 Mon Sep 17 00:00:00 2001 From: orichters <90761609+orichters@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:49:55 +0100 Subject: [PATCH 52/76] add fallback for missing magicc settings in cfg --- scripts/output/single/ar6Climate.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index c754753bd..ad1ddd5d9 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -97,6 +97,10 @@ capture.output(cat(logmsg), file = logFile, append = TRUE) # Read the cfg to get the location of MAGICC-related files cfg <- read_yaml(cfgPath) +if (is.null(cfg$climate_assessment_root)) cfg$climate_assessment_root <- "/p/projects/rd3mod/python/climate-assessment/src/" +if (is.null(cfg$climate_assessment_files_dir)) cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" +if (is.null(cfg$cfg$climate_assessment_magicc_bin)) cfg$climate_assessment_magicc_bin <- "/p/projects/rd3mod/climate-assessment-files/magicc-v7.5.3/bin/magicc" + # All climate-assessment files will be written to this folder climateAssessmentFolder <- normalizePath(file.path(outputdir, "climate-assessment-data")) dir.create(climateAssessmentFolder, showWarnings = FALSE) From 2ca85f69eb7cdeea48c6bb031230896414e00ca2 Mon Sep 17 00:00:00 2001 From: Renato-Rodrigues Date: Wed, 28 Feb 2024 11:12:38 +0100 Subject: [PATCH 53/76] fix reference scenario gdx to use the NPi run --- config/scenario_config_21_EU11_ECEMF.csv | 64 ++++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/config/scenario_config_21_EU11_ECEMF.csv b/config/scenario_config_21_EU11_ECEMF.csv index fa6505513..74f1fea3e 100644 --- a/config/scenario_config_21_EU11_ECEMF.csv +++ b/config/scenario_config_21_EU11_ECEMF.csv @@ -8,47 +8,47 @@ xx_DIAG-C400-lin;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapp # _____NZero_DIAG_scenario_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; xx_DIAG-NZero;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-NPI;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; # _____C400-lin_tech_constraint_scenarios_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -xx_DIAG-C400-lin-LimBio;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; -xx_DIAG-C400-lin-LimCCS;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 2000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; -xx_DIAG-C400-lin-LimNuclear;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-LimBio;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-LimCCS;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 2000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-LimNuclear;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; # _____C400-lin_DIAG_paradigm_shift_scenarios_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -xx_DIAG-C400-lin-HighVRE;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;;;2050.EUR_regi 0.7;;wind 2300, windoff 4700, spv 5060;wind 0.9, windoff 0.9, spv 0.9;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; -xx_DIAG-C400-lin-HighElectrification;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;elecPrice;;;;;wind 0.820125, windoff 0.91125, spv 0.95;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; -xx_DIAG-C400-lin-HighElec-Supply;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, 2050.EUR_regi.sub.t.SE.electricity 0.913;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; -xx_DIAG-C400-lin-HighH2;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;H2Price;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; -xx_DIAG-C400-lin-ResidualFossil;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;;highFossilPrice;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; -xx_DIAG-C400-lin-HighEff;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-C400-lin;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-HighVRE;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;2050.EUR_regi 0.7;;wind 2300, windoff 4700, spv 5060;wind 0.9, windoff 0.9, spv 0.9;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-HighElectrification;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;elecPrice;;;;;wind 0.820125, windoff 0.91125, spv 0.95;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-HighElec-Supply;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, 2050.EUR_regi.sub.t.SE.electricity 0.913;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-HighH2;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;H2Price;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-ResidualFossil;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;highFossilPrice;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; +xx_DIAG-C400-lin-HighEff;0,DIAG;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp26;;globallyOptimal;0;NPi;;;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-C400-lin;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;GLO.(2025 116,2030 196,2035 277,2040 357,2045 438,2050 518,2055 598,2060 679,2070 839,2080 1000,2090 1161,2100 1321,2110 1321,2130 1321,2150 1321);;;;; # _____NZero_scenario_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; xx_WP1_Nzero;0,WP1;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-NPI;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;; # _____NZero_tech_constraint_scenarios_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -xx_WP1_NZero-LimBio;0,WP1;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP1_NZero-LimCCS;0,WP1;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 2000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP1_NZero-LimNuclear;0,WP1;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; +xx_WP1_NZero-LimBio;0,WP1;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP1_NZero-LimCCS;0,WP1;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 2000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP1_NZero-LimNuclear;0,WP1;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; # _____WP5p3_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; xx_WP5_Base;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp45;3;;0;NPi;;;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;;;on;on;EUR_regi, NEU_regi;;;;;;;;;;3;;;;;;heat;Mix1;2005;;;;;same as xx_DIAG-NPI;;;;;;;;;;;1;; -xx_WP5_OPT-CP;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;;;;;;;;;;;;;; -xx_WP5_OPT-CP-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_OPT-CP;xx_WP5_OPT-CP;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_OPT-CP-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_OPT-CP;xx_WP5_OPT-CP;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_OPT-CP-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix3;2025;xx_WP5_OPT-CP;xx_WP5_OPT-CP;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; +xx_WP5_OPT-CP;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;;;;;;;;;;;;;; +xx_WP5_OPT-CP-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_OPT-CP;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_OPT-CP-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_OPT-CP;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_OPT-CP-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix3;2025;xx_WP5_OPT-CP;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; # xx_WP5_OPT-CP-LimRES;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -xx_WP5_OPT-REG;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;;;;;;;;;;;;;; -xx_WP5_OPT-REG-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_OPT-REG;xx_WP5_OPT-REG;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_OPT-REG-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_OPT-REG;xx_WP5_OPT-REG;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_OPT-REG-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_WP5_OPT-REG;xx_WP5_OPT-REG;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; +xx_WP5_OPT-REG;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;;;;;;;;;;;;;; +xx_WP5_OPT-REG-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_OPT-REG;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_OPT-REG-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_OPT-REG;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_OPT-REG-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.691, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_WP5_OPT-REG;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; # xx_WP5_OPT-REG-LimRES;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -xx_WP5_RAP-CP;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;;;;;;;;;;;;;; -xx_WP5_RAP-CP-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_RAP-CP;xx_WP5_RAP-CP;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_RAP-CP-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_RAP-CP;xx_WP5_RAP-CP;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_RAP-CP-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix3;2025;xx_WP5_RAP-CP;xx_WP5_RAP-CP;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; +xx_WP5_RAP-CP;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;;;;;;;;;;;;;; +xx_WP5_RAP-CP-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_RAP-CP;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_RAP-CP-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix3;2025;xx_WP5_RAP-CP;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_RAP-CP-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NPi2018;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix3;2025;xx_WP5_RAP-CP;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; # xx_WP5_RAP-CP-LimRES;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -xx_WP5_RAP-REG;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;;;;;;;;;;;;;; -xx_WP5_RAP-REG-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_RAP-REG;xx_WP5_RAP-REG;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_RAP-REG-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_RAP-REG;xx_WP5_RAP-REG;xx_DIAG-NPI;;;on;;;;;;;;;;;; -xx_WP5_RAP-REG-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_WP5_RAP-REG;xx_WP5_RAP-REG;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; +xx_WP5_RAP-REG;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;;;;;;;;;;;;;; +xx_WP5_RAP-REG-LimBio;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).GLO.tax.t.PE.biomass 3.17, (2035,2040,2045,2050).EUR_regi.tax.t.PE.biomass 0.22;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_RAP-REG;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_RAP-REG-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825, (2035,2040,2045,2050).GLO.tax.t.CCS.all 3000, (2035,2040,2045,2050).EUR_regi.tax.t.CCS.all 250;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP5_RAP-REG;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;;;;;;;;; +xx_WP5_RAP-REG-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_WP5_RAP-REG;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;; # xx_WP5_RAP-REG-LimRES;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # _____tests_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;35.43046358;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; test_WP1_Nzero_DEU;0,WP1;;testOneRegi;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-NPI;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;DEU;debug;1;1; -xx_WP1_Nzero_highPrecision_10tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.002 -xx_WP1_Nzero_highPrecision_5tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.001 -xx_WP1_Nzero_highPrecision_1tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.0002 -xx_WP1_Nzero_highPrecision_0p4tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_WP1_Nzero;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.00008 +xx_WP1_Nzero_highPrecision_10tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.002 +xx_WP1_Nzero_highPrecision_5tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.001 +xx_WP1_Nzero_highPrecision_1tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.0002 +xx_WP1_Nzero_highPrecision_0p4tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.00008 From f9fd5d1a3ec0ded017b445216ffac2c46a5db75d Mon Sep 17 00:00:00 2001 From: mleimbach Date: Wed, 28 Feb 2024 14:49:17 +0100 Subject: [PATCH 54/76] change of preference parameters --- core/datainput.gms | 9 +++++---- core/equations.gms | 4 ++-- core/postsolve.gms | 4 ++-- main.gms | 2 +- modules/23_capitalMarket/debt_limit/datainput.gms | 1 - 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index 79e6755af..2fb6eadc9 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -55,6 +55,7 @@ pm_ttot_2_tall(ttot,tall)$((ttot.val = tall.val) ) = Yes; *** define pm_prtp according to cm_prtpScen: if(cm_prtpScen eq 1, pm_prtp(regi) = 0.01); if(cm_prtpScen eq 3, pm_prtp(regi) = 0.03); +pm_ies(regi) = 0.5; *------------------------------------------------------------------------------------ *------------------------------------------------------------------------------------ @@ -272,16 +273,16 @@ $offdelim loop(te$(fm_dataglob("constrTme",te) > 0), p_tkpremused(regi,te) = 1/fm_dataglob("constrTme",te) * sum(integ$(integ.val <= fm_dataglob("constrTme",te)), -$if %cm_techcosts% == "REG" (1.03 + pm_prtp(regi) + p_risk_premium_constr(regi) ) ** (integ.val - 0.5) - 1 -$if %cm_techcosts% == "GLO" (1.03 + pm_prtp(regi) ) ** (integ.val - 0.5) - 1 +$if %cm_techcosts% == "REG" (1 + 0.02/pm_ies(regi) + pm_prtp(regi) + p_risk_premium_constr(regi) ) ** (integ.val - 0.5) - 1 +$if %cm_techcosts% == "GLO" (1 + 0.02/pm_ies(regi) + pm_prtp(regi) ) ** (integ.val - 0.5) - 1 ) ); *** nuclear sees 3% higher interest rates during construction time due to higher construction time risk, see "The economic future of nuclear power - A study conducted at The University of Chicago" (2004) loop(te$sameas(te,"tnrs"), p_tkpremused(regi,te) = 1/fm_dataglob("constrTme",te) * sum(integ$(integ.val <= fm_dataglob("constrTme",te)), -$if %cm_techcosts% == "REG" (1.03 + 0.03 + pm_prtp(regi) + p_risk_premium_constr(regi) ) ** (integ.val - 0.5) - 1 -$if %cm_techcosts% == "GLO" (1.03 + 0.03 + pm_prtp(regi) ) ** (integ.val - 0.5) - 1 +$if %cm_techcosts% == "REG" (1 + 0.02/pm_ies(regi) + 0.03 + pm_prtp(regi) + p_risk_premium_constr(regi) ) ** (integ.val - 0.5) - 1 +$if %cm_techcosts% == "GLO" (1 + 0.02/pm_ies(regi) + 0.03 + pm_prtp(regi) ) ** (integ.val - 0.5) - 1 ) ); diff --git a/core/equations.gms b/core/equations.gms index 7b6b75f22..41f694a2c 100644 --- a/core/equations.gms +++ b/core/equations.gms @@ -57,7 +57,7 @@ q_costInvTeDir(t,regi,te).. =e= vm_costTeCapital(t,regi,te) * sum(te2rlf(te,rlf), vm_deltaCap(t,regi,te,rlf)) - * (1.02 + pm_prtp(regi) ) ** (pm_ts(t) / 2) !! This increases the investments as if the money was actually borrowed + * (1 + 0.02/pm_ies(regi) + pm_prtp(regi) ) ** (pm_ts(t) / 2) !! This increases the investments as if the money was actually borrowed !! half a time step earlier, using an interest rate of pm_prtp + 2%, which is close to the model-endogenous interest rate. !! We do this to reduce the difference to the previous version where the effect of deltacap on capacity was split !! half to the current and half to the next time. @@ -74,7 +74,7 @@ q_costInvTeAdj(t,regi,teAdj).. vm_costTeCapital(t,regi,teAdj) * ( (p_adj_coeff(t,regi,teAdj) * v_adjFactor(t,regi,teAdj)) + (p_adj_coeff_glob(teAdj) * v_adjFactorGlob(t,regi,teAdj)) ) - * (1.02 + pm_prtp(regi) ) ** (pm_ts(t) / 2) !! This increases the investments as if the money was actually borrowed + * (1 + 0.02/pm_ies(regi) + pm_prtp(regi) ) ** (pm_ts(t) / 2) !! This increases the investments as if the money was actually borrowed !! half a time step earlier, using an interest rate of pm_prtp + 2%, which is close to the model-endogenous interest rate. !! We do this to reduce the difference to the previous version where the effect of deltacap on capacity was split !! half to the current and half to the next time. diff --git a/core/postsolve.gms b/core/postsolve.gms index 5e0d05fdf..4629b012d 100644 --- a/core/postsolve.gms +++ b/core/postsolve.gms @@ -603,7 +603,7 @@ o_margAdjCostInv(ttot,regi,te)$(ttot.val ge max(2010, cm_startyear) AND teAdj(te + p_adj_deltacapoffset("2010",regi,te)$(ttot.val eq 2010) + p_adj_deltacapoffset("2015",regi,te)$(ttot.val eq 2015) + p_adj_deltacapoffset("2020",regi,te)$(ttot.val eq 2020) + p_adj_deltacapoffset("2025",regi,te)$(ttot.val eq 2025) ) - * (1.02 + pm_prtp(regi)) ** (pm_ts(ttot) / 2) + * (1 + 0.02/pm_ies(regi) + pm_prtp(regi)) ** (pm_ts(ttot) / 2) ; *** CG: calculate average adjustment cost for capacity investment: vm_costInvTeAdj / vm_deltaCap @@ -850,7 +850,7 @@ o_carbon_reemitted(ttot,regi,"co2")$(ttot.val ge 2005) = *CG**ML*: capital interest rate p_r(ttot,regi)$(ttot.val gt 2005 and ttot.val le 2130) - = (( (vm_cons.l(ttot+1,regi)/pm_pop(ttot+1,regi)) / + = 1 / pm_ies(regi) * (( (vm_cons.l(ttot+1,regi)/pm_pop(ttot+1,regi)) / (vm_cons.l(ttot-1,regi)/pm_pop(ttot-1,regi)) ) ** (1 / ( pm_ttot_val(ttot+1)- pm_ttot_val(ttot-1))) - 1) + pm_prtp(regi) ; diff --git a/main.gms b/main.gms index 41585e778..5cce7c466 100755 --- a/main.gms +++ b/main.gms @@ -658,7 +658,7 @@ parameter parameter cm_prtpScen "pure rate of time preference standard values" ; - cm_prtpScen = 3; !! def = 3 !! regexp = 1|3 + cm_prtpScen = 1; !! def = 3 !! regexp = 1|3 *' * (1): 1 % *' * (3): 3 % *' diff --git a/modules/23_capitalMarket/debt_limit/datainput.gms b/modules/23_capitalMarket/debt_limit/datainput.gms index 5ef32599c..2b3c8361c 100644 --- a/modules/23_capitalMarket/debt_limit/datainput.gms +++ b/modules/23_capitalMarket/debt_limit/datainput.gms @@ -6,7 +6,6 @@ *** | Contact: remind@pik-potsdam.de *** SOF ./modules/23_capitalMarket/debt_limit/datainput.gms -pm_ies(regi) = 1; pm_risk_premium(regi) = 0.0; p23_debt_growthCoeff(regi) = 0.2 ; From 6028310a7dfc35138dfa64933e30af4167037d11 Mon Sep 17 00:00:00 2001 From: mleimbach Date: Wed, 28 Feb 2024 14:58:22 +0100 Subject: [PATCH 55/76] update change.log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdd488ba3..346ba00b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **core** add process emissions from chemicals subsector and from plastics incineration - **37_industry** add process-based steel model as alternative to CES-tree branch - **47_regipol** add support for delaying quantity targets and improving regional emission tax convergence +- **core** change of preference parameters and associated computation of interest rates/mark ups ### fixed - fixed weights of energy carriers in `pm_IndstCO2Captured` From 6fa1a912275a8b8ea3241ce92772f40dcb3368f1 Mon Sep 17 00:00:00 2001 From: orichters Date: Wed, 28 Feb 2024 12:51:17 +0100 Subject: [PATCH 56/76] add make test-full-slurm, adjust minimal data length in coupled tests --- DESCRIPTION | 2 +- Makefile | 4 ++++ tests/testthat/test_20-coupled.R | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9d8dd29c3..ed5811928 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,7 +59,7 @@ Imports: raster, readr, readxl, - remind2 (>= 1.125.0), + remind2 (>= 1.135.6), renv, reshape2, reticulate, diff --git a/Makefile b/Makefile index 40e276964..2caec1cdb 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,10 @@ test-full: ## Run all tests, including coupling tests and a default $(info Full tests take more than an hour to run, please be patient) @TESTTHAT_RUN_SLOW=TRUE Rscript -e 'testthat::test_dir("tests/testthat")' +test-full-slurm: ##test-full, but on slurm + $(info Full tests take more than an hour to run, please be patient) + @sbatch --qos=priority --wrap="make test-full" --job-name=test-full --mail-type=END --output=test-full.log --comment="test-full.log" + test-validation: ## Run validation tests, requires a full set of runs in the output folder $(info Run validation tests, requires a full set of runs in the output folder) @TESTTHAT_RUN_SLOW=TRUE Rscript -e 'testthat::test_dir("tests/testthat/validation")' diff --git a/tests/testthat/test_20-coupled.R b/tests/testthat/test_20-coupled.R index c58c6e142..21fb15216 100644 --- a/tests/testthat/test_20-coupled.R +++ b/tests/testthat/test_20-coupled.R @@ -138,12 +138,12 @@ test_that("runs coupled to MAgPIE work", { expect_true(any(grepl("^REMIND", levels(qscen$model)))) expect_false(any(grepl("^MAgPIE", levels(qscen$model)))) lengthwithoutmag <- nrow(qscen) - expect_true(lengthwithoutmag > 70000) + expect_true(lengthwithoutmag > 600000) qscen <- quitte::as.quitte(paste0("../../output/C_", scen, "-rem-", max_iterations, "/REMIND_generic_C_", scen, "-rem-", max_iterations, ".mif")) expect_true(any(grepl("^REMIND", levels(qscen$model)))) expect_true(any(grepl("^MAgPIE", levels(qscen$model)))) lengthwithmag <- nrow(qscen) - expect_true(lengthwithmag > lengthwithoutmag) + expect_true(lengthwithmag > lengthwithoutmag && lengthwithmag > 700000) qscen <- quitte::as.quitte(paste0("../../output/C_", scen, "-rem-1/REMIND_generic_C_", scen, "-rem-1.mif")) # check main mif qscen <- quitte::as.quitte(paste0("../../output/C_", scen, ".mif")) From c55d667a2754c93da8d993c37551d0a691841f42 Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Wed, 28 Feb 2024 14:43:51 +0000 Subject: [PATCH 57/76] Release development version 3.2.1.dev1135 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index aada8f1e5..b76260924 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1128" +version: "3.2.1.dev1135" date-released: 2024-02-28 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index 39957fd61..8e6ac91d1 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -63,7 +63,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1128" +cfg$model_version <- "3.2.1.dev1135" #### settings #### cfg$gms <- list() From 3bf25eafd08d86856c1c31a917ec76232a757a11 Mon Sep 17 00:00:00 2001 From: mleimbach Date: Wed, 28 Feb 2024 15:54:30 +0100 Subject: [PATCH 58/76] change default for cm_prtp --- main.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.gms b/main.gms index 5cce7c466..58c869b50 100755 --- a/main.gms +++ b/main.gms @@ -658,7 +658,7 @@ parameter parameter cm_prtpScen "pure rate of time preference standard values" ; - cm_prtpScen = 1; !! def = 3 !! regexp = 1|3 + cm_prtpScen = 1; !! def = 1 !! regexp = 1|3 *' * (1): 1 % *' * (3): 3 % *' From eaf84e72a56bdb4f960f7529a1a550bb5a698bab Mon Sep 17 00:00:00 2001 From: Michaja Pehl Date: Wed, 28 Feb 2024 17:06:58 +0100 Subject: [PATCH 59/76] restrict temporal extent of industry feedstock equations --- modules/37_industry/subsectors/equations.gms | 66 +++++++++----------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/modules/37_industry/subsectors/equations.gms b/modules/37_industry/subsectors/equations.gms index efab8e809..b34db61da 100644 --- a/modules/37_industry/subsectors/equations.gms +++ b/modules/37_industry/subsectors/equations.gms @@ -213,50 +213,50 @@ q37_chemicals_feedstocks_limit(t,regi)$( t.val ge cm_startyear ) .. ; *' Define the flow of non-energy feedstocks. It is used for emissions accounting and calculating plastics production -q37_demFeFeedstockChemIndst(ttot,regi,entyFe,emiMkt)$( - ttot.val ge cm_startyear +q37_demFeFeedstockChemIndst(t,regi,entyFe,emiMkt)$( + t.val ge cm_startyear AND entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. sum(se2fe(entySe,entyFe,te), - vm_demFENonEnergySector(ttot,regi,entySe,entyFe,"indst",emiMkt) + vm_demFENonEnergySector(t,regi,entySe,entyFe,"indst",emiMkt) ) =e= sum((fe2ppfEn(entyFe,ppfen_industry_dyn37(in)), secInd37_emiMkt(secInd37,emiMkt), secInd37_2_pf(secInd37,in_chemicals_feedstock_37(in))), - ( vm_cesIO(ttot,regi,in) - + pm_cesdata(ttot,regi,in,"offset_quantity") + ( vm_cesIO(t,regi,in) + + pm_cesdata(t,regi,in,"offset_quantity") ) - * p37_chemicals_feedstock_share(ttot,regi) + * p37_chemicals_feedstock_share(t,regi) ) ; *' Feedstocks flow has to be lower than total energy flow into the industry -q37_feedstocksLimit(ttot,regi,entySe,entyFe,emiMkt)$( - ttot.val ge cm_startyear +q37_feedstocksLimit(t,regi,entySe,entyFe,emiMkt)$( + t.val ge cm_startyear AND sefe(entySe,entyFe) AND sector2emiMkt("indst",emiMkt) AND entyFe2Sector(entyFe,"indst") AND entyFeCC37(entyFe) ) .. - vm_demFeSector(ttot,regi,entySe,entyFe,"indst",emiMkt) + vm_demFeSector(t,regi,entySe,entyFe,"indst",emiMkt) =g= - vm_demFENonEnergySector(ttot,regi,entySe,entyFe,"indst",emiMkt) + vm_demFENonEnergySector(t,regi,entySe,entyFe,"indst",emiMkt) ; *' Calculate mass of carbon contained in chemical feedstocks -q37_FeedstocksCarbon(ttot,regi,sefe(entySe,entyFe),emiMkt)$( +q37_FeedstocksCarbon(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. - vm_FeedstocksCarbon(ttot,regi,entySe,entyFe,emiMkt) + vm_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) =e= - vm_demFENonEnergySector(ttot,regi,entySe,entyFe,"indst",emiMkt) - * p37_FeedstockCarbonContent(ttot,regi,entyFe) + vm_demFENonEnergySector(t,regi,entySe,entyFe,"indst",emiMkt) + * p37_FeedstockCarbonContent(t,regi,entyFe) ; *' Calculate carbon contained in plastics as a share of carbon in feedstock [GtC] -q37_plasticsCarbon(ttot,regi,sefe(entySe,entyFe),emiMkt)$( +q37_plasticsCarbon(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. - vm_plasticsCarbon(ttot,regi,entySe,entyFe,emiMkt) + vm_plasticsCarbon(t,regi,entySe,entyFe,emiMkt) =e= - vm_FeedstocksCarbon(ttot,regi,entySe,entyFe,emiMkt) + vm_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) * s37_plasticsShare ; @@ -264,8 +264,8 @@ q37_plasticsCarbon(ttot,regi,sefe(entySe,entyFe),emiMkt)$( *' shift by 2 time steps when we have 5-year steps and 1 when we have 10-year steps *' allocate averge of 2055 and 2060 to 2070 q37_plasticWaste(ttot,regi,sefe(entySe,entyFe),emiMkt)$( - entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) - AND ttot.val ge cm_startyear ) .. + entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) + AND ttot.val ge max(2015, cm_startyear) ) .. vm_plasticWaste(ttot,regi,entySe,entyFe,emiMkt) =e= vm_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt)$( ttot.val le 2060 ) @@ -277,37 +277,33 @@ q37_plasticWaste(ttot,regi,sefe(entySe,entyFe),emiMkt)$( + vm_plasticsCarbon(ttot-1,regi,entySe,entyFe,emiMkt)$( ttot.val gt 2070 ) ; -*' plastic waste in the past is not accounted for -vm_plasticWaste.fx(ttot,regi,sefe(entySe,entyFe),emiMkt)$( ttot.val lt 2005 ) = 0 ; -vm_plasticsCarbon.fx(ttot,regi,sefe(entySe,entyFe),emiMkt)$( ttot.val lt 2005 ) = 0 ; - *' emissions from plastics incineration as a share of total plastic waste -q37_incinerationEmi(ttot,regi,sefe(entySe,entyFe),emiMkt)$( +q37_incinerationEmi(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt)) .. - vm_incinerationEmi(ttot,regi,entySe,entyFe,emiMkt) + vm_incinerationEmi(t,regi,entySe,entyFe,emiMkt) =e= - vm_plasticWaste(ttot,regi,entySe,entyFe,emiMkt) - * pm_incinerationRate(ttot,regi) + vm_plasticWaste(t,regi,entySe,entyFe,emiMkt) + * pm_incinerationRate(t,regi) ; *' calculate carbon contained in non-incinerated plastics *' this is used in emissions accounting to subtract the carbon that gets *' sequestered in plastic products -q37_nonIncineratedPlastics(ttot,regi,sefe(entySe,entyFe),emiMkt)$( +q37_nonIncineratedPlastics(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. - vm_nonIncineratedPlastics(ttot,regi,entySe,entyFe,emiMkt) + vm_nonIncineratedPlastics(t,regi,entySe,entyFe,emiMkt) =e= - vm_plasticWaste(ttot,regi,entySe,entyFe,emiMkt) - * (1 - pm_incinerationRate(ttot,regi)) - ; + vm_plasticWaste(t,regi,entySe,entyFe,emiMkt) + * (1 - pm_incinerationRate(t,regi)) +; *' calculate flow of carbon contained in chemical feedstock with unknown fate *' it is assumed that this carbon is re-emitted in the same timestep -q37_feedstockEmiUnknownFate(ttot,regi,sefe(entySe,entyFe),emiMkt)$( +q37_feedstockEmiUnknownFate(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. - vm_feedstockEmiUnknownFate(ttot,regi,entySe,entyFe,emiMkt) + vm_feedstockEmiUnknownFate(t,regi,entySe,entyFe,emiMkt) =e= - vm_FeedstocksCarbon(ttot,regi,entySe,entyFe,emiMkt) + vm_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) * (1 - s37_plasticsShare) ; From 6d3fecc82b6532245e2be3cbe31f0f62770ebf4a Mon Sep 17 00:00:00 2001 From: Michaja Pehl Date: Wed, 28 Feb 2024 17:33:58 +0100 Subject: [PATCH 60/76] restrict temporal extent of all industry equations --- modules/37_industry/subsectors/equations.gms | 175 +++++++++---------- 1 file changed, 87 insertions(+), 88 deletions(-) diff --git a/modules/37_industry/subsectors/equations.gms b/modules/37_industry/subsectors/equations.gms index b34db61da..54950b0ef 100644 --- a/modules/37_industry/subsectors/equations.gms +++ b/modules/37_industry/subsectors/equations.gms @@ -13,17 +13,16 @@ ***------------------------------------------------------ *' Industry final energy balance ***------------------------------------------------------ -q37_demFeIndst(ttot,regi,entyFe,emiMkt)$( ttot.val ge cm_startyear - AND entyFe2Sector(entyFe,"indst") ) .. +q37_demFeIndst(t,regi,entyFe,emiMkt)$( entyFe2Sector(entyFe,"indst") ) .. sum(se2fe(entySe,entyFe,te), - vm_demFeSector_afterTax(ttot,regi,entySe,entyFe,"indst",emiMkt) + vm_demFeSector_afterTax(t,regi,entySe,entyFe,"indst",emiMkt) ) =e= sum(fe2ppfEn(entyFe,ppfen_industry_dyn37(in)), sum((secInd37_emiMkt(secInd37,emiMkt),secInd37_2_pf(secInd37,in)), ( - vm_cesIO(ttot,regi,in) - + pm_cesdata(ttot,regi,in,"offset_quantity") + vm_cesIO(t,regi,in) + + pm_cesdata(t,regi,in,"offset_quantity") )$(NOT secInd37Prc(secInd37)) ) ) @@ -31,9 +30,9 @@ q37_demFeIndst(ttot,regi,entyFe,emiMkt)$( ttot.val ge cm_startyear sum((secInd37_emiMkt(secInd37Prc,emiMkt), secInd37_tePrc(secInd37Prc,tePrc), tePrc2opmoPrc(tePrc,opmoPrc)), - pm_specFeDem(ttot,regi,entyFe,tePrc,opmoPrc) + pm_specFeDem(t,regi,entyFe,tePrc,opmoPrc) * - vm_outflowPrc(ttot,regi,tePrc,opmoPrc) + vm_outflowPrc(t,regi,tePrc,opmoPrc) ) ; @@ -41,39 +40,37 @@ q37_demFeIndst(ttot,regi,entyFe,emiMkt)$( ttot.val ge cm_startyear *' Thermodynamic limits on subsector energy demand ***------------------------------------------------------ $ifthen.no_calibration "%CES_parameters%" == "load" !! CES_parameters -q37_energy_limits(ttot,regi,industry_ue_calibration_target_dyn37(out))$( - ttot.val gt 2020 - AND NOT ppfUePrc(out) - AND p37_energy_limit_slope(ttot,regi,out) ) .. - sum(ces_eff_target_dyn37(out,in), vm_cesIO(ttot,regi,in)) +q37_energy_limits(t,regi,industry_ue_calibration_target_dyn37(out))$( + t.val gt 2020 + AND NOT ppfUePrc(out) + AND p37_energy_limit_slope(t,regi,out) ) .. + sum(ces_eff_target_dyn37(out,in), vm_cesIO(t,regi,in)) =g= - vm_cesIO(ttot,regi,out) - * p37_energy_limit_slope(ttot,regi,out) + vm_cesIO(t,regi,out) + * p37_energy_limit_slope(t,regi,out) ; $endif.no_calibration ***------------------------------------------------------ *' Limit the share of secondary steel to historic values, fading to 90 % in 2050 ***------------------------------------------------------ -q37_limit_secondary_steel_share(ttot,regi)$( - ttot.val ge cm_startyear - +q37_limit_secondary_steel_share(t,regi)$( + YES $ifthen.fixed_production "%cm_import_EU%" == "bal" !! cm_import_EU !! do not limit steel production shares for fixed production - AND p37_industry_quantity_targets(ttot,regi,"ue_steel_secondary") eq 0 + AND p37_industry_quantity_targets(t,regi,"ue_steel_secondary") eq 0 $endif.fixed_production $ifthen.exogDem_scen NOT "%cm_exogDem_scen%" == "off" !! do not limit steel production shares for fixed production - AND pm_exogDemScen(ttot,regi,"%cm_exogDem_scen%","ue_steel_secondary") eq 0 + AND pm_exogDemScen(t,regi,"%cm_exogDem_scen%","ue_steel_secondary") eq 0 $endif.exogDem_scen - ) .. - vm_cesIO(ttot,regi,"ue_steel_secondary") + vm_cesIO(t,regi,"ue_steel_secondary") =l= - ( vm_cesIO(ttot,regi,"ue_steel_primary") - + vm_cesIO(ttot,regi,"ue_steel_secondary") + ( vm_cesIO(t,regi,"ue_steel_primary") + + vm_cesIO(t,regi,"ue_steel_secondary") ) - * p37_steel_secondary_max_share(ttot,regi) + * p37_steel_secondary_max_share(t,regi) ; ***------------------------------------------------------ @@ -82,23 +79,23 @@ $endif.exogDem_scen *' energy mix, as that is what can be captured); vm_emiIndBase itself is not used for emission *' accounting, just as a CCS baseline. ***------------------------------------------------------ -q37_emiIndBase(ttot,regi,entyFe,secInd37)$( ttot.val ge cm_startyear ) .. - vm_emiIndBase(ttot,regi,entyFe,secInd37) +q37_emiIndBase(t,regi,entyFe,secInd37) .. + vm_emiIndBase(t,regi,entyFe,secInd37) =e= sum((secInd37_2_pf(secInd37,ppfen_industry_dyn37(in)),fe2ppfEn(entyFeCC37(entyFe),in)), - ( vm_cesIO(ttot,regi,in) - - ( p37_chemicals_feedstock_share(ttot,regi) - * vm_cesIO(ttot,regi,in) + ( vm_cesIO(t,regi,in) + - ( p37_chemicals_feedstock_share(t,regi) + * vm_cesIO(t,regi,in) )$( in_chemicals_feedstock_37(in) ) ) * sum(se2fe(entySeFos,entyFe,te), - pm_emifac(ttot,regi,entySeFos,entyFe,te,"co2") + pm_emifac(t,regi,entySeFos,entyFe,te,"co2") ) )$(NOT secInd37Prc(secInd37)) + sum((secInd37_tePrc(secInd37,tePrc),tePrc2opmoPrc(tePrc,opmoPrc)), - v37_emiPrc(ttot,regi,entyFe,tePrc,opmoPrc) + v37_emiPrc(t,regi,entyFe,tePrc,opmoPrc) )$(secInd37Prc(secInd37)) ; @@ -106,8 +103,9 @@ q37_emiIndBase(ttot,regi,entyFe,secInd37)$( ttot.val ge cm_startyear ) .. *' Compute maximum possible CCS level in industry sub-sectors given the current *' CO2 price. ***------------------------------------------------------ -q37_emiIndCCSmax(ttot,regi,emiInd37)$( ttot.val ge cm_startyear AND NOT sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. - v37_emiIndCCSmax(ttot,regi,emiInd37) +q37_emiIndCCSmax(t,regi,emiInd37)$( + NOT sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. + v37_emiIndCCSmax(t,regi,emiInd37) =e= !! map sub-sector emissions to sub-sector MACs !! otherInd has no CCS, therefore no MAC, cement has both fuel and process @@ -116,29 +114,30 @@ q37_emiIndCCSmax(ttot,regi,emiInd37)$( ttot.val ge cm_startyear AND NOT sum(secI !! add cement process emissions, which are calculated in core/preloop !! from a econometric fit and might not correspond to energy use (FIXME) ( sum((secInd37_2_emiInd37(secInd37,emiInd37),entyFe), - vm_emiIndBase(ttot,regi,entyFe,secInd37) + vm_emiIndBase(t,regi,entyFe,secInd37) )$( NOT sameas(emiInd37,"co2cement_process") ) - + ( vm_emiIndBase(ttot,regi,"co2cement_process","cement") + + ( vm_emiIndBase(t,regi,"co2cement_process","cement") )$( sameas(emiInd37,"co2cement_process") ) ) * pm_macSwitch(macInd37) !! sub-sector CCS available or not - * pm_macAbatLev(ttot,regi,macInd37) !! abatement level at current price + * pm_macAbatLev(t,regi,macInd37) !! abatement level at current price ) ; ***------------------------------------------------------ *' Limit industry CCS to maximum possible CCS level. ***------------------------------------------------------ -q37_IndCCS(ttot,regi,emiInd37)$( ttot.val ge cm_startyear AND NOT sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. - vm_emiIndCCS(ttot,regi,emiInd37) +q37_IndCCS(t,regi,emiInd37)$( + NOT sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. + vm_emiIndCCS(t,regi,emiInd37) =l= - v37_emiIndCCSmax(ttot,regi,emiInd37) + v37_emiIndCCSmax(t,regi,emiInd37) ; ***------------------------------------------------------ *' Limit industry CCS scale-up to sm_macChange (default: 5 % p.a.) ***------------------------------------------------------ -q37_limit_IndCCS_growth(ttot,regi,emiInd37) .. +q37_limit_IndCCS_growth(ttot,regi,emiInd37)$( ttot.val ge cm_startyear ) .. vm_emiIndCCS(ttot,regi,emiInd37) =l= vm_emiIndCCS(ttot-1,regi,emiInd37) @@ -152,39 +151,39 @@ q37_limit_IndCCS_growth(ttot,regi,emiInd37) .. ***------------------------------------------------------ *' Fix cement fuel and cement process emissions to the same abatement level. ***------------------------------------------------------ -q37_cementCCS(ttot,regi)$( ttot.val ge cm_startyear - AND pm_macSwitch("co2cement") - AND pm_macAbatLev(ttot,regi,"co2cement") ) .. - vm_emiIndCCS(ttot,regi,"co2cement") - * v37_emiIndCCSmax(ttot,regi,"co2cement_process") +q37_cementCCS(t,regi)$( pm_macSwitch("co2cement") + AND pm_macAbatLev(t,regi,"co2cement") ) .. + vm_emiIndCCS(t,regi,"co2cement") + * v37_emiIndCCSmax(t,regi,"co2cement_process") =e= - vm_emiIndCCS(ttot,regi,"co2cement_process") - * v37_emiIndCCSmax(ttot,regi,"co2cement") + vm_emiIndCCS(t,regi,"co2cement_process") + * v37_emiIndCCSmax(t,regi,"co2cement") ; ***------------------------------------------------------ *' Calculate industry CCS costs. ***------------------------------------------------------ -q37_IndCCSCost(ttot,regi,emiInd37)$( ttot.val ge cm_startyear AND NOT sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. - vm_IndCCSCost(ttot,regi,emiInd37) +q37_IndCCSCost(t,regi,emiInd37)$( + NOT sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. + vm_IndCCSCost(t,regi,emiInd37) =e= 1e-3 * pm_macSwitch(emiInd37) * ( sum((enty,secInd37_2_emiInd37(secInd37,emiInd37)), - vm_emiIndBase(ttot,regi,enty,secInd37) + vm_emiIndBase(t,regi,enty,secInd37) )$( NOT sameas(emiInd37,"co2cement_process") ) - + ( vm_emiIndBase(ttot,regi,"co2cement_process","cement") + + ( vm_emiIndBase(t,regi,"co2cement_process","cement") )$( sameas(emiInd37,"co2cement_process") ) ) * sm_dmac * sum(emiMac2mac(emiInd37,enty), - ( pm_macStep(ttot,regi,enty) - * sum(steps$( ord(steps) eq pm_macStep(ttot,regi,enty) ), - pm_macAbat(ttot,regi,enty,steps) + ( pm_macStep(t,regi,enty) + * sum(steps$( ord(steps) eq pm_macStep(t,regi,enty) ), + pm_macAbat(t,regi,enty,steps) ) ) - - sum(steps$( ord(steps) le pm_macStep(ttot,regi,enty) ), - pm_macAbat(ttot,regi,enty,steps) + - sum(steps$( ord(steps) le pm_macStep(t,regi,enty) ), + pm_macAbat(t,regi,enty,steps) ) ) ; @@ -205,7 +204,7 @@ q37_costCESmarkup(t,regi,in)$(ppfen_industry_dyn37(in)).. ***-------------------------------------------------------------------------- *' Lower bound on feso/feli/fega in chemicals FE input for feedstocks -q37_chemicals_feedstocks_limit(t,regi)$( t.val ge cm_startyear ) .. +q37_chemicals_feedstocks_limit(t,regi) .. sum(in_chemicals_feedstock_37(in), vm_cesIO(t,regi,in)) =g= sum(ces_eff_target_dyn37("ue_chemicals",in), vm_cesIO(t,regi,in)) @@ -214,8 +213,7 @@ q37_chemicals_feedstocks_limit(t,regi)$( t.val ge cm_startyear ) .. *' Define the flow of non-energy feedstocks. It is used for emissions accounting and calculating plastics production q37_demFeFeedstockChemIndst(t,regi,entyFe,emiMkt)$( - t.val ge cm_startyear - AND entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. + entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. sum(se2fe(entySe,entyFe,te), vm_demFENonEnergySector(t,regi,entySe,entyFe,"indst",emiMkt) ) @@ -232,8 +230,7 @@ q37_demFeFeedstockChemIndst(t,regi,entyFe,emiMkt)$( *' Feedstocks flow has to be lower than total energy flow into the industry q37_feedstocksLimit(t,regi,entySe,entyFe,emiMkt)$( - t.val ge cm_startyear - AND sefe(entySe,entyFe) + sefe(entySe,entyFe) AND sector2emiMkt("indst",emiMkt) AND entyFe2Sector(entyFe,"indst") AND entyFeCC37(entyFe) ) .. @@ -268,7 +265,7 @@ q37_plasticWaste(ttot,regi,sefe(entySe,entyFe),emiMkt)$( AND ttot.val ge max(2015, cm_startyear) ) .. vm_plasticWaste(ttot,regi,entySe,entyFe,emiMkt) =e= - vm_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt)$( ttot.val le 2060 ) + vm_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt)$( ttot.val lt 2070 ) + ( ( vm_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt) + vm_plasticsCarbon(ttot-1,regi,entySe,entyFe,emiMkt) ) @@ -326,103 +323,105 @@ q37_FossilFeedstock_Base(t,regi,entyFe,emiMkt)$( ***------------------------------------------------------ *' Material input to production ***------------------------------------------------------ -q37_demMatPrc(ttot,regi,mat)$((ttot.val ge cm_startyear) AND matIn(mat)).. - v37_matFlow(ttot,regi,mat) +q37_demMatPrc(t,regi,mat)$( matIn(mat) ) .. + v37_matFlow(t,regi,mat) =e= sum(tePrc2matIn(tePrc,opmoPrc,mat), p37_specMatDem(mat,tePrc,opmoPrc) * - vm_outflowPrc(ttot,regi,tePrc,opmoPrc) + vm_outflowPrc(t,regi,tePrc,opmoPrc) ) ; ***------------------------------------------------------ *' Material cost ***------------------------------------------------------ -q37_costMat(ttot,regi)$(ttot.val ge cm_startyear).. - vm_costMatPrc(ttot,regi) +q37_costMat(t,regi) .. + vm_costMatPrc(t,regi) =e= sum(mat, p37_priceMat(mat) * - v37_matFlow(ttot,regi,mat)) + v37_matFlow(t,regi,mat)) ; ***------------------------------------------------------ *' Output material production ***------------------------------------------------------ -q37_prodMat(ttot,regi,mat)$((ttot.val ge cm_startyear) AND matOut(mat)).. - v37_matFlow(ttot,regi,mat) +q37_prodMat(t,regi,mat)$( matOut(mat) ) .. + v37_matFlow(t,regi,mat) =e= sum(tePrc2matOut(tePrc,opmoPrc,mat), - vm_outflowPrc(ttot,regi,tePrc,opmoPrc) + vm_outflowPrc(t,regi,tePrc,opmoPrc) ) ; ***------------------------------------------------------ *' Hand-over to CES ***------------------------------------------------------ -q37_mat2ue(ttot,regi,all_in)$((ttot.val ge cm_startyear) AND ppfUePrc(all_in)).. - vm_cesIO(ttot,regi,all_in) +q37_mat2ue(t,regi,all_in)$( ppfUePrc(all_in) ) .. + vm_cesIO(t,regi,all_in) =e= sum(mat2ue(mat,all_in), p37_mat2ue(mat,all_in) * - v37_matFlow(ttot,regi,mat) + v37_matFlow(t,regi,mat) ) ; ***------------------------------------------------------ *' Definition of capacity constraints ***------------------------------------------------------ -q37_limitCapMat(ttot,regi,tePrc)$(ttot.val ge cm_startyear) .. +q37_limitCapMat(t,regi,tePrc) .. sum(tePrc2opmoPrc(tePrc,opmoPrc), - vm_outflowPrc(ttot,regi,tePrc,opmoPrc) + vm_outflowPrc(t,regi,tePrc,opmoPrc) ) =l= sum(teMat2rlf(tePrc,rlf), - vm_capFac(ttot,regi,tePrc) * vm_cap(ttot,regi,tePrc,rlf) + vm_capFac(t,regi,tePrc) + * vm_cap(t,regi,tePrc,rlf) ) ; ***------------------------------------------------------ *' Emission from process based industry sector (pre CC) ***------------------------------------------------------ -q37_emiPrc(ttot,regi,entyFe,tePrc,opmoPrc)$(ttot.val ge cm_startyear ) .. - v37_emiPrc(ttot,regi,entyFe,tePrc,opmoPrc) +q37_emiPrc(t,regi,entyFe,tePrc,opmoPrc) .. + v37_emiPrc(t,regi,entyFe,tePrc,opmoPrc) =e= - pm_specFeDem(ttot,regi,entyFe,tePrc,opmoPrc) + pm_specFeDem(t,regi,entyFe,tePrc,opmoPrc) * sum(se2fe(entySeFos,entyFe,te), - pm_emifac(ttot,regi,entySeFos,entyFe,te,"co2")) + pm_emifac(t,regi,entySeFos,entyFe,te,"co2")) * - vm_outflowPrc(ttot,regi,tePrc,opmoPrc) + vm_outflowPrc(t,regi,tePrc,opmoPrc) ; ***------------------------------------------------------ *' Carbon capture processes can only capture as much co2 as the base process emits ***------------------------------------------------------ -q37_limitOutflowCCPrc(ttot,regi,tePrc)$(ttot.val ge cm_startyear ) .. +q37_limitOutflowCCPrc(t,regi,tePrc) .. sum((entyFe,tePrc2opmoPrc(tePrc,opmoPrc)), - v37_emiPrc(ttot,regi,entyFe,tePrc,opmoPrc)) + v37_emiPrc(t,regi,entyFe,tePrc,opmoPrc)) =g= sum(tePrc2teCCPrc(tePrc,opmoPrc,teCCPrc,opmoCCPrc), 1. / p37_captureRate(teCCPrc,opmoCCPrc) * - vm_outflowPrc(ttot,regi,teCCPrc,opmoCCPrc) + vm_outflowPrc(t,regi,teCCPrc,opmoCCPrc) ) ; ***------------------------------------------------------ *' Emission captured from process based industry sector ***------------------------------------------------------ -q37_emiCCPrc(ttot,regi,emiInd37)$((ttot.val ge cm_startyear ) AND sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. - vm_emiIndCCS(ttot,regi,emiInd37) +q37_emiCCPrc(t,regi,emiInd37)$( + sum(secInd37Prc,secInd37_2_emiInd37(secInd37Prc,emiInd37)) ) .. + vm_emiIndCCS(t,regi,emiInd37) =e= sum((secInd37_2_emiInd37(secInd37Prc,emiInd37), secInd37_tePrc(secInd37Prc,tePrc), tePrc2teCCPrc(tePrc,opmoPrc,teCCPrc,opmoCCPrc)), - vm_outflowPrc(ttot,regi,teCCPrc,opmoCCPrc) + vm_outflowPrc(t,regi,teCCPrc,opmoCCPrc) ) ; From 4d729ceb03c6fb2823b8b8b345bc3fc5443fb639 Mon Sep 17 00:00:00 2001 From: Felix Schreyer Date: Wed, 28 Feb 2024 17:35:59 +0100 Subject: [PATCH 61/76] improve comment that explains previous change of overwriting pm_data in initialCap only for eta values of chp --- modules/05_initialCap/on/preloop.gms | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/05_initialCap/on/preloop.gms b/modules/05_initialCap/on/preloop.gms index c58d69abc..20afec59a 100644 --- a/modules/05_initialCap/on/preloop.gms +++ b/modules/05_initialCap/on/preloop.gms @@ -539,9 +539,9 @@ if (cm_startyear gt 2005, -*** load pm_data from input_ref.gdx and overwrite values -*** only for eta of chp technologies since they have been adapted in initialCap routine above -*** This is to avoid overwriting changes to pm_data by scenario switches +*** load pm_data from input_ref.gdx and overwrite values only for eta of chp technologies +*** Only the eta values of chp technologies have been adapted by initialCap script above. +*** This is to avoid overwriting all of pm_data and make sure that scenario switches which adapt pm_data before this module work as intended. Execute_Loadpoint 'input_ref' p05_pmdata_ref = pm_data; pm_data(regi,char,te)$( (sameas(te,"coalchp") OR sameas(te,"gaschp") From 13fc0fbb4d83eda60dddc43f81ecf0b3116441bd Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Wed, 28 Feb 2024 16:45:16 +0000 Subject: [PATCH 62/76] Release development version 3.2.1.dev1139 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index b76260924..f18a69ecd 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1135" +version: "3.2.1.dev1139" date-released: 2024-02-28 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index 8e6ac91d1..43aba5284 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -63,7 +63,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1135" +cfg$model_version <- "3.2.1.dev1139" #### settings #### cfg$gms <- list() From caa8ea73071de71ff8f9cd7710dc129853d1c260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonn=20R=C3=BCter?= Date: Wed, 28 Feb 2024 18:46:38 +0100 Subject: [PATCH 63/76] Merge final changes --- output.R | 7 +++---- scripts/output/single/ar6Climate.R | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/output.R b/output.R index 18b536c66..6115f7202 100755 --- a/output.R +++ b/output.R @@ -87,16 +87,15 @@ if ("--help" %in% flags) { choose_slurmConfig_output <- function(output) { slurm_options <- c("--qos=priority", "--qos=short", "--qos=standby", "--qos=priority --mem=8000", "--qos=short --mem=8000", - "--qos=standby --mem=8000", "--qos=priority --mem=32000", - "direct") + "--qos=standby --mem=8000","--qos=priority --mem=32000") if (!isSlurmAvailable()) return("direct") - if ("reporting" %in% output) slurm_options <- unique(c(grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE), "direct")) - # Modify slurm options for ar6 reporting, since we want to run MAGICC in parallel and we'll need a lot of memory if ("ar6Climate" %in% output) slurm_options <- paste(slurm_options[1:3], "--tasks-per-node=12 --mem=32000") + # reporting.R, in particular remind2::convGDX2MIF, requires at least --mem=8000 of memory + if ("reporting" %in% output) slurm_options <- grep("--mem=[0-9]*[0-9]{3}", slurm_options, value = TRUE) if (length(slurm_options) == 1) { return(slurm_options[[1]]) diff --git a/scripts/output/single/ar6Climate.R b/scripts/output/single/ar6Climate.R index c754753bd..ad1ddd5d9 100644 --- a/scripts/output/single/ar6Climate.R +++ b/scripts/output/single/ar6Climate.R @@ -97,6 +97,10 @@ capture.output(cat(logmsg), file = logFile, append = TRUE) # Read the cfg to get the location of MAGICC-related files cfg <- read_yaml(cfgPath) +if (is.null(cfg$climate_assessment_root)) cfg$climate_assessment_root <- "/p/projects/rd3mod/python/climate-assessment/src/" +if (is.null(cfg$climate_assessment_files_dir)) cfg$climate_assessment_files_dir <- "/p/projects/rd3mod/climate-assessment-files/" +if (is.null(cfg$cfg$climate_assessment_magicc_bin)) cfg$climate_assessment_magicc_bin <- "/p/projects/rd3mod/climate-assessment-files/magicc-v7.5.3/bin/magicc" + # All climate-assessment files will be written to this folder climateAssessmentFolder <- normalizePath(file.path(outputdir, "climate-assessment-data")) dir.create(climateAssessmentFolder, showWarnings = FALSE) From 546af39a901d1463f54661ec658f35a04efff916 Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Wed, 28 Feb 2024 18:00:17 +0000 Subject: [PATCH 64/76] Release development version 3.2.1.dev1187 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index f18a69ecd..27af70361 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1139" +version: "3.2.1.dev1187" date-released: 2024-02-28 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index aba94c59f..af0bb71eb 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1139" +cfg$model_version <- "3.2.1.dev1187" #### settings #### cfg$gms <- list() From b3cff04ef0595b8a72746bd9ee59802b33c68d8c Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 29 Feb 2024 09:22:14 +0100 Subject: [PATCH 65/76] always run nashAnalysis after each REMIND run --- config/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index af0bb71eb..92527dc4a 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -116,7 +116,7 @@ cfg$logoption <- 2 # Just list the name of the output scripts that should be used by output.R # At the moment there are several R-scripts located in scripts/output/ -cfg$output <- c("reporting","reportCEScalib","rds_report","fixOnRef") #"ar6Climate","validation","emulator","reportCEScalib","validationSummary","dashboard") +cfg$output <- c("reporting","reportCEScalib","rds_report","fixOnRef","nashAnalysis") #"ar6Climate","emulator" # Set the format for the results folder, type string :date: in order to use the current time stamp in the folder name (e.g. "results:date:") use :title: to use the current title in the folder name cfg$results_folder <- "output/:title::date:" From a4bcacdf10ebdd6b2c201b25ec205230428f5577 Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Thu, 29 Feb 2024 08:22:58 +0000 Subject: [PATCH 66/76] Release development version 3.2.1.dev1192 --- CITATION.cff | 4 ++-- config/default.cfg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 27af70361..27673f8e9 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,8 +251,8 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1187" -date-released: 2024-02-28 +version: "3.2.1.dev1192" +date-released: 2024-02-29 repository-code: https://github.com/remindmodel/remind keywords: - energy diff --git a/config/default.cfg b/config/default.cfg index af0bb71eb..7447cee9e 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1187" +cfg$model_version <- "3.2.1.dev1192" #### settings #### cfg$gms <- list() From 89f74deb90465525ec70b733d9336dc7e7ca2510 Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Thu, 29 Feb 2024 08:26:31 +0000 Subject: [PATCH 67/76] Release development version 3.2.1.dev1196 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 27673f8e9..04d9b660a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1192" +version: "3.2.1.dev1196" date-released: 2024-02-29 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index 7447cee9e..c2270c545 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1192" +cfg$model_version <- "3.2.1.dev1196" #### settings #### cfg$gms <- list() From ae97d4378e6a67b43f68888162e85190734331c7 Mon Sep 17 00:00:00 2001 From: Michaja Pehl Date: Wed, 28 Feb 2024 14:04:23 +0100 Subject: [PATCH 68/76] rename industry feedstock variables according to naming convention --- core/declarations.gms | 3 - modules/37_industry/fixed_shares/not_used.txt | 60 +++++++++---------- .../37_industry/subsectors/declarations.gms | 3 + modules/37_industry/subsectors/equations.gms | 24 ++++---- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/core/declarations.gms b/core/declarations.gms index fa5865364..d58c50f4b 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -417,9 +417,6 @@ v_shGasLiq_fe(ttot,all_regi,emi_sectors) "share of gases and liquids vm_emiCdrAll(ttot,all_regi) "all CDR emissions" -vm_FeedstocksCarbon(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in chemical feedstocks [GtC]" -vm_plasticsCarbon(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in plastics [GtC]" -vm_plasticWaste(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in plastic waste [GtC]" vm_feedstockEmiUnknownFate(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in feedstocks with unknown fate (not plastics)(assumed to go back into the atmosphere) [GtC]" vm_incinerationEmi(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Emissions from incineration of plastic waste [GtC]" vm_nonIncineratedPlastics(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in plastics that are not incinerated [GtC]" diff --git a/modules/37_industry/fixed_shares/not_used.txt b/modules/37_industry/fixed_shares/not_used.txt index 3e71d8556..4157d5d7f 100644 --- a/modules/37_industry/fixed_shares/not_used.txt +++ b/modules/37_industry/fixed_shares/not_used.txt @@ -4,33 +4,33 @@ # | AGPL-3.0, you are granted additional permissions described in the # | REMIND License Exception, version 1.0 (see LICENSE file). # | Contact: remind@pik-potsdam.de -name,type,reason -pm_delta_kap, input, questionnaire -pm_calibrate_eff_scale, parameter, not needed -pm_fedemand, parameter, not needed -sm_TWa_2_MWh, input, questionnaire -sm_giga_2_non, input, not needed -sm_EJ_2_TWa, input, not needed -sm_tmp2, parameter, not needed -vm_cap, variable, not needed -vm_capFac, variable, not needed -pm_tau_ces_tax, input, questionnaire -pm_secBioShare, parameter, not needed -pm_exogDemScen, input, added by codeCheck -pm_ts, parameter, not needed -pm_outflowPrcIni, parameter, not needed -pm_specFeDem, parameter, not needed -sm_macChange, parameter, not needed -vm_demFENonEnergySector, variable, not needed -vm_FeedstocksCarbon, variable, not needed -vm_plasticsCarbon, variable, not needed -vm_plasticWaste, variable, not needed -vm_feedstockEmiUnknownFate, variable, not needed -vm_incinerationEmi, variable, not needed -vm_nonIncineratedPlastics, variable, not needed -vm_outflowPrc, variable, not needed -vm_costMatPrc, variable, not needed -pm_emifacNonEnergy, parameter, not needed -pm_incinerationRate, parameter, not needed -cm_emiscen, parameter, not needed -vm_demFeSector, variable, not needed +name, type, reason +pm_delta_kap, input, questionnaire +pm_calibrate_eff_scale, parameter, not needed +pm_fedemand, parameter, not needed +sm_TWa_2_MWh, input, questionnaire +sm_giga_2_non, input, not needed +sm_EJ_2_TWa, input, not needed +sm_tmp2, parameter, not needed +vm_cap, variable, not needed +vm_capFac, variable, not needed +pm_tau_ces_tax, input, questionnaire +pm_secBioShare, parameter, not needed +pm_exogDemScen, input, added by codeCheck +pm_ts, parameter, not needed +pm_outflowPrcIni, parameter, not needed +pm_specFeDem, parameter, not needed +sm_macChange, parameter, not needed +vm_demFENonEnergySector, variable, not needed +v37_FeedstocksCarbon, variable, not needed +v37_plasticsCarbon, variable, not needed +v37_plasticWaste, variable, not needed +vm_feedstockEmiUnknownFate, variable, not needed +vm_incinerationEmi, variable, not needed +vm_nonIncineratedPlastics, variable, not needed +vm_outflowPrc, variable, not needed +vm_costMatPrc, variable, not needed +pm_emifacNonEnergy, parameter, not needed +pm_incinerationRate, parameter, not needed +cm_emiscen, parameter, not needed +vm_demFeSector, variable, not needed diff --git a/modules/37_industry/subsectors/declarations.gms b/modules/37_industry/subsectors/declarations.gms index 6bfcf7fc6..eed76be59 100644 --- a/modules/37_industry/subsectors/declarations.gms +++ b/modules/37_industry/subsectors/declarations.gms @@ -73,6 +73,9 @@ Positive Variables vm_emiIndCCS(ttot,all_regi,all_enty) "industry CCS emissions [GtC/a]" vm_IndCCSCost(ttot,all_regi,all_enty) "industry CCS cost" v37_emiIndCCSmax(ttot,all_regi,emiInd37) "maximum abatable industry emissions" + v37_FeedstocksCarbon(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in chemical feedstocks [GtC]" + v37_plasticsCarbon(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in plastics [GtC]" + v37_plasticWaste(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Carbon flow: carbon contained in plastic waste [GtC]" !! process-based implementation vm_outflowPrc(tall,all_regi,all_te,opmoPrc) "Production volume of processes in process-based model [Gt/a]" diff --git a/modules/37_industry/subsectors/equations.gms b/modules/37_industry/subsectors/equations.gms index 54950b0ef..2d5195aa3 100644 --- a/modules/37_industry/subsectors/equations.gms +++ b/modules/37_industry/subsectors/equations.gms @@ -242,7 +242,7 @@ q37_feedstocksLimit(t,regi,entySe,entyFe,emiMkt)$( *' Calculate mass of carbon contained in chemical feedstocks q37_FeedstocksCarbon(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. - vm_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) + v37_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) =e= vm_demFENonEnergySector(t,regi,entySe,entyFe,"indst",emiMkt) * p37_FeedstockCarbonContent(t,regi,entyFe) @@ -251,9 +251,9 @@ q37_FeedstocksCarbon(t,regi,sefe(entySe,entyFe),emiMkt)$( *' Calculate carbon contained in plastics as a share of carbon in feedstock [GtC] q37_plasticsCarbon(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. - vm_plasticsCarbon(t,regi,entySe,entyFe,emiMkt) + v37_plasticsCarbon(t,regi,entySe,entyFe,emiMkt) =e= - vm_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) + v37_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) * s37_plasticsShare ; @@ -263,15 +263,15 @@ q37_plasticsCarbon(t,regi,sefe(entySe,entyFe),emiMkt)$( q37_plasticWaste(ttot,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) AND ttot.val ge max(2015, cm_startyear) ) .. - vm_plasticWaste(ttot,regi,entySe,entyFe,emiMkt) + v37_plasticWaste(ttot,regi,entySe,entyFe,emiMkt) =e= - vm_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt)$( ttot.val lt 2070 ) - + ( ( vm_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt) - + vm_plasticsCarbon(ttot-1,regi,entySe,entyFe,emiMkt) + v37_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt)$( ttot.val lt 2070 ) + + ( ( v37_plasticsCarbon(ttot-2,regi,entySe,entyFe,emiMkt) + + v37_plasticsCarbon(ttot-1,regi,entySe,entyFe,emiMkt) ) / 2 )$( ttot.val eq 2070 ) - + vm_plasticsCarbon(ttot-1,regi,entySe,entyFe,emiMkt)$( ttot.val gt 2070 ) + + v37_plasticsCarbon(ttot-1,regi,entySe,entyFe,emiMkt)$( ttot.val gt 2070 ) ; *' emissions from plastics incineration as a share of total plastic waste @@ -279,7 +279,7 @@ q37_incinerationEmi(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt)) .. vm_incinerationEmi(t,regi,entySe,entyFe,emiMkt) =e= - vm_plasticWaste(t,regi,entySe,entyFe,emiMkt) + v37_plasticWaste(t,regi,entySe,entyFe,emiMkt) * pm_incinerationRate(t,regi) ; @@ -290,9 +290,9 @@ q37_nonIncineratedPlastics(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. vm_nonIncineratedPlastics(t,regi,entySe,entyFe,emiMkt) =e= - vm_plasticWaste(t,regi,entySe,entyFe,emiMkt) + v37_plasticWaste(t,regi,entySe,entyFe,emiMkt) * (1 - pm_incinerationRate(t,regi)) -; + ; *' calculate flow of carbon contained in chemical feedstock with unknown fate *' it is assumed that this carbon is re-emitted in the same timestep @@ -300,7 +300,7 @@ q37_feedstockEmiUnknownFate(t,regi,sefe(entySe,entyFe),emiMkt)$( entyFE2sector2emiMkt_NonEn(entyFe,"indst",emiMkt) ) .. vm_feedstockEmiUnknownFate(t,regi,entySe,entyFe,emiMkt) =e= - vm_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) + v37_FeedstocksCarbon(t,regi,entySe,entyFe,emiMkt) * (1 - s37_plasticsShare) ; From 210956087d4f7e7f041129dc6a1a38b851511122 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 29 Feb 2024 10:25:43 +0100 Subject: [PATCH 69/76] cleaning --- config/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index 45b67a1b0..a15d0abcb 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -116,7 +116,7 @@ cfg$logoption <- 2 # Just list the name of the output scripts that should be used by output.R # At the moment there are several R-scripts located in scripts/output/ -cfg$output <- c("reporting","reportCEScalib","rds_report","fixOnRef","nashAnalysis") #"ar6Climate","emulator" +cfg$output <- c("reporting","reportCEScalib","rds_report","fixOnRef") #"ar6Climate","emulator" # Set the format for the results folder, type string :date: in order to use the current time stamp in the folder name (e.g. "results:date:") use :title: to use the current title in the folder name cfg$results_folder <- "output/:title::date:" From 1dcf0bb29e4c4d055c979c75b9d5dd4e5b605748 Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Thu, 29 Feb 2024 09:56:43 +0000 Subject: [PATCH 70/76] Release development version 3.2.1.dev1201 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 04d9b660a..c6ef26885 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1196" +version: "3.2.1.dev1201" date-released: 2024-02-29 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index a15d0abcb..ee69f199e 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1196" +cfg$model_version <- "3.2.1.dev1201" #### settings #### cfg$gms <- list() From 48c397854a650414c060d424f39d78a6403c351a Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Thu, 29 Feb 2024 10:17:36 +0000 Subject: [PATCH 71/76] Release development version 3.2.1.dev1204 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index c6ef26885..edb1457b7 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1201" +version: "3.2.1.dev1204" date-released: 2024-02-29 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index ee69f199e..3c0834e67 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1201" +cfg$model_version <- "3.2.1.dev1204" #### settings #### cfg$gms <- list() From 60d3cb50e5673f20e2858a2f64d7f21d21374b0d Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Thu, 29 Feb 2024 13:11:20 +0000 Subject: [PATCH 72/76] Release development version 3.2.1.dev1207 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index edb1457b7..5d576216b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1204" +version: "3.2.1.dev1207" date-released: 2024-02-29 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index 3c0834e67..4a2aabac5 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1204" +cfg$model_version <- "3.2.1.dev1207" #### settings #### cfg$gms <- list() From a4510f610d64c30bc7a39042bae8110cfaabe7ab Mon Sep 17 00:00:00 2001 From: David Klein Date: Thu, 29 Feb 2024 14:19:38 +0100 Subject: [PATCH 73/76] MAgPIE coupling: Do not write RData files in --gamscompile mode. Adapt coupling test accordingly. --- start_bundle_coupled.R | 2 +- tests/testthat/test_20-coupled.R | 43 ++++++++++++++------------------ 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/start_bundle_coupled.R b/start_bundle_coupled.R index c358dea34..7a1294350 100755 --- a/start_bundle_coupled.R +++ b/start_bundle_coupled.R @@ -552,7 +552,7 @@ for(scen in common){ errorsfound <- errorsfound + cfg_rem$errorsfoundInCheckFixCfg } - if (! "--test" %in% flags) { + if (! any(c("--test", "--gamscompile")) %in% flags) { Rdatafile <- paste0(fullrunname, ".RData") message("Save settings to ", Rdatafile) save(path_remind, path_magpie, cfg_rem, cfg_mag, runname, fullrunname, max_iterations, start_iter, diff --git a/tests/testthat/test_20-coupled.R b/tests/testthat/test_20-coupled.R index 21fb15216..21c8e6713 100644 --- a/tests/testthat/test_20-coupled.R +++ b/tests/testthat/test_20-coupled.R @@ -67,7 +67,25 @@ test_that("using start_bundle_coupled.R --test works", { expect_true(any(grepl("NOT submitted", output))) for (scen in rownames(config)[config$start == 1]) { expect_true(any(grepl(paste0("starting with C_", scen, "-rem-1"), output))) - expectedFiles <- paste0("../../C_", scen, "-rem-", seq(max_iterations), ".RData") + } +}) + +test_that("runs coupled to MAgPIE work", { + skipIfPreviousFailed() + # try running actual runs + output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), + env = paste0("R_PROFILE_USER=", Rprofile)) + printIfFailed(output) + expectSuccessStatus(output) + expect_true(xor("Copied REMIND .Rprofile to MAgPIE folder." %in% output, + any(grepl("^Finding R package dependencies.*Done.", output)))) + for (scen in rownames(config)[config$start == 1]) { + expectedFiles <- c( + paste0("../../output/C_", scen, "-rem-", seq(max_iterations)), + paste0("../../output/C_", scen, ".mif"), + paste0("../../C_", scen, "-rem-", seq(max_iterations), ".RData"), + file.path(magpie_folder, paste0("output/C_", scen, "-mag-", seq(max_iterations - 1))) + ) expect_true(all(file.exists(expectedFiles))) # check -rem-1 config file configfile <- paste0("../../C_", scen, "-rem-1.RData") @@ -92,28 +110,6 @@ test_that("using start_bundle_coupled.R --test works", { if ("cm_nash_autoconverge_lastrun" %in% names(config)) { expect_true(envir$cfg_rem$gms$cm_nash_autoconverge == config[scen, "cm_nash_autoconverge_lastrun"]) } - # no_ghgprices_land_until, oldrun, path_report - } -}) - -test_that("runs coupled to MAgPIE work", { - skipIfPreviousFailed() - # try running actual runs - output <- localSystem2("Rscript", c("start_bundle_coupled.R", coupledConfig, "startgroup=1"), - env = paste0("R_PROFILE_USER=", Rprofile)) - printIfFailed(output) - expectSuccessStatus(output) - expect_true(xor("Copied REMIND .Rprofile to MAgPIE folder." %in% output, - any(grepl("^Finding R package dependencies.*Done.", output)))) - for (scen in rownames(config)[config$start == 1]) { - expectedFiles <- c( - paste0("../../output/C_", scen, "-rem-", seq(max_iterations)), - # paste0("../../output/C_", scen, "-", max_iterations, ".pdf"), - paste0("../../output/C_", scen, ".mif"), - paste0("../../C_", scen, "-rem-", seq(max_iterations), ".RData"), - file.path(magpie_folder, paste0("output/C_", scen, "-mag-", seq(max_iterations - 1))) - ) - expect_true(all(file.exists(expectedFiles))) # check path_mif_ghgprice_land if ("path_mif_ghgprice_land" %in% names(config)[config$start == 1]) { configfile <- paste0("../../C_", scen, "-rem-", (max_iterations - 1), ".RData") @@ -144,7 +140,6 @@ test_that("runs coupled to MAgPIE work", { expect_true(any(grepl("^MAgPIE", levels(qscen$model)))) lengthwithmag <- nrow(qscen) expect_true(lengthwithmag > lengthwithoutmag && lengthwithmag > 700000) - qscen <- quitte::as.quitte(paste0("../../output/C_", scen, "-rem-1/REMIND_generic_C_", scen, "-rem-1.mif")) # check main mif qscen <- quitte::as.quitte(paste0("../../output/C_", scen, ".mif")) expect_true(all(grepl("^REMIND-MAgPIE", levels(qscen$model)))) From db70f113d708e08f1b4c06203dc20198948bd443 Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Thu, 29 Feb 2024 13:43:05 +0000 Subject: [PATCH 74/76] Release development version 3.2.1.dev1210 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 5d576216b..ba7ad5e38 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1207" +version: "3.2.1.dev1210" date-released: 2024-02-29 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index 4a2aabac5..ef2d2752c 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1207" +cfg$model_version <- "3.2.1.dev1210" #### settings #### cfg$gms <- list() From 0e2dddbbf706f2162e494718a0754dd0decfc0e2 Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Thu, 29 Feb 2024 14:18:52 +0000 Subject: [PATCH 75/76] Release development version 3.2.1.dev1221 --- CITATION.cff | 2 +- config/default.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index ba7ad5e38..422279e8d 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,7 +251,7 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1210" +version: "3.2.1.dev1221" date-released: 2024-02-29 repository-code: https://github.com/remindmodel/remind keywords: diff --git a/config/default.cfg b/config/default.cfg index ef2d2752c..0250948ad 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1210" +cfg$model_version <- "3.2.1.dev1221" #### settings #### cfg$gms <- list() From 1afebcf42523f531eff9ec4f34ff8c00b4bc323b Mon Sep 17 00:00:00 2001 From: REMIND Research Software Engineering Date: Fri, 1 Mar 2024 07:54:09 +0000 Subject: [PATCH 76/76] Release development version 3.2.1.dev1226 --- CITATION.cff | 4 ++-- config/default.cfg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 422279e8d..e0ea58e8c 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -251,8 +251,8 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" title: REMIND - REgional Model of INvestments and Development -version: "3.2.1.dev1221" -date-released: 2024-02-29 +version: "3.2.1.dev1226" +date-released: 2024-03-01 repository-code: https://github.com/remindmodel/remind keywords: - energy diff --git a/config/default.cfg b/config/default.cfg index 0250948ad..20f401172 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -69,7 +69,7 @@ cfg$validationmodel_name <- "VALIDATIONREMIND" #### model version of the overall model (used for run statistics only). # automatically generated for development versions, updated by hand for releases -cfg$model_version <- "3.2.1.dev1221" +cfg$model_version <- "3.2.1.dev1226" #### settings #### cfg$gms <- list()