Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pik-piam/mrremind into st…
Browse files Browse the repository at this point in the history
…ationary
  • Loading branch information
fbenke-pik committed Dec 9, 2024
2 parents 9ec9ad0 + f43a18d commit 7468ed4
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '40523220'
ValidationKey: '40729920'
AcceptedWarnings:
- Invalid URL: .*
- 'Warning: package ''.*'' was built under R 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: 'mrremind: MadRat REMIND Input Data Package'
version: 0.202.0
date-released: '2024-12-04'
version: 0.203.0
date-released: '2024-12-07'
abstract: The mrremind packages contains data preprocessing for the REMIND model.
authors:
- family-names: Baumstark
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: mrremind
Title: MadRat REMIND Input Data Package
Version: 0.202.0
Date: 2024-12-04
Version: 0.203.0
Date: 2024-12-07
Authors@R: c(
person("Lavinia", "Baumstark", , "[email protected]", role = c("aut", "cre")),
person("Renato", "Rodrigues", role = "aut"),
Expand Down
29 changes: 18 additions & 11 deletions R/calcTaxConvergence.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,36 @@
#' @description tax convergence levels for specific regions
#'
#' @return magpie object of the tax convergence levels
#' @param subtype either taxConvergence or taxConvergenceRollback
#'
#' @author Renato Rodrigues
#' @examples
#' \dontrun{
#' calcOutput("TaxConvergence")
#' }
#'
calcTaxConvergence <- function() {
calcTaxConvergence <- function(subtype) {

if (subtype == "taxConvergence") {

# Read tax convergence levels at specific year and final energy type
taxConvergence <- readSource("REMIND_11Regi", subtype = "taxConvergence")
# Read tax convergence levels at specific year and final energy type
taxConvergence <- readSource("REMIND_11Regi", subtype = "taxConvergence")

# convert data from $2005 to $2017
taxConvergence <- GDPuc::toolConvertGDP(
gdp = taxConvergence,
unit_in = "constant 2005 US$MER",
unit_out = mrdrivers::toolGetUnitDollar(),
replace_NAs = "with_USA"
)
} else {
taxConvergence <- readSource("ExpertGuess", subtype = "taxConvergenceRollback")
}

# average weight
w <- taxConvergence
w[, , ] <- 1

# convert data from $2005 to $2017
taxConvergence <- GDPuc::toolConvertGDP(
gdp = taxConvergence,
unit_in = "constant 2005 US$MER",
unit_out = mrdrivers::toolGetUnitDollar(),
replace_NAs = "with_USA"
)

return(list(
x = taxConvergence,
weight = w,
Expand Down
3 changes: 3 additions & 0 deletions R/convertExpertGuess.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ convertExpertGuess <- function(x, subtype) {
),
weight = NULL
)
} else if (subtype == "taxConvergenceRollback") {
mapping <- toolGetMapping(type = "regional", name = "regionmappingH12.csv", where = "mappingfolder")
out <- toolAggregate(x, mapping, weight = NULL, from = "RegionCode", to = "CountryCode")
} else {
out <- x
}
Expand Down
7 changes: 6 additions & 1 deletion R/fullREMIND.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ fullREMIND <- function() {
calcOutput("MacroInvestments", round = 8, file = "p01_boundInvMacro.cs4r")
calcOutput("FETaxes", subtype = "taxes", round = 2, file = "f21_tau_fe_tax.cs4r")
calcOutput("FETaxes", subtype = "subsidies", round = 2, file = "f21_tau_fe_sub.cs4r")
calcOutput("TaxConvergence", round = 2, file = "f21_tax_convergence.cs4r")

calcOutput("TaxConvergence", subtype = "taxConvergence", round = 2,
file = "f21_tax_convergence.cs4r")
calcOutput("TaxConvergence", subtype = "taxConvergenceRollback", round = 2,
file = "f21_tax_convergence_rollback.cs4r")

calcOutput("TaxLimits", subtype = "maxFeSubsidy", round = 2, file = "f21_max_fe_sub.cs4r")
calcOutput("TaxLimits", subtype = "maxPeSubsidy", round = 2, file = "f21_max_pe_sub.cs4r")
calcOutput("TaxLimits", subtype = "propFeSubsidy", round = 2, file = "f21_prop_fe_sub.cs4r")
Expand Down
4 changes: 4 additions & 0 deletions R/readExpertGuess.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ readExpertGuess <- function(subtype) {
} else if (subtype == "tradeConstraints") {
a <- read.csv("tradeConstraints.csv", sep = ";")
out <- as.magpie(a)
} else if (subtype == "taxConvergenceRollback") {
out <- read.csv("tax_convergence_rollback.csv", sep = ",",
skip = 4, col.names = c("Year", "Region", "FE", "value"),
header = FALSE) %>% as.magpie(datacol = 4)
}

return(out)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MadRat REMIND Input Data Package

R package **mrremind**, version **0.202.0**
R package **mrremind**, version **0.203.0**

[![CRAN status](https://www.r-pkg.org/badges/version/mrremind)](https://cran.r-project.org/package=mrremind) [![R build status](https://github.com/pik-piam/mrremind/workflows/check/badge.svg)](https://github.com/pik-piam/mrremind/actions) [![codecov](https://codecov.io/gh/pik-piam/mrremind/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrremind) [![r-universe](https://pik-piam.r-universe.dev/badges/mrremind)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -39,7 +39,7 @@ In case of questions / problems please contact Lavinia Baumstark <lavinia@pik-po

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

Baumstark L, Rodrigues R, Levesque A, Oeser J, Bertram C, Mouratiadou I, Malik A, Schreyer F, Soergel B, Rottoli M, Mishra A, Dirnaichner A, Pehl M, Giannousakis A, Klein D, Strefler J, Feldhaus L, Brecha R, Rauner S, Dietrich J, Bi S, Benke F, Weigmann P, Richters O, Hasse R, Fuchs S, Mandaroux R, Koch J (2024). _mrremind: MadRat REMIND Input Data Package_. R package version 0.202.0, <https://github.com/pik-piam/mrremind>.
Baumstark L, Rodrigues R, Levesque A, Oeser J, Bertram C, Mouratiadou I, Malik A, Schreyer F, Soergel B, Rottoli M, Mishra A, Dirnaichner A, Pehl M, Giannousakis A, Klein D, Strefler J, Feldhaus L, Brecha R, Rauner S, Dietrich J, Bi S, Benke F, Weigmann P, Richters O, Hasse R, Fuchs S, Mandaroux R, Koch J (2024). _mrremind: MadRat REMIND Input Data Package_. R package version 0.203.0, <https://github.com/pik-piam/mrremind>.

A BibTeX entry for LaTeX users is

Expand All @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is
title = {mrremind: MadRat REMIND Input Data Package},
author = {Lavinia Baumstark and Renato Rodrigues and Antoine Levesque and Julian Oeser and Christoph Bertram and Ioanna Mouratiadou and Aman Malik and Felix Schreyer and Bjoern Soergel and Marianna Rottoli and Abhijeet Mishra and Alois Dirnaichner and Michaja Pehl and Anastasis Giannousakis and David Klein and Jessica Strefler and Lukas Feldhaus and Regina Brecha and Sebastian Rauner and Jan Philipp Dietrich and Stephen Bi and Falk Benke and Pascal Weigmann and Oliver Richters and Robin Hasse and Sophie Fuchs and Rahel Mandaroux and Johannes Koch},
year = {2024},
note = {R package version 0.202.0},
note = {R package version 0.203.0},
url = {https://github.com/pik-piam/mrremind},
}
```
4 changes: 2 additions & 2 deletions inst/extdata/reportingVariables/Mapping_Ember.csv
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Electricity generation|Fuel|Wind;TWh;SE|Electricity|Wind;EJ/yr;;0.0036
Electricity generation|Total|Total Generation;TWh;SE|Electricity;EJ/yr;;0.0036
Electricity imports|Electricity imports|Net Imports;TWh;;;;
Power sector emissions|Aggregate fuel|Clean;mtCO2;;;actually is CO2eq;
Power sector emissions|Aggregate fuel|Fossil;mtCO2;;;;
Power sector emissions|Aggregate fuel|Fossil;mtCO2;Emi|CO2|Energy|Supply|Electricity w/ couple prod;Mt CO2/yr;;1
Power sector emissions|Aggregate fuel|Gas and Other Fossil;mtCO2;;;;
Power sector emissions|Aggregate fuel|Hydro, Bioenergy and Other Renewables;mtCO2;;;;
Power sector emissions|Aggregate fuel|Renewables;mtCO2;;;;
Expand All @@ -64,4 +64,4 @@ Power sector emissions|Fuel|Other Fossil;mtCO2;;;;
Power sector emissions|Fuel|Other Renewables;mtCO2;;;;
Power sector emissions|Fuel|Solar;mtCO2;;;;
Power sector emissions|Fuel|Wind;mtCO2;;;;
Power sector emissions|Total|Total emissions;mtCO2;Emi|CO2|Energy|Supply|Electricity w/ couple prod;Mt CO2eq/yr;;1
Power sector emissions|Total|Total emissions;mtCO2;;;;
5 changes: 4 additions & 1 deletion man/calcTaxConvergence.Rd

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

0 comments on commit 7468ed4

Please sign in to comment.