Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit shift #291

Merged
merged 7 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '5418103'
ValidationKey: '5461911'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::lucode2
any::covr
any::madrat
any::magclass
any::citation
any::gms
any::goxygen
any::GDPuc
lucode2
covr
madrat
magclass
citation
gms
goxygen
GDPuc
# piam packages also available on CRAN (madrat, magclass, citation,
# gms, goxygen, GDPuc) will usually have an outdated binary version
# available; by using extra-packages we get the newest version
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'edgeTransport: Prepare EDGE Transport Data for the REMIND model'
version: 2.7.1
date-released: '2024-09-27'
version: 2.7.3
date-released: '2024-10-11'
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
Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: edgeTransport
Title: Prepare EDGE Transport Data for the REMIND model
Version: 2.7.1
Version: 2.7.3
Authors@R: c(
person("Johanna", "Hoppe", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0009-0004-6753-5090")),
Expand All @@ -11,14 +11,15 @@ Description: EDGE-T is a fork of the GCAM transport module https://jgcri.github.
Depends:
R (>= 3.5.0),
data.table (>= 1.11.0),
mrtransport (>= 0.6.0)
mrtransport (>= 0.6.0),
GDPuc (>= 1.3.0)
License: GPL-3
URL: https://github.com/pik-piam/edgeTransport
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
VignetteBuilder: knitr
Date: 2024-09-27
Date: 2024-10-11
Config/testthat/edition: 3
Imports:
rmndt,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export(toolOrderandCheck)
export(toolPrepareScenInputData)
export(toolTraverseDecisionTree)
export(toolUpdateEndogenousCosts)
import(GDPuc)
import(data.table)
import(mrtransport)
importFrom(data.table,fread)
Expand Down
2 changes: 1 addition & 1 deletion R/imports.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by lucode2: do not edit by hand

#' @import data.table mrtransport
#' @import data.table mrtransport GDPuc
NULL
4 changes: 2 additions & 2 deletions R/toolEdgeTransportSA.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ toolEdgeTransportSA <- function(SSPscen,
isAnalyticsReported = FALSE){

# set GDP cutoff to differentiate between regions
GDPcutoff <- 25000 # [constant 2005 US$MER]
GDPcutoff <- 30800 # [constant 2017 US$MER]
# Year when scenario differentiation sets in
policyStartYear <- 2021
# last time step of historical data
Expand All @@ -47,7 +47,7 @@ toolEdgeTransportSA <- function(SSPscen,
########################################################
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.1", "fulldata.gdx")}
"REMINDinputForTransportStandalone", "v1.0", "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)
Expand Down
9 changes: 9 additions & 0 deletions R/toolLoadREMINDfuelCosts.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ toolLoadREMINDfuelCosts <- function(gdxPath, hybridElecShare, helpers){

# load prices from REMIND gdx
fuelCosts <- readGDX(gdxPath, "pm_FEPrice", format = "first_found", restore_zeros = FALSE)[,, "trans.ES", pmatch = TRUE]

fuelCosts <- GDPuc::toolConvertGDP(
gdp = fuelCosts,
unit_in = "constant 2005 US$MER",
unit_out = "constant 2017 US$MER",
replace_NAs = "with_USA"
)

## smooth prices from REMIND gdx (over years) and convert to data.table
fuelCosts <- fuelCosts %>% lowpass() %>% magpie2dt()
setnames(fuelCosts, c("all_regi", "ttot"), c("region", "period"))
Expand All @@ -32,6 +40,7 @@ toolLoadREMINDfuelCosts <- function(gdxPath, hybridElecShare, helpers){
fuelCosts[, value := value * tdptwyr2dpgj * GJtoMJ] # US$2017/MJ
# map on EDGE-T structure
fuelCosts <- merge(fuelCosts, mapEdgeToREMIND, by = "all_enty", all.y = TRUE, allow.cartesian = TRUE)[, all_enty := NULL]

# calculate price for hybrids
dummy <- fuelCosts[univocalName %in% helpers$filterEntries$trn_pass_road_LDV_4W & technology %in% c("BEV", "Liquids")]
fuelCostsHybrids <- dummy %>%
Expand Down
3 changes: 0 additions & 3 deletions R/toolLoadmrremindData.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ toolLoadmrremindData <- function(helpers) {
setnames(subsidies, "variable", "technology")
#average between legal and private entities
subsidies <- subsidies[, .(value = mean(value)), by = c("region", "period", "technology")]
# exchange rate 2020: 1 euro = 1.12 dollar
# conversion from EUR2020 to US$2017 : inflation/exchange rate = 1.3504/1.12 = 1.205714286
subsidies[, value := value / 1.205714286] # in 2005 USD
subsidies[, value := - value] # count subsidies negative
completeSub <- unique(subsidies[, c("region", "technology")])[, temporal := "all"]
temporal <- data.table(period = yrs)[, temporal := "all"]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prepare EDGE Transport Data for the REMIND model

R package **edgeTransport**, version **2.7.1**
R package **edgeTransport**, version **2.7.3**

[![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://app.codecov.io/gh/pik-piam/edgeTransport) [![r-universe](https://pik-piam.r-universe.dev/badges/edgeTransport)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -46,7 +46,7 @@ In case of questions / problems please contact Johanna Hoppe <johanna.hoppe@pik-

To cite package **edgeTransport** in publications use:

Hoppe J, Dirnaichner A, Rottoli M, Muessel J (2024). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 2.7.1, <https://github.com/pik-piam/edgeTransport>.
Hoppe J, Dirnaichner A, Rottoli M, Muessel J (2024). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 2.7.3, <https://github.com/pik-piam/edgeTransport>.

A BibTeX entry for LaTeX users is

Expand All @@ -55,7 +55,7 @@ A BibTeX entry for LaTeX users is
title = {edgeTransport: Prepare EDGE Transport Data for the REMIND model},
author = {Johanna Hoppe and Alois Dirnaichner and Marianna Rottoli and Jarusch Muessel},
year = {2024},
note = {R package version 2.7.1},
note = {R package version 2.7.3},
url = {https://github.com/pik-piam/edgeTransport},
}
```
84 changes: 0 additions & 84 deletions inst/extdata/scenParDemFactors.csv
Original file line number Diff line number Diff line change
Expand Up @@ -167,90 +167,6 @@ SSP2_demRedWeak;REF;trn_pass;2050;0.95
SSP2_demRedWeak;SSA;trn_pass;2050;0.95
SSP2_demRedWeak;UKI;trn_pass;2050;0.95
SSP2_demRedWeak;USA;trn_pass;2050;0.95
SSP2_demRedLow;CAZ;trn_aviation_intl;2050;0.93
SSP2_demRedLow;CHA;trn_aviation_intl;2050;0.93
SSP2_demRedLow;DEU;trn_aviation_intl;2050;0.93
SSP2_demRedLow;ECE;trn_aviation_intl;2050;0.93
SSP2_demRedLow;ECS;trn_aviation_intl;2050;0.93
SSP2_demRedLow;ENC;trn_aviation_intl;2050;0.93
SSP2_demRedLow;ESC;trn_aviation_intl;2050;0.93
SSP2_demRedLow;ESW;trn_aviation_intl;2050;0.93
SSP2_demRedLow;EWN;trn_aviation_intl;2050;0.93
SSP2_demRedLow;FRA;trn_aviation_intl;2050;0.93
SSP2_demRedLow;IND;trn_aviation_intl;2050;0.93
SSP2_demRedLow;JPN;trn_aviation_intl;2050;0.93
SSP2_demRedLow;LAM;trn_aviation_intl;2050;0.93
SSP2_demRedLow;MEA;trn_aviation_intl;2050;0.93
SSP2_demRedLow;NEN;trn_aviation_intl;2050;0.93
SSP2_demRedLow;NES;trn_aviation_intl;2050;0.93
SSP2_demRedLow;OAS;trn_aviation_intl;2050;0.93
SSP2_demRedLow;REF;trn_aviation_intl;2050;0.93
SSP2_demRedLow;SSA;trn_aviation_intl;2050;0.93
SSP2_demRedLow;UKI;trn_aviation_intl;2050;0.93
SSP2_demRedLow;USA;trn_aviation_intl;2050;0.93
SSP2_demRedLow;CAZ;trn_shipping_intl;2050;0.99
SSP2_demRedLow;CHA;trn_shipping_intl;2050;0.99
SSP2_demRedLow;DEU;trn_shipping_intl;2050;0.99
SSP2_demRedLow;ECE;trn_shipping_intl;2050;0.99
SSP2_demRedLow;ECS;trn_shipping_intl;2050;0.99
SSP2_demRedLow;ENC;trn_shipping_intl;2050;0.99
SSP2_demRedLow;ESC;trn_shipping_intl;2050;0.99
SSP2_demRedLow;ESW;trn_shipping_intl;2050;0.99
SSP2_demRedLow;EWN;trn_shipping_intl;2050;0.99
SSP2_demRedLow;FRA;trn_shipping_intl;2050;0.99
SSP2_demRedLow;IND;trn_shipping_intl;2050;0.99
SSP2_demRedLow;JPN;trn_shipping_intl;2050;0.99
SSP2_demRedLow;LAM;trn_shipping_intl;2050;0.99
SSP2_demRedLow;MEA;trn_shipping_intl;2050;0.99
SSP2_demRedLow;NEN;trn_shipping_intl;2050;0.99
SSP2_demRedLow;NES;trn_shipping_intl;2050;0.99
SSP2_demRedLow;OAS;trn_shipping_intl;2050;0.99
SSP2_demRedLow;REF;trn_shipping_intl;2050;0.99
SSP2_demRedLow;SSA;trn_shipping_intl;2050;0.99
SSP2_demRedLow;UKI;trn_shipping_intl;2050;0.99
SSP2_demRedLow;USA;trn_shipping_intl;2050;0.99
SSP2_demRedLow;CAZ;trn_freight;2050;0.92
SSP2_demRedLow;CHA;trn_freight;2050;0.92
SSP2_demRedLow;DEU;trn_freight;2050;0.92
SSP2_demRedLow;ECE;trn_freight;2050;0.92
SSP2_demRedLow;ECS;trn_freight;2050;0.92
SSP2_demRedLow;ENC;trn_freight;2050;0.92
SSP2_demRedLow;ESC;trn_freight;2050;0.92
SSP2_demRedLow;ESW;trn_freight;2050;0.92
SSP2_demRedLow;EWN;trn_freight;2050;0.92
SSP2_demRedLow;FRA;trn_freight;2050;0.92
SSP2_demRedLow;IND;trn_freight;2050;0.92
SSP2_demRedLow;JPN;trn_freight;2050;0.92
SSP2_demRedLow;LAM;trn_freight;2050;0.92
SSP2_demRedLow;MEA;trn_freight;2050;0.92
SSP2_demRedLow;NEN;trn_freight;2050;0.92
SSP2_demRedLow;NES;trn_freight;2050;0.92
SSP2_demRedLow;OAS;trn_freight;2050;0.92
SSP2_demRedLow;REF;trn_freight;2050;0.92
SSP2_demRedLow;SSA;trn_freight;2050;0.92
SSP2_demRedLow;UKI;trn_freight;2050;0.92
SSP2_demRedLow;USA;trn_freight;2050;0.92
SSP2_demRedLow;CAZ;trn_pass;2050;0.98
SSP2_demRedLow;CHA;trn_pass;2050;0.98
SSP2_demRedLow;DEU;trn_pass;2050;0.98
SSP2_demRedLow;ECE;trn_pass;2050;0.98
SSP2_demRedLow;ECS;trn_pass;2050;0.98
SSP2_demRedLow;ENC;trn_pass;2050;0.98
SSP2_demRedLow;ESC;trn_pass;2050;0.98
SSP2_demRedLow;ESW;trn_pass;2050;0.98
SSP2_demRedLow;EWN;trn_pass;2050;0.98
SSP2_demRedLow;FRA;trn_pass;2050;0.98
SSP2_demRedLow;IND;trn_pass;2050;0.98
SSP2_demRedLow;JPN;trn_pass;2050;0.98
SSP2_demRedLow;LAM;trn_pass;2050;0.98
SSP2_demRedLow;MEA;trn_pass;2050;0.98
SSP2_demRedLow;NEN;trn_pass;2050;0.98
SSP2_demRedLow;NES;trn_pass;2050;0.98
SSP2_demRedLow;OAS;trn_pass;2050;0.98
SSP2_demRedLow;REF;trn_pass;2050;0.98
SSP2_demRedLow;SSA;trn_pass;2050;0.98
SSP2_demRedLow;UKI;trn_pass;2050;0.98
SSP2_demRedLow;USA;trn_pass;2050;0.98
SSP2_demDiffer;CAZ;trn_aviation_intl;2040;0.7
SSP2_demDiffer;CHA;trn_aviation_intl;2040;1
SSP2_demDiffer;DEU;trn_aviation_intl;2040;0.7
Expand Down
Loading
Loading