Skip to content

Commit

Permalink
Merge pull request #622 from fbenke-pik/master
Browse files Browse the repository at this point in the history
move matchDim to magclass
  • Loading branch information
fbenke-pik authored Jun 28, 2024
2 parents d923dc8 + f566ac4 commit 0becf0d
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '227937606'
ValidationKey: '227957508'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'remind2: The REMIND R package (2nd generation)'
version: 1.145.3
version: 1.145.4
date-released: '2024-06-28'
abstract: Contains the REMIND-specific routines for data and model output manipulation.
authors:
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: remind2
Title: The REMIND R package (2nd generation)
Version: 1.145.3
Version: 1.145.4
Date: 2024-06-28
Authors@R: c(
person("Renato", "Rodrigues", , "renato.rodrigues@pik-potsdam.de", role = c("aut", "cre")),
Expand Down Expand Up @@ -42,7 +42,7 @@ Description: Contains the REMIND-specific routines for data and model
License: LGPL-3
URL: https://github.com/pik-piam/remind2
Depends:
magclass (>= 3.37)
magclass (>= 6.16.1)
Imports:
abind,
assertr,
Expand Down Expand Up @@ -85,6 +85,6 @@ Suggests:
VignetteBuilder:
knitr
Encoding: UTF-8
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Config/testthat/parallel: true
Config/testthat/edition: 3
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ export(getRunsMIFGDX)
export(get_total_efficiencies)
export(loadCs2Data)
export(loadModeltest)
export(matchDim)
export(matchRegions)
export(matchYears)
export(nashAnalysis)
export(plotLCOE)
export(plotNashConvergence)
Expand Down Expand Up @@ -195,7 +192,6 @@ importFrom(magclass,mbind)
importFrom(magclass,mcalc)
importFrom(magclass,mselect)
importFrom(magclass,ndata)
importFrom(magclass,ndim)
importFrom(magclass,new.magpie)
importFrom(magclass,read.report)
importFrom(magclass,setItems)
Expand Down
94 changes: 0 additions & 94 deletions R/matchDim.R

This file was deleted.

6 changes: 2 additions & 4 deletions R/reportClimate.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ reportClimate <- function(
pm_globalMeanTemperature <- readGDX(gdx, "pm_globalMeanTemperature", react = "silent", restore_zeros = FALSE)
if (!is.null(pm_globalMeanTemperature)) {
pm_globalMeanTemperature <- setNames(pm_globalMeanTemperature, "Temperature|Global Mean (K)")
pm_globalMeanTemperature <- matchYears(pm_globalMeanTemperature, output, fill = NA)
pm_globalMeanTemperature <- matchRegions(pm_globalMeanTemperature, output, fill = NA)
pm_globalMeanTemperature <- magclass::matchDim(pm_globalMeanTemperature, output, dim = c(1, 2), fill = NA)
} else {
message("reportClimate.R: pm_globalMeanTemperature not found in GDX file.")
}
p15_forc_magicc <- readGDX(gdx, "p15_forc_magicc", react = "silent", restore_zeros = FALSE)
if (!is.null(p15_forc_magicc)) {
p15_forc_magicc <- setNames(p15_forc_magicc, "Forcing (W/m2)")
p15_forc_magicc <- matchYears(p15_forc_magicc, output, fill = NA)
p15_forc_magicc <- matchRegions(p15_forc_magicc, output, fill = NA)
p15_forc_magicc <- magclass::matchDim(p15_forc_magicc, output, dim = c(1, 2), fill = NA)
} else {
message("reportClimate.R: p15_forc_magicc not found in GDX file.")
}
Expand Down
6 changes: 3 additions & 3 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL,
if (length(vm_demFENonEnergySector) == 0) {
vm_demFENonEnergySector <- NULL
} else {
vm_demFENonEnergySector <- matchDim(vm_demFENonEnergySector, vm_demFeSector)
vm_demFENonEnergySector <- magclass::matchDim(vm_demFENonEnergySector, vm_demFeSector)
}

# secondary energy production
Expand Down Expand Up @@ -326,7 +326,7 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL,
react = "silent")[,t,]
}
else {
vm_incinerationEmi <- matchDim(vm_incinerationEmi, v37_plasticsCarbon,
vm_incinerationEmi <- magclass::matchDim(vm_incinerationEmi, v37_plasticsCarbon,
fill = 0)
}

Expand All @@ -337,7 +337,7 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL,
if (is.null(vm_incinerationCCS)) {
rm('vm_incinerationCCS')
} else {
vm_incinerationCCS <- matchDim(vm_incinerationCCS, vm_incinerationEmi)
vm_incinerationCCS <- magclass::matchDim(vm_incinerationCCS, vm_incinerationEmi)
}

vm_nonIncineratedPlastics <- readGDX(gdx, "vm_nonIncineratedPlastics", field = "l", restore_zeros = FALSE,
Expand Down
4 changes: 2 additions & 2 deletions R/reportLCOE.R
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ reportLCOE <- function(gdx, output.type = "both"){

# 2.2 secondary fuel cost
Fuel.Price <- mbind(pm_PEPrice,pm_SEPrice )[,,]*1e12 # convert from trUSD2005/TWa to USD2005/TWa [note: this already includes the CO2 price]
Fuel.Price <- matchRegions(Fuel.Price, vm_prodSe, fill = 0)
Fuel.Price <- magclass::matchDim(Fuel.Price, vm_prodSe, dim = c(1), fill = 0)

pm_SecFuel <- pm_prodCouple[,,getNames(pm_prodCouple)[pm_prodCouple[reg1,,]<0]] # keep only second fuel consumption, not co-production
SecFuelTechs <- intersect(getNames(pm_SecFuel, dim = 3), pc2te$all_te) # determine all te that have couple production
Expand Down Expand Up @@ -1203,7 +1203,7 @@ df.co2price.weighted <- df.pomeg.expand %>%
p33_fedem[,,"dac.fehes"] <- p33_dac_fedem_heat[,,"fehes"]
}

Fuel.Price <- matchRegions(Fuel.Price, p33_fedem, fill = 0)
Fuel.Price <- magclass::matchDim(Fuel.Price, p33_fedem, dim = c(1), fill = 0)
# capital cost in trUSD2005/GtC -> convert to USD2015/tCO2
LCOD[,,"Investment Cost"] <- vm_costTeCapital[,,"dac"] * 1.2 / 3.66 /vm_capFac[,,"dac"] * p_teAnnuity[,,"dac"]*1e3
LCOD[,,"OMF Cost"] <- pm_data_omf[,,"dac"]*vm_costTeCapital[,,"dac"] * 1.2 / 3.66 /vm_capFac[,,"dac"]*1e3
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The REMIND R package (2nd generation)

R package **remind2**, version **1.145.3**
R package **remind2**, version **1.145.4**

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

Expand Down Expand Up @@ -49,7 +49,7 @@ In case of questions / problems please contact Renato Rodrigues <renato.rodrigue

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

Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Duerrwaechter J, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P, Rüter T (2024). _remind2: The REMIND R package (2nd generation)_. R package version 1.145.3, <https://github.com/pik-piam/remind2>.
Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Duerrwaechter J, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P, Rüter T (2024). _remind2: The REMIND R package (2nd generation)_. R package version 1.145.4, <https://github.com/pik-piam/remind2>.

A BibTeX entry for LaTeX users is

Expand All @@ -58,7 +58,7 @@ A BibTeX entry for LaTeX users is
title = {remind2: The REMIND R package (2nd generation)},
author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Jakob Duerrwaechter and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort and Pascal Weigmann and Tonn Rüter},
year = {2024},
note = {R package version 1.145.3},
note = {R package version 1.145.4},
url = {https://github.com/pik-piam/remind2},
}
```
19 changes: 0 additions & 19 deletions man/matchDim.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/matchRegions.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/matchYears.Rd

This file was deleted.

38 changes: 0 additions & 38 deletions tests/testthat/test-matchDim.R

This file was deleted.

0 comments on commit 0becf0d

Please sign in to comment.