Skip to content

Commit

Permalink
buildlib
Browse files Browse the repository at this point in the history
  • Loading branch information
johannah-pik committed May 23, 2024
1 parent 5b1a89f commit 555d033
Show file tree
Hide file tree
Showing 31 changed files with 365 additions and 159 deletions.
7 changes: 3 additions & 4 deletions .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
ValidationKey: '6043140'
ValidationKey: '30971113866'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
- '''.*'' is needed for checks on size reduction of PDFs'
AcceptedNotes:
- 'Undefined global functions or variables:'
AcceptedNotes: 'Undefined global functions or variables:'
allowLinterWarnings: yes

enforceVersionUpdate: no
5 changes: 2 additions & 3 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -23,7 +23,6 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
gamstransfer=?ignore
any::lucode2
any::covr
any::madrat
Expand All @@ -36,7 +35,7 @@ jobs:
# gms, goxygen, GDPuc) will usually have an outdated binary version
# available; by using extra-packages we get the newest version

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exclude: '^tests/testthat/_snaps/.*$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.0
rev: 7910e0323d7213f34275a7a562b9ef0fde8ce1b9 # frozen: v0.4.2
hooks:
- id: parsable-R
- id: deps-in-desc
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: 1.5.5
date-released: '2024-03-21'
version: 1.5.5.9001
date-released: '2024-05-23'
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
15 changes: 3 additions & 12 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: 1.5.5
Version: 1.5.5.9001
Authors@R: c(
person("Alois", "Dirnaichner", email = "[email protected]", role = c("aut", "cre")),
person("Marianna", "Rottoli", email = "[email protected]", role = "aut"),
Expand All @@ -15,26 +15,17 @@ Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Date: 2024-03-21
Date: 2024-05-23
Config/testthat/edition: 3
Imports:
rmndt,
magclass,
readxl,
rmarkdown,
rootSolve,
madrat,
ggplot2,
quitte,
zoo,
magrittr,
gdx,
gdxrrw,
gdxdt,
remind2,
rlang,
yaml,
ymlthis
reporttransport
Suggests:
testthat (>= 3.0.0),
knitr,
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ importFrom(reporttransport,toolReportEdgeTransport)
importFrom(rmndt,approx_dt)
importFrom(rmndt,magpie2dt)
importFrom(rootSolve,multiroot)
importFrom(stats,approxfun)
importFrom(utils,capture.output)
8 changes: 3 additions & 5 deletions R/iterativeEDGETransport.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#' EDGE-Transport iterative
#' EDGE-Transport iterative script
#'
#' Run in the REMIND output folder.
#' Run in the REMIND output folder in between iterations
#'
#' @md
#' @param reporting generate EDGE-T reporting data
#' @return NULL
#' @author Alois Dirnaichner
#' @author Johanna Hoppe
#' @importFrom data.table fread
#' @importFrom gdxrrw rgdx
#' @export
Expand Down
1 change: 1 addition & 0 deletions R/supportFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ toolCheckAllLevelsComplete <- function(data, decisionTree, name) {
#' @author Johanna Hoppe
#' @param data data.table containing data in all levels format that should be checked
#' @param decisionTree data.table containing full edgeTransport decision Tree
#' @param yrs temporal resolution
#' @param checkCompleteness if activated it is further checked, if the full data set is provided
#' @param fleetVars if activated the full data set is reduced to vehicle types that feature fleet tracking
#' @returns data.table
Expand Down
8 changes: 4 additions & 4 deletions R/supportFunctionsIterative.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#' Existing files are overwritten silently. Does not return anything.
#'
#' @param inputPath the path to the folder containing the input (csv-) files
#' @param dataPath the path to the output folder
#' @param demScen the SSP dimension, usually this refers to the GDP scenario in REMIND
#' @param DEM_scenario the demand scenario.
#' @param transportPolScen the EDGE-T scenario dimension
#' @param edgeTransportFolder the path to the EDGE-Transport folder
#' @param SSPscen SSP scenario
#' @param demScen demand scenario
#' @param transportPolScen Transport policy scenario
#' @import data.table
#' @export

Expand Down
2 changes: 1 addition & 1 deletion R/toolCalculateAnnuity.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @author Johanna Hoppe
#' @param annuityCalc input data for interest rate and service Life from edgeTransport
#' @param mitigationTechMap map to disaggregate vehicle types
#' @param helpers list with helpers
#' @import data.table


Expand Down
1 change: 1 addition & 0 deletions R/toolCalculateFS3share.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' @param timesteps years for which to calculate FS3 shares
#' @param timeValue data.table containing mode specific time value costs based on speed and gdp
#' @param lambdas data.table containing exponents for discrete choice calculation
#' @param preferences data.table containing preference trends
#' @param helpers list containing helpers like mappings, decisionTree etc.
#' @return data.table containing all cost components on technology level and their respective FS3 shares
#' @author Johanna Hoppe
Expand Down
1 change: 1 addition & 0 deletions R/toolCalibrateHistPrefs.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#' @returns data.table with calibrated historical preferences
#'
#' @importFrom rootSolve multiroot
#' @importFrom utils capture.output


toolCalibrateHistPrefs <- function(combinedCosts, histESdemand, timeValueCost, lambdas, helpers){
Expand Down
16 changes: 11 additions & 5 deletions R/toolCombineCAPEXandOPEX.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#' Function that converts CAPEX and OPEX into US$2005/(p|t)km and provides them combined in a structured format
#' @param mrtransportInput list containing all mrtransport input data
#'
#' @param CAPEXtrackedFleet CAPEX data for vehicle types that feature fleet tracking: Cars, trucks, busses
#' @param nonFuelOPEXtrackedFleet non-fuel OPEX data for vehicle types that feature fleet tracking: Cars, trucks, busses
#' @param CAPEXother CAPEX data for other vehicle types
#' @param nonFuelOPEXother non-fuel OPEX data for other vehicle types
#' @param fuelCosts fuel cost data
#' @param subsidies purchase price subsidy data
#' @param energyIntensity energy intensity data
#' @param loadFactor load factor data
#' @param annualMileage annual mileage data
#' @param annuity calculated annuity for different vehicle types
#' @param fuelCosts fuel costs from REMIND
#' @param subsidies subsides for alternative cars from mrremind
#' @param decisionTree edgeTransport decision tree
#' @param filter list of filters for specific branches in the upper decision tree, containing all associated univocalNames
#' @param helpers list with helpers
#' @import data.table
#' @returns data.table including total costs of ownership in US$2005/(p|t)km

Expand Down
1 change: 1 addition & 0 deletions R/toolDemandRegression.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' @param helpers list with helpers
#' @returns Scenario specific energy service demand for all model years on CES level
#' @author Johanna Hoppe
#' @importFrom stats approxfun
#' @import data.table
#' @export

Expand Down
1 change: 1 addition & 0 deletions R/toolEdgeTransportSA.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#'
#' @param SSPscen SSP or SDP scenario
#' @param transportPolScen EDGE-T transport policy scenario
#' @param isICEban optional enabling of ICE ban
#' @param demScen Demand scenario, used to apply reduction factors on total demands from the regression
#' @param gdxPath Path to a GDX file to load price signals from a REMIND run
#' @param outputFolder Path to folder for storing output data
Expand Down
7 changes: 4 additions & 3 deletions R/toolLoadREMINDesDemand.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#' Load the energy service demand from a REMIND fulldata.gdx on sector level (CES level) in [bn (p|t)km/yr] and the requested temporal resolution
#' Load REMIND energy service demand
#'
#' Load the energy service demand from a REMIND fulldata.gdx on sector level (CES level)
#' in [bn (p|t)km/yr] and the requested temporal resolution
#'
#' @param gdxPath path to REMIND fulldata.gdx
#' @param yrs requested temporal resolution
#'
#' @import data.table
#' @importFrom gdx readGDX
#' @export


toolLoadREMINDesDemand <- function(gdxPath) {
value <- unit <- variable <- NULL

Expand Down
1 change: 1 addition & 0 deletions R/toolPrepareScenInputData.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' @param policyStartYear Year when scenario differentiation sets in
#' @param GDPcutoff GDP cutoff to differentiate between regions
#' @param helpers List with helpers
#' @param isICEban optional enabling of ICE ban
#' @returns List of data.tables with scenario specific input data
#' @import data.table
#' @export
Expand Down
6 changes: 4 additions & 2 deletions R/toolUpdateEndogenousCosts.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
#' @param scenParIncoCost data.table containing scenario specific parameters for inconvenience costs policy mask
#' @param policyStartYear year from which scenario-specific differentiation begins
#' @param timeValue data.table containing mode specific time value costs based on speed and gdp
#' @param preferences preference factor trends
#' @param lambdas data.table containing exponents for discrete choice calculation
#' @param helpers list containing helpers like mappings, decisionTree etc.
#' @param numberOfvehicles data.table containing total number of vehicles for all years and regions
#' @param isICEban optional enabling of ICE ban
#' @param vehiclesPerTech data.table containing total number of vehicles for all years and regions
#' @return list containing data.table with endogenous cost components over the full time span and additional data.tables
#' for model behaviour analysis
#' for model behavior analysis
#' @author Johanna Hoppe
#' @import data.table
#' @export
Expand Down
8 changes: 4 additions & 4 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 **1.5.5**
R package **edgeTransport**, version **1.5.5.9001**

[![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 @@ -35,7 +35,7 @@ update.packages()
The package comes with a vignette describing the basic functionality of the package and how to use it. You can load it with the following command (the package needs to be installed):

```r
vignette("EDGEtransport") # Data preparation with EDGEtransport
vignette("EDGEtransport") # EnergyDemandGenerator-Transport Model (EDGE-T)
```

## Questions / Problems
Expand All @@ -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, Hoppe J (2024). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 1.5.5, <URL: https://github.com/pik-piam/edgeTransport>.
Dirnaichner A, Rottoli M, Hoppe J (2024). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 1.5.5.9001, <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 = {Alois Dirnaichner and Marianna Rottoli and Johanna Hoppe},
year = {2024},
note = {R package version 1.5.5},
note = {R package version 1.5.5.9001},
url = {https://github.com/pik-piam/edgeTransport},
}
```
2 changes: 1 addition & 1 deletion man/toolCalculateAnnuity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/toolCalculateFS3share.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions man/toolCombineCAPEXandOPEX.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/toolCreateRDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/toolEdgeTransportSA.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions man/toolIterativeEDGETransport.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 555d033

Please sign in to comment.