From d4a32e8d901fff8f58b201d117ed7c13ae5be1ea Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Wed, 6 Jan 2021 12:17:10 +0100 Subject: [PATCH] v1.6.8.37 refactor: rename Outputs argument into x in .GetAggregConvertFun --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/UtilsSeriesAggreg.R | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e20cc651..ddc4014c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.6.8.36 +Version: 1.6.8.37 Date: 2021-01-05 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NEWS.md b/NEWS.md index 9b25f88a..55138f23 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ -### 1.6.8.36 Release Notes (2021-01-05) +### 1.6.8.37 Release Notes (2021-01-05) #### New features diff --git a/R/UtilsSeriesAggreg.R b/R/UtilsSeriesAggreg.R index 94d7e181..d610b03b 100644 --- a/R/UtilsSeriesAggreg.R +++ b/R/UtilsSeriesAggreg.R @@ -36,21 +36,21 @@ Y = "yearly") } -.GetAggregConvertFun <- function(Outputs) { +.GetAggregConvertFun <- function(x) { AggregConvertFunTable <- rbind( data.frame(ConvertFun = "mean", - Outputs = c("Prod","Rout","Exp","SnowPack","ThermalState", - "Gratio","Temp","Gthreshold","Glocalmax","LayerTempMean", "T"), - stringsAsFactors = FALSE), # R < 4.0 compatibility: avoids mixing numeric and factor into numeric + x = c("Prod", "Rout", "Exp", "SnowPack", "ThermalState", + "Gratio", "Temp", "Gthreshold", "Glocalmax", "LayerTempMean", "T"), + stringsAsFactors = FALSE), # R < 4.0 compatibility: avoids mixing numeric and factor into numeric data.frame(ConvertFun = "sum", - Outputs = c("PotEvap","Precip","Pn","Ps","AE","Perc","PR","Q9", - "Q1","Exch","AExch1","AExch2","AExch","QR","QRExp", - "QD","Qsim","Pliq","Psol","PotMelt","Melt","PliqAndMelt", - "LayerPrecip","LayerFracSolidPrecip", "Qmm", "Qls", "E", "P", "Qupstream"), - stringsAsFactors = FALSE) # R < 4.0 compatibility: avoids mixing numeric and factor into numeric + x = c("PotEvap", "Precip", "Pn", "Ps", "AE", "Perc", "PR", "Q9", + "Q1", "Exch", "AExch1", "AExch2", "AExch", "QR", "QRExp", + "QD", "Qsim", "Pliq", "Psol", "PotMelt", "Melt", "PliqAndMelt", + "LayerPrecip", "LayerFracSolidPrecip", "Qmm", "Qls", "E", "P", "Qupstream"), + stringsAsFactors = FALSE) # R < 4.0 compatibility: avoids mixing numeric and factor into numeric ) - res <- sapply(Outputs, function(iOutputs) { - iRes <- AggregConvertFunTable$ConvertFun[AggregConvertFunTable$Outputs == iOutputs] + res <- sapply(x, function(iX) { + iRes <- AggregConvertFunTable$ConvertFun[AggregConvertFunTable$x == iX] iRes <- ifelse(test = any(is.na(iRes)), yes = NA, no = iRes) # R < 4.0 compatibility }) return(res) -- GitLab