diff --git a/.buildlibrary b/.buildlibrary index f838822..5150191 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '42566349' +ValidationKey: '42568470' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 7c7e56e..27b368e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -3,7 +3,7 @@ message: If you use this software, please cite it using the metadata from this f type: software title: 'edgeTransport: Prepare EDGE Transport Data for the REMIND model' version: 2.12.1 -date-released: '2024-12-12' +date-released: '2024-12-13' abstract: EDGE-T is a fork of the GCAM transport module https://jgcri.github.io/gcam-doc/energy.html#transportation with a high level of detail in its representation of technological and modal options. It is a partial equilibrium model with a nested multinomial logit structure and diff --git a/DESCRIPTION b/DESCRIPTION index cc248dc..dec0eb8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,7 @@ Encoding: UTF-8 LazyData: true RoxygenNote: 7.3.2 VignetteBuilder: knitr -Date: 2024-12-12 +Date: 2024-12-13 Config/testthat/edition: 3 Imports: rmndt, diff --git a/R/toolEdgeTransportSA.R b/R/toolEdgeTransportSA.R index 6c01660..934b3d9 100644 --- a/R/toolEdgeTransportSA.R +++ b/R/toolEdgeTransportSA.R @@ -50,9 +50,6 @@ toolEdgeTransportSA <- function(SSPscen, ## Load input data ######################################################## if (is.null(outputFolder) & isStored) stop("Please provide an outputfolder to store your results") - if (is.null(gdxPath)) {gdxPath <- file.path(getConfig("sourcefolder"), - "REMINDinputForTransportStandalone", "v1.2", "fulldata.gdx")} - if (!file.exists(gdxPath)) stop("Please provide valid path to REMIND fulldata.gdx as input for fuel costs") inputs <- toolLoadInputs(SSPscen, transportPolScen, demScen, gdxPath, hybridElecShare) diff --git a/R/toolLoadREMINDfuelCosts.R b/R/toolLoadREMINDfuelCosts.R index dcd9b02..96880e7 100644 --- a/R/toolLoadREMINDfuelCosts.R +++ b/R/toolLoadREMINDfuelCosts.R @@ -24,7 +24,11 @@ toolLoadREMINDfuelCosts <- function(gdxPath, hybridElecShare, helpers) { decisionTree <- copy(helpers$decisionTree) # load prices from REMIND gdx - fuelCosts <- readGDX(gdxPath, "pm_FEPrice", format = "first_found", restore_zeros = FALSE)[, , "trans.ES", pmatch = TRUE] + if (is.null(gdxPath)) { + fuelCosts <- readSource("REMINDinputForTransportStandalone", convert = FALSE) + } else { + fuelCosts <- readGDX(gdxPath, "pm_FEPrice", format = "first_found", restore_zeros = FALSE)[, , "trans.ES", pmatch = TRUE] + } ## smooth prices from REMIND gdx (over years) and convert to data.table fuelCosts <- fuelCosts %>% lowpass() %>% magpie2dt() diff --git a/R/toolLoadmrremindData.R b/R/toolLoadmrremindData.R index 8666991..15b2359 100644 --- a/R/toolLoadmrremindData.R +++ b/R/toolLoadmrremindData.R @@ -25,17 +25,17 @@ toolLoadmrremindData <- function(helpers) { yearOut <- 2030 ## attribute first (to the countries that have them) the same incentives value until the phase out year subsidies[, value := ifelse(period >= 2020 & period <= yearOut, value[period == 2020], 0), - by = c("region", "technology")] + by = c("region", "technology")] # map on decision tree, apply only on 4 wheelers subsidies <- merge(unique(helpers$decisionTree[subsectorL3 == "trn_pass_road_LDV_4W", - c("region", "univocalName", "technology")]), subsidies, + c("region", "univocalName", "technology")]), subsidies, by = c("region", "technology"), all.x = TRUE, allow.cartesian = TRUE) monUnit <- gsub(".*?(\\d{4}).*", "US$\\1", mrdrivers::toolGetUnitDollar()) subsidies <- subsidies[!is.na(value)][, variable := "Capital costs subsidy"][, unit := paste0(monUnit, "/veh")] # Q: How to include phase out of the incentives? Is that needed at all? -return(list( - subsidies = subsidies -)) + return(list( + subsidies = subsidies + )) }