Commit 3e49873d authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

Merge branch '77-warn-users-in-seriesaggreg-when-convertfun-is-not-provided' into 'newSeriesAggreg'

Resolve "Warn users in SeriesAggreg when ConvertFun is not provided"

See merge request !21
parents 73b74bc5 5e80c0d1
Pipeline #18767 passed with stages
in 12 minutes and 39 seconds
SeriesAggreg.InputsModel <- function(x, ...) {
res <- SeriesAggreg.list(x,
except = c("ZLayers", "LengthHydro", "BasinAreas"),
...)
res <- suppressMessages(
SeriesAggreg.list(x,
ConvertFun = getAggregConvertFun(names(x)),
except = c("ZLayers", "LengthHydro", "BasinAreas"),
...)
)
return(res)
}
SeriesAggreg.OutputsModel <- function(x, ...) {
res <- SeriesAggreg.list(x, except = "StateEnd", ...)
res <- suppressMessages(
SeriesAggreg.list(x,
ConvertFun = getAggregConvertFun(names(x)),
except = "StateEnd",
...)
)
return(res)
}
......@@ -54,5 +54,11 @@ getAggregConvertFun <- function(Outputs) {
iRes <- .AggregConvertFunTable$ConvertFun[.AggregConvertFunTable$Outputs == iOutputs]
iRes <- ifelse(test = any(is.na(iRes)), yes = NA, no = iRes) # R < 4.0 compatibility
})
if (length(res) > 0) {
message("Variables automatically aggregated as follow:")
widthMsg <- max(nchar(c(names(res), res)), na.rm = TRUE) + 1 + 2
message(format(names(res) , width = widthMsg, justify = "right"))
message(format(shQuote(res), width = widthMsg, justify = "right"))
}
return(res)
}
Markdown is supported
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