Skip to content

Commit

Permalink
Merge pull request pik-piam#465 from orichters/rawdata
Browse files Browse the repository at this point in the history
always name data dimension 'variable' in report functions
  • Loading branch information
orichters authored Oct 2, 2023
2 parents 411680b + 766f7f8 commit 1bc3580
Show file tree
Hide file tree
Showing 25 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '219696204'
ValidationKey: '219760608'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
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: 'remind2: The REMIND R package (2nd generation)'
version: 1.119.3
date-released: '2023-09-28'
version: 1.119.4
date-released: '2023-10-02'
abstract: Contains the REMIND-specific routines for data and model output manipulation.
authors:
- family-names: Rodrigues
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: remind2
Title: The REMIND R package (2nd generation)
Version: 1.119.3
Date: 2023-09-28
Version: 1.119.4
Date: 2023-10-02
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions R/reportCapacity.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,6 @@ reportCapacity <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5
if (!is.null(regionSubsetList))
tmp <- mbind(tmp, calc_regionSubset_sums(tmp, regionSubsetList))

getSets(tmp)[3] <- "variable"
return(tmp)
}
1 change: 1 addition & 0 deletions R/reportCapitalStock.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,6 @@ reportCapitalStock <- function(gdx,regionSubsetList=NULL,t=c(seq(2005,2060,5),se
if (!is.null(regionSubsetList))
tmp <- mbind(tmp, calc_regionSubset_sums(tmp, regionSubsetList))

getSets(tmp)[3] <- "variable"
return(tmp)
}
3 changes: 2 additions & 1 deletion R/reportCosts.R
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ reportCosts <- function(gdx,output=NULL,regionSubsetList=NULL,t=c(seq(2005,2060,
# add other region aggregations
if (!is.null(regionSubsetList))
tmp <- mbind(tmp, calc_regionSubset_sums(tmp, regionSubsetList))


getSets(tmp)[3] <- "variable"
return(tmp)
}
1 change: 1 addition & 0 deletions R/reportCrossVariables.R
Original file line number Diff line number Diff line change
Expand Up @@ -477,5 +477,6 @@ reportCrossVariables <- function(gdx, output = NULL, regionSubsetList = NULL,
could not be calculated for this regional resolution")
}

getSets(out)[3] <- "variable"
return(out)
}
5 changes: 1 addition & 4 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -2524,9 +2524,6 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200

out <- mbind(out, out.cumul)




getSets(out)[3] <- "variable"
return(out)

}
1 change: 1 addition & 0 deletions R/reportEmiAirPol.R
Original file line number Diff line number Diff line change
Expand Up @@ -618,5 +618,6 @@ reportEmiAirPol <- function(gdx,regionSubsetList=NULL,t=c(seq(2005,2060,5),seq(2

} else {stop("not allowed AP-realization")}

getSets(out)[3] <- "variable"
return(out)
}
1 change: 1 addition & 0 deletions R/reportEmployment.R
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,6 @@ remFilter <- remFilter[, , c("New Cap|Electricity|Hydro", "Cap|Electricity|Hydro

jobs <- mbind(jobsCi, jobsOm, jobsProd, jobsManf)

getSets(jobs)[3] <- "variable"
return(jobs)
}
1 change: 1 addition & 0 deletions R/reportEnergyInvestment.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,6 @@ reportEnergyInvestment <- function(gdx, regionSubsetList = NULL, t = c(seq(2005,
if (!is.null(regionSubsetList))
tmp <- mbind(tmp, calc_regionSubset_sums(tmp, regionSubsetList))

getSets(tmp)[3] <- "variable"
return(tmp)
}
1 change: 1 addition & 0 deletions R/reportExtraction.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,6 @@ grades[is.na(grades)] <- 0
if (!is.null(regionSubsetList))
out <- mbind(out, calc_regionSubset_sums(out, regionSubsetList))

getSets(out)[3] <- "variable"
return(out)
}
1 change: 1 addition & 0 deletions R/reportFE.R
Original file line number Diff line number Diff line change
Expand Up @@ -1747,5 +1747,6 @@ reportFE <- function(gdx, regionSubsetList = NULL,
)
}

getSets(out)[3] <- "variable"
return(out)
}
7 changes: 1 addition & 6 deletions R/reportLCOE.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Read in GDX and calculate LCOE reporting used in convGDX2MIF_LCOE.
#'
#' This function provides a post-processing calculation of LCOE (Levelized Cost of Energy) for energy conversion technologies in REMIND.
#' In incluldes most technologies that generate secondary energy and the distribution technologies which convert secondary energy to final energy.
#' It includes most technologies that generate secondary energy and the distribution technologies which convert secondary energy to final energy.
#' This script calculates two different types of LCOE: average LCOE (standing system) and marginal LCOE (new plant).
#' The average LCOE reflect the total cost incurred by the technology deployment in a specific time step divided by its energy output.
#' The marginal LCOE estimate the per-unit lifetime cost of the output if the model added another capacity of that technology in the respective time step.
Expand Down Expand Up @@ -1599,8 +1599,3 @@ reportLCOE <- function(gdx, output.type = "both"){

return(LCOE.out)
}





1 change: 1 addition & 0 deletions R/reportMacroEconomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -403,5 +403,6 @@ reportMacroEconomy <- function(gdx, regionSubsetList = NULL,
}
# add interest rate
out <- mbind(out, inteRate)
getSets(out)[3] <- "variable"
return(out)
}
3 changes: 2 additions & 1 deletion R/reportPE.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ reportPE <- function(gdx,regionSubsetList=NULL,t=c(seq(2005,2060,5),seq(2070,211
# add other region aggregations
if (!is.null(regionSubsetList))
out <- mbind(out, calc_regionSubset_sums(out, regionSubsetList))


getSets(out)[3] <- "variable"
return(out)
}
3 changes: 2 additions & 1 deletion R/reportPolicyCosts.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ reportPolicyCosts <- function(gdx,gdx_ref,regionSubsetList=NULL,t=c(seq(2005,206
# add other region aggregations
if (!is.null(regionSubsetList))
tmp <- mbind(tmp, calc_regionSubset_sums(tmp, regionSubsetList))


getSets(tmp)[3] <- "variable"
return(tmp)
}
1 change: 1 addition & 0 deletions R/reportPrices.R
Original file line number Diff line number Diff line change
Expand Up @@ -1129,5 +1129,6 @@ reportPrices <- function(gdx, output=NULL, regionSubsetList=NULL,
# out <- mbind(out, tmp2)
# }

getSets(out)[3] <- "variable"
return(out)
}
2 changes: 1 addition & 1 deletion R/reportSDPVariables.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,6 @@ reportSDPVariables <- function(
output <- mbind(output,addUEperCapForBuildings(output))
output <- mbind(output,addIntensityUE(output))


getSets(output)[3] <- "variable"
return(output)
}
1 change: 1 addition & 0 deletions R/reportSE.R
Original file line number Diff line number Diff line change
Expand Up @@ -490,5 +490,6 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq
if (!is.null(regionSubsetList))
out <- mbind(out, calc_regionSubset_sums(out, regionSubsetList))

getSets(out)[3] <- "variable"
return(out)
}
1 change: 1 addition & 0 deletions R/reportTax.R
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,6 @@ reportTax <- function(gdx,output=NULL,regionSubsetList=NULL,t=c(seq(2005,2060,5)
out["GLO",,vars] <- NA
out[names(regionSubsetList),,vars] <- NA

getSets(out)[3] <- "variable"
return(out)
}
1 change: 1 addition & 0 deletions R/reportTechnology.R
Original file line number Diff line number Diff line change
Expand Up @@ -385,5 +385,6 @@ reportTechnology <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(

tmp[is.na(tmp)] <- 0 # tmp is NA if weight is zero for all regions within the GLO or the specific region aggregation. Therefore, we replace all NAs with zeros.

getSets(tmp)[3] <- "variable"
return(tmp)
}
11 changes: 3 additions & 8 deletions R/reportTrade.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,8 @@ reportTrade <- function(gdx,regionSubsetList=NULL,t=c(seq(2005,2060,5),seq(2070,
tmp <- mbind(tmp,setNames(trade[,,"perm"] * price[,,"perm"] * 1000, "Trade|Emi Allowances|Value (billion US$2005/yr)"))
tmp <- mbind(tmp,setNames(dimSums( trade[,,set_trade] * price[,,set_trade],dim = 3) * 1000, "Trade|All|Value (billion US$2005/yr)"))
tmp <- mbind(tmp,setNames(dimSums( trade[,,set_trade] * price[,,set_trade],dim = 3), "Current Account (billion US$2005/yr)"))





# rename dimensions in the magpie object
names(dimnames(tmp))[3] = 'variable'


# rename dimensions in the magpie object
getSets(tmp)[3] <- "variable"
return(tmp)
}
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.119.3**
R package **remind2**, version **1.119.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, 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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.119.3, <URL: https://github.com/pik-piam/remind2>.
Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, 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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.119.4, <URL: 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 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},
year = {2023},
note = {R package version 1.119.3},
note = {R package version 1.119.4},
url = {https://github.com/pik-piam/remind2},
}
```
2 changes: 1 addition & 1 deletion man/reportLCOE.Rd

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

0 comments on commit 1bc3580

Please sign in to comment.