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

Add Verkehr-in-Zahlen as a Source #67

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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: '3077277'
ValidationKey: '3096320'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "edgeTransport: Prepare EDGE Transport Data for the REMIND model",
"version": "0.1.63",
"version": "0.1.64",
"description": "<p>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": [
{
Expand Down
4 changes: 2 additions & 2 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: 0.1.63
Version: 0.1.64
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"))
Expand All @@ -22,4 +22,4 @@ Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
VignetteBuilder: knitr
Date: 2021-09-09
Date: 2021-09-10
4 changes: 4 additions & 0 deletions R/generateEDGEdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ generateEDGEdata <- function(input_folder, output_folder,
## LF in p/v (or t/v)
## energy intensity pkm/MJ
## Annual mileage in km/year. Every entry in the output is on ISO level

print("-- load Verkehr-in-Zahlen data")
viz_dt <- lvl0_loadViZ(input_folder=input_folder)

print("-- merge costs, LF, annual mileage from the various sources")
merged_data <- lvl0_mergeDat(UCD_output= UCD_output, PSI_costs = PSI_costs, altCosts = altCosts, PSI_int=PSI_int, CHN_trucks = CHN_trucks, EU_data = EU_data, trsp_incent = trsp_incent, fcr_veh = fcr_veh, nper_amort_veh=nper_amort_veh, GCAM_data = GCAM_data, smartlifestyle = smartlifestyle, years = years, REMIND2ISO_MAPPING = REMIND2ISO_MAPPING)

Expand Down
30 changes: 30 additions & 0 deletions R/lvl0_loadSources.R
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,34 @@ lvl0_AltHDV=function(UCD_output){
}


#' Load Verkehr-in-Zahlen data
#'
#' Loads demand (pkm) for:
#' Biking, Walking, Busses, Trains, LDV, planes
#'
#' Final units for demand: billion pkm

#' @param input_folder folder hosting raw data
#' @param viz_dir directory with ViZ data
#'
#' @importFrom readxl read_excel

lvl0_loadViZ <- function(input_folder, viz_dir = "ViZ"){
`...1` <- `..yrs` <- value <- category <- NULL
viz_path <- file.path(input_folder, viz_dir, "verkehr-in-zahlen-2020-xls.xlsx")
dt <- data.table(read_excel(path=viz_path, sheet="Seite 224", "A5:T39"))

dt <- rbind(
dt,
data.table(read_excel(path=viz_path, sheet="Seite 225","A2:T32", col_names=colnames(dt))))

yrs <- c("2010", "2018")
dt <- cbind(
categories <- dt[seq(3, nrow(dt), 9)][["1976...10"]],
dt[...1 == "Summe", ..yrs])

setnames(dt, "V1", "category")
dt <- melt(dt, id.vars="category", variable.name="year", variable.factor=FALSE)
dt[, `:=`(iso="DEU", unit="billion pkm", year=as.numeric(year), value=as.numeric(value))]
return(dt[category != "Summe"])
}
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 **0.1.63**
R package **edgeTransport**, version **0.1.64**

[![CRAN status](https://www.r-pkg.org/badges/version/edgeTransport)](https://cran.r-project.org/package=edgeTransport)

Expand Down Expand Up @@ -46,7 +46,7 @@ In case of questions / problems please contact Alois Dirnaichner <dirnaichner@pi

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

Dirnaichner A, Rottoli M (2021). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 0.1.63.
Dirnaichner A, Rottoli M (2021). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 0.1.64.

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 = {Alois Dirnaichner and Marianna Rottoli},
year = {2021},
note = {R package version 0.1.63},
note = {R package version 0.1.64},
}
```