From c8740760d1a6f617ec9766e7f5584c9b5347710b Mon Sep 17 00:00:00 2001 From: johannah-pik <89136160+johannah-pik@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:54:44 +0200 Subject: [PATCH 1/2] fix GDP thresholds in adjustCAPEXtrackedFleet --- .buildlibrary | 3 ++- .github/workflows/check.yaml | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/toolAdjustCAPEXtrackedFleet.R | 9 ++++++--- README.md | 6 +++--- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 118b8c9..8b6d2e9 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '1521292' +ValidationKey: '1541463' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' @@ -6,3 +6,4 @@ AcceptedWarnings: AcceptedNotes: 'Undefined global functions or variables:' allowLinterWarnings: yes enforceVersionUpdate: no +skipCoverage: no diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 23545e6..d85a316 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -63,6 +63,6 @@ jobs: shell: Rscript {0} run: | nonDummyTests <- setdiff(list.files("./tests/testthat/"), c("test-dummy.R", "_snaps")) - if(length(nonDummyTests) > 0) covr::codecov(quiet = FALSE) + if(length(nonDummyTests) > 0 && !lucode2:::loadBuildLibraryConfig()[["skipCoverage"]]) covr::codecov(quiet = FALSE) env: NOT_CRAN: "true" diff --git a/CITATION.cff b/CITATION.cff index 32daec0..17994ac 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'mrtransport: Input data generation for the EDGE-Transport model' -version: 0.7.6 -date-released: '2024-10-21' +version: 0.7.7 +date-released: '2024-10-23' abstract: The mrtransport package contains data preprocessing for the EDGE-Transport model. authors: diff --git a/DESCRIPTION b/DESCRIPTION index 6567e0c..8df55fa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: mrtransport Title: Input data generation for the EDGE-Transport model -Version: 0.7.6 +Version: 0.7.7 Authors@R: c( person("Johanna", "Hoppe", , "johanna.hoppe@pik-potsdam.de", role = c("aut", "cre"), comment = c(ORCID = "0009-0004-6753-5090")), @@ -26,4 +26,4 @@ Imports: magrittr, quitte, data.table -Date: 2024-10-21 +Date: 2024-10-23 diff --git a/R/toolAdjustCAPEXtrackedFleet.R b/R/toolAdjustCAPEXtrackedFleet.R index 1c4f2b0..627f2ab 100644 --- a/R/toolAdjustCAPEXtrackedFleet.R +++ b/R/toolAdjustCAPEXtrackedFleet.R @@ -17,7 +17,7 @@ toolAdjustCAPEXtrackedFleet <- function(dt, ISOcountries, yrs, completeData, GDP variable <- value <- region <- regionCode12 <- period <- technology <- univocalName <- markup <- univocalName <- unit <- check <- gdppc <- . <- NULL - + browser() # 1: LDV 4 Wheeler adjustments # 1a: Delete Capital costs other, as it is unclear what it represents dt <- dt[!(univocalName %in% filter$trn_pass_road_LDV_4W & variable == "Capital costs (other)")] @@ -268,8 +268,11 @@ toolAdjustCAPEXtrackedFleet <- function(dt, ISOcountries, yrs, completeData, GDP dt <- rbind(dt[!(is.na(value) & univocalName %in% filter$trn_pass_road_LDV_4W)], missing4W)[, check := NULL] # 5: Lower the prices for LDW 4 Wheelers depending on the GDP to represent a 2nd hand vehicle market - minGDP <- 4000 ## minimum GDPcap after which the linear trend starts - maxGDP <- 30000 ## maximum GDPcap marking the level where no factor is implemented + convfact <- convertSingle(x = 1, iso3c = "USA", unit_in = "constant 2005 Int$PPP", + unit_out = mrdrivers::toolGetUnitDollar()) + + minGDP <- 4000 * convfact ## minimum GDPcap after which the linear trend starts + maxGDP <- 30000 * convfact ## maximum GDPcap marking the level where no factor is implemented lowerBound <- 0.3 ## maximum decrease to be applied to the original costs value GDPpcMER[, factor := ifelse(gdppc < maxGDP & gdppc > minGDP, diff --git a/README.md b/README.md index 8fbd782..bd30529 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Input data generation for the EDGE-Transport model -R package **mrtransport**, version **0.7.6** +R package **mrtransport**, version **0.7.7** [![CRAN status](https://www.r-pkg.org/badges/version/mrtransport)](https://cran.r-project.org/package=mrtransport) [![R build status](https://github.com/pik-piam/mrtransport/workflows/check/badge.svg)](https://github.com/pik-piam/mrtransport/actions) [![codecov](https://codecov.io/gh/pik-piam/mrtransport/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrtransport) [![r-universe](https://pik-piam.r-universe.dev/badges/mrtransport)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Johanna Hoppe . +Hoppe J, Muessel J, Dirnaichner A (2024). _mrtransport: Input data generation for the EDGE-Transport model_. R package version 0.7.7, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is title = {mrtransport: Input data generation for the EDGE-Transport model}, author = {Johanna Hoppe and Jarusch Muessel and Alois Dirnaichner}, year = {2024}, - note = {R package version 0.7.6}, + note = {R package version 0.7.7}, url = {https://github.com/pik-piam/mrtransport}, } ``` From 432f48076b8497f700ce967b7c7e747cb246b295 Mon Sep 17 00:00:00 2001 From: johannah-pik <89136160+johannah-pik@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:01:07 +0200 Subject: [PATCH 2/2] Update toolAdjustCAPEXtrackedFleet.R --- R/toolAdjustCAPEXtrackedFleet.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/toolAdjustCAPEXtrackedFleet.R b/R/toolAdjustCAPEXtrackedFleet.R index 627f2ab..a4d9880 100644 --- a/R/toolAdjustCAPEXtrackedFleet.R +++ b/R/toolAdjustCAPEXtrackedFleet.R @@ -17,7 +17,7 @@ toolAdjustCAPEXtrackedFleet <- function(dt, ISOcountries, yrs, completeData, GDP variable <- value <- region <- regionCode12 <- period <- technology <- univocalName <- markup <- univocalName <- unit <- check <- gdppc <- . <- NULL - browser() + # 1: LDV 4 Wheeler adjustments # 1a: Delete Capital costs other, as it is unclear what it represents dt <- dt[!(univocalName %in% filter$trn_pass_road_LDV_4W & variable == "Capital costs (other)")]