diff --git a/.buildlibrary b/.buildlibrary index 42379481..7f40eafe 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '950150' +ValidationKey: '969663' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/.zenodo.json b/.zenodo.json index 495ea484..47b8682f 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "edgeTransport: Prepare EDGE Transport Data for the REMIND model", - "version": "0.5.0", + "version": "0.5.1", "description": "

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 relies on the modified logit formulation. Most of the sources are not publicly available. PIK-internal users can find the sources in the distributed file system in the folder `/p/projects/rd3mod/inputdata/sources/EDGE-Transport-Standalone`.<\/p>", "creators": [ { diff --git a/DESCRIPTION b/DESCRIPTION index 77edfe4d..82d2a997 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: edgeTransport Title: Prepare EDGE Transport Data for the REMIND model -Version: 0.5.0 +Version: 0.5.1 Authors@R: c( person("Alois", "Dirnaichner", email = "dirnaichner@pik-potsdam.de", role = c("aut", "cre")), person("Marianna", "Rottoli", email = "rottoli@pik-potsdam.de", role = "aut")) @@ -13,7 +13,7 @@ Encoding: UTF-8 LazyData: true RoxygenNote: 7.1.2 VignetteBuilder: knitr -Date: 2022-01-11 +Date: 2022-01-21 Config/testthat/edition: 3 Imports: edgeTrpLib, diff --git a/R/lvl0_mergeDat.R b/R/lvl0_mergeDat.R index 7b0691ee..dd4376de 100644 --- a/R/lvl0_mergeDat.R +++ b/R/lvl0_mergeDat.R @@ -338,7 +338,12 @@ lvl0_mergeDat = function(UCD_output, EU_data, PSI_costs, altCosts, CHN_trucks, G int[, conv_pkm_MJ := ifelse(is.na(conv_pkm_MJ), mean(conv_pkm_MJ, na.rm = TRUE), conv_pkm_MJ), by = c("year", "technology", "vehicle_type")] LF = merge(LF, unique(dem[!vehicle_type %in% c("Cycle_tmp_vehicletype", "Walk_tmp_vehicletype"),c("iso", "vehicle_type", "technology", "subsector_L1", "subsector_L2", "subsector_L3", "sector", "year")]), all.y = TRUE, by = c("iso", "vehicle_type", "technology", "subsector_L1", "subsector_L2", "subsector_L3", "sector", "year")) - LF[, loadFactor := ifelse(is.na(loadFactor), mean(loadFactor, na.rm = TRUE), loadFactor), by = c("year", "technology", "vehicle_type")] + LF[, loadFactor := ifelse(is.na(loadFactor), mean(loadFactor, na.rm = TRUE), loadFactor), by = c("year", "vehicle_type")] + LF[year > 2100, loadFactor := rep(LF[year == 2100]$loadFactor, 3)] + if(nrow(LF[is.na(loadFactor) | loadFactor == 0]) > 0){ + stop("Zero load factor provided.") + } + AM = merge(AM, unique(dem[unique(AM$vehicle_type),c("iso", "vehicle_type", "technology", "subsector_L1", "subsector_L2", "subsector_L3", "sector", "year")]), all.y = TRUE, by = c("iso", "vehicle_type", "technology", "subsector_L1", "subsector_L2", "subsector_L3", "sector", "year")) AM[, vkm.veh := ifelse(is.na(vkm.veh), mean(vkm.veh, na.rm = TRUE), vkm.veh), by = c("year", "technology", "vehicle_type")] diff --git a/README.md b/README.md index 9ed4f8db..2339f722 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Prepare EDGE Transport Data for the REMIND model -R package **edgeTransport**, version **0.5.0** +R package **edgeTransport**, version **0.5.1** [![CRAN status](https://www.r-pkg.org/badges/version/edgeTransport)](https://cran.r-project.org/package=edgeTransport) [![R build status](https://github.com/pik-piam/edgeTransport/workflows/check/badge.svg)](https://github.com/pik-piam/edgeTransport/actions) [![codecov](https://codecov.io/gh/pik-piam/edgeTransport/branch/master/graph/badge.svg)](https://codecov.io/gh/pik-piam/edgeTransport) [![r-universe](https://pik-piam.r-universe.dev/badges/edgeTransport)](https://pik-piam.r-universe.dev/ui#builds) @@ -46,7 +46,7 @@ In case of questions / problems please contact Alois Dirnaichner