Commit 14f7dc8c authored by Delaigue Olivier's avatar Delaigue Olivier Committed by Dorchies David
Browse files

v1.4.8.0 feat: added .AggregOutputs function to choose ConvertFun to apply on...

v1.4.8.0 feat: added .AggregOutputs function to choose ConvertFun to apply on InputsModel and OutputsModel elements #41
Showing with 26 additions and 2 deletions
+26 -2
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.4.7.6
Version: 1.4.8.0
Date: 2020-05-04
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -4,7 +4,7 @@
### 1.4.7.6 Release Notes (2020-05-04)
### 1.4.8.0 Release Notes (2020-05-04)
#### New features
......@@ -13,6 +13,7 @@
- Added <code>SeriesAggreg2.InputsModel()</code> function.
- Added <code>SeriesAggreg2.OutputsModel()</code> function.
- Added <code>SeriesAggreg2.data.frame()</code> function. This new verson of the <code>SeriesAggreg()</code> function allows to compute regimes.
- Added<code>.AggregOutputs()</code> private function in order to choose automatically the <code>ConvertFun</code> to apply on each element of <code>InputsModel</code> and <code>OutputsModel</code> ojects.
#### Deprecated and defunct
......
......@@ -12,6 +12,29 @@
# }
## =================================================================================
## function to manage Fortran outputs
## =================================================================================
.AggregOutputs <- function(Outputs) {
Table <- list(
Outputs = c("PotEvap", "Precip", "Prod", "Pn", "Ps", "AE", "Perc", "PR", "Q9", "Q1", "Rout", "Exch", "AExch1", "AExch2", "AExch", "QR", "QRExp", "Exp", "QD", "Qsim", "Pliq", "Psol", "SnowPack", "ThermalState", "Gratio", "PotMelt", "Melt", "PliqAndMelt", "Temp", "Gthreshold", "Glocalmax", "LayerPrecip", "LayerTempMean", "LayerFracSolidPrecip"),
Aggreg = c("sum", "sum", "mean", "sum", "sum", "sum", "sum", "sum", "sum", "sum", "mean", "sum", "sum", "sum", "sum", "sum", "sum", "mean", "sum", "sum", "sum", "sum", "mean", "mean", "mean", "sum", "sum", "sum", "mean", "mean", "mean", "sum", "mean", "sum")
)
if (length(Table$Outputs) != length(Table$Aggreg)) {
stop("'.AggregOutputs' is out of order")
}
match.arg(Outputs, choices = Table$Outputs, several.ok = TRUE)
res <- sapply(Outputs, function(iOutputs) {
iRes <- Table$Aggreg[Table$Outputs == iOutputs]
iRes <- ifelse(any(is.na(iRes)), NA, iRes)
})
return(res)
}
## =================================================================================
## function to manage Fortran outputs
## =================================================================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment