diff --git a/.buildlibrary b/.buildlibrary index 84840d1..43d0152 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '1418367' +ValidationKey: '1438488' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 32255f8..4583635 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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: 'mredgebuildings: Prepare data to be used by the EDGE-Buildings model' -version: 0.7.1 -date-released: '2024-09-11' +version: 0.7.2 +date-released: '2024-09-13' abstract: Prepare data to be used by the EDGE-Buildings model. authors: - family-names: Hasse diff --git a/DESCRIPTION b/DESCRIPTION index 5e8d623..b90c4bb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mredgebuildings Title: Prepare data to be used by the EDGE-Buildings model -Version: 0.7.1 -Date: 2024-09-11 +Version: 0.7.2 +Date: 2024-09-13 Authors@R: c( person("Robin", "Hasse", , "robin.hasse@pik-potsdam.de", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1818-3186")), diff --git a/NAMESPACE b/NAMESPACE index a1fbbbc..83edab0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -15,7 +15,6 @@ export(calcHeatingCapacity) export(calcHeatingSystem) export(calcHouseholdSize) export(calcIEAPFU) -export(calcIEAfloorspace) export(calcLifetimeParams) export(calcMatchingReference) export(calcPFUDB) @@ -29,7 +28,7 @@ export(calcSurface) export(calcTCEP) export(calcUEdemand) export(calcUValue) -export(calcUvalues) +export(calcUValueSource) export(convertCensusHub) export(convertDaioglou) export(convertDeetman2020) @@ -64,7 +63,6 @@ export(readEurostatBuildings) export(readGDL) export(readHDDCDDtemp) export(readHotmaps) -export(readIEAfloorspace) export(readOdyssee) export(readPFUDB) export(readTCEP) diff --git a/R/calcFloorspacePast.R b/R/calcFloorspacePast.R index 8fd9932..8b127ca 100644 --- a/R/calcFloorspacePast.R +++ b/R/calcFloorspacePast.R @@ -128,12 +128,11 @@ calcFloorspacePast <- function() { unit = "million m2") # IEA data: take only India - ind <- readSource("IEAfloorspace", convert = FALSE) %>% + ind <- readSource("TCEP", subtype = "floorspace", convert = FALSE) %>% as.quitte() %>% filter(.data[["region"]] == "India", .data[["period"]] %in% c(2000, 2011), - .data[["subsector"]] == "Residential") %>% - select(-"subsector") %>% + .data[["variable"]] == "Residential") %>% mutate(variable = "floor space", value = .data[["value"]] * 1000, # billion m2 -> million m2 unit = "million m2", diff --git a/R/calcIEAfloorspace.R b/R/calcIEAfloorspace.R deleted file mode 100644 index 82bf97a..0000000 --- a/R/calcIEAfloorspace.R +++ /dev/null @@ -1,17 +0,0 @@ -#' floor space by subsectors -#' -#' @export -calcIEAfloorspace <- function() { - - x <- readSource("IEAfloorspace", convert = FALSE) - - return(list( - x = x, - isocountries = FALSE, - unit = "billion m2", - description = paste0( - "Residential and commercial floor space for big world regions from the ", - "IEA TCEP report 2014 in billion m2." - ) - )) -} diff --git a/R/calcUValueSource.R b/R/calcUValueSource.R new file mode 100644 index 0000000..8154620 --- /dev/null +++ b/R/calcUValueSource.R @@ -0,0 +1,24 @@ +#' Passes U-values read from source +#' +#' @author Falk Benke, Robin Hasse +#' +#' @param subtype source of U-values +#' @export + +calcUValueSource <- function(subtype = c("EUBuildingsObservatory", "ETSAP")) { + + subtype <- match.arg(subtype) + + x <- if (subtype == "EUBuildingsObservatory") { + readSource("EUBuildingsObservatory", convert = FALSE) + } else { + readSource("ETSAP", convert = FALSE) + } + + return(list(x = x, + min = 0, + isocountries = FALSE, + unit = "W/m2K", + description = paste("U-values as reported by", subtype) + )) +} diff --git a/R/calcUvalues.R b/R/calcUvalues.R deleted file mode 100644 index 52bb2ca..0000000 --- a/R/calcUvalues.R +++ /dev/null @@ -1,29 +0,0 @@ -#' Calculate U-value -#' -#' @param subtype either 'EUBuildingsObservatory' or 'ETSAP' -#' @export -calcUvalues <- function(subtype) { - - if (!subtype %in% c("EUBuildingsObservatory", "ETSAP")) { - stop("Invalid subtype. Must be either 'EUBuildingsObservatory' or 'ETSAP'") - } - - if (subtype == "EUBuildingsObservatory") { - x <- readSource("EUBuildingsObservatory", convert = FALSE) - unit <- "W/m2C" - } else { - x <- readSource("ETSAP", convert = FALSE) - unit <- "W/m2K" - } - - return(list( - x = x, - isocountries = FALSE, - unit = unit, - description = paste0( - "energy efficiency value of building shell in ", - "residential and non-residential as reported by ", - subtype - ) - )) -} diff --git a/R/fullEDGEBUILDINGS.R b/R/fullEDGEBUILDINGS.R index ef28e9a..4925d06 100644 --- a/R/fullEDGEBUILDINGS.R +++ b/R/fullEDGEBUILDINGS.R @@ -35,10 +35,8 @@ fullEDGEBUILDINGS <- function(rev = 0) { calcOutput("TCEP", subtype = "floorspace", aggregate = FALSE, file = "f_floorspace_tcep.cs4r") calcOutput("FEUE", file = "f_feue.cs4r") calcOutput("FEUEefficiencies", file = "f_feue_efficiencies.cs4r") - - calcOutput("IEAfloorspace", aggregate = FALSE, file = "f_iea_floorspace.cs4r") - calcOutput("Uvalues", subtype = "EUBuildingsObservatory", aggregate = FALSE, file = "f_uvalues_rescom.cs4r") - calcOutput("Uvalues", subtype = "ETSAP", aggregate = FALSE, file = "f_uvalues_etsap.cs4r") - calcOutput("EfficiencyRegression", aggregate = FALSE, file = "f_feue_efficiencyPars.cs4r") + calcOutput("UValueSource", subtype = "ETSAP", aggregate = FALSE, file = "f_uvalues_etsap.cs4r") + calcOutput("UValueSource", subtype = "EUBuildingsObservatory", aggregate = FALSE, file = "f_uvalues_rescom.cs4r") + } diff --git a/R/readIEAfloorspace.R b/R/readIEAfloorspace.R deleted file mode 100644 index 11ca12b..0000000 --- a/R/readIEAfloorspace.R +++ /dev/null @@ -1,33 +0,0 @@ -#' Floor space by subsectors -#' -#' Residential and commercial floor space for big world regions from the IEA -#' TCEP report 2014 in billion m2. -#' -#' @return MAgPIE object with floor space -#' -#' @author Robin Hasse -#' -#' @source https://iea.blob.core.windows.net/assets/416e9555-67f9-49ed-95ed-8afccd71b433/ -#' Tracking_clean_energy_progress_2014.pdf -#' -#' @seealso \code{\link{readSource}} -#' @examples -#' \dontrun{ a <- readSource(type = "IEAfloorspace") -#' } -#' -#' @importFrom utils read.csv -#' @importFrom tidyr gather -#' @importFrom dplyr %>% -#' @importFrom quitte as.quitte -#' @importFrom magclass as.magpie collapseDim -#' @export - -readIEAfloorspace <- function() { - - data <- read.csv("TCEP2014_figure_01_41_modified.csv") %>% - gather("subsector", "value", "Residential", "Services") %>% - as.quitte() %>% - as.magpie() - - return(data) -} diff --git a/README.md b/README.md index c6d12bf..161aa90 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Prepare data to be used by the EDGE-Buildings model -R package **mredgebuildings**, version **0.7.1** +R package **mredgebuildings**, version **0.7.2** [![CRAN status](https://www.r-pkg.org/badges/version/mredgebuildings)](https://cran.r-project.org/package=mredgebuildings) [![R build status](https://github.com/pik-piam/mredgebuildings/workflows/check/badge.svg)](https://github.com/pik-piam/mredgebuildings/actions) [![codecov](https://codecov.io/gh/pik-piam/mredgebuildings/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mredgebuildings) [![r-universe](https://pik-piam.r-universe.dev/badges/mredgebuildings)](https://pik-piam.r-universe.dev/builds) @@ -38,7 +38,7 @@ In case of questions / problems please contact Robin Hasse . +Hasse R, Führlich P, Levesque A, Tockhorn H (2024). _mredgebuildings: Prepare data to be used by the EDGE-Buildings model_. R package version 0.7.2, . A BibTeX entry for LaTeX users is @@ -47,7 +47,7 @@ A BibTeX entry for LaTeX users is title = {mredgebuildings: Prepare data to be used by the EDGE-Buildings model}, author = {Robin Hasse and Pascal Führlich and Antoine Levesque and Hagen Tockhorn}, year = {2024}, - note = {R package version 0.7.1}, + note = {R package version 0.7.2}, url = {https://github.com/pik-piam/mredgebuildings}, } ``` diff --git a/man/calcIEAfloorspace.Rd b/man/calcIEAfloorspace.Rd deleted file mode 100644 index a831421..0000000 --- a/man/calcIEAfloorspace.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/calcIEAfloorspace.R -\name{calcIEAfloorspace} -\alias{calcIEAfloorspace} -\title{floor space by subsectors} -\usage{ -calcIEAfloorspace() -} -\description{ -floor space by subsectors -} diff --git a/man/calcUValueSource.Rd b/man/calcUValueSource.Rd new file mode 100644 index 0000000..274109c --- /dev/null +++ b/man/calcUValueSource.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/calcUValueSource.R +\name{calcUValueSource} +\alias{calcUValueSource} +\title{Passes U-values read from source} +\usage{ +calcUValueSource(subtype = c("EUBuildingsObservatory", "ETSAP")) +} +\arguments{ +\item{subtype}{source of U-values} +} +\description{ +Passes U-values read from source +} +\author{ +Falk Benke, Robin Hasse +} diff --git a/man/calcUvalues.Rd b/man/calcUvalues.Rd deleted file mode 100644 index 16e5704..0000000 --- a/man/calcUvalues.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/calcUvalues.R -\name{calcUvalues} -\alias{calcUvalues} -\title{Calculate U-value} -\usage{ -calcUvalues(subtype) -} -\arguments{ -\item{subtype}{either 'EUBuildingsObservatory' or 'ETSAP'} -} -\description{ -Calculate U-value -} diff --git a/man/readIEAfloorspace.Rd b/man/readIEAfloorspace.Rd deleted file mode 100644 index c1c95dc..0000000 --- a/man/readIEAfloorspace.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/readIEAfloorspace.R -\name{readIEAfloorspace} -\alias{readIEAfloorspace} -\title{Floor space by subsectors} -\source{ -https://iea.blob.core.windows.net/assets/416e9555-67f9-49ed-95ed-8afccd71b433/ -Tracking_clean_energy_progress_2014.pdf -} -\usage{ -readIEAfloorspace() -} -\value{ -MAgPIE object with floor space -} -\description{ -Residential and commercial floor space for big world regions from the IEA -TCEP report 2014 in billion m2. -} -\examples{ -\dontrun{ a <- readSource(type = "IEAfloorspace") -} - -} -\seealso{ -\code{\link{readSource}} -} -\author{ -Robin Hasse -}