Commit 8c788a13 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.0.15.13 NEW: add warnings argument in CreateRunOptions

Showing with 29 additions and 21 deletions
+29 -21
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.0.15.12
Date: 2018-10-16
Version: 1.0.15.13
Date: 2018-10-17
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
person("Charles", "Perrin", role = c("aut", "ths"), comment = c(ORCID = "0000-0001-8552-1881")),
......
......@@ -13,10 +13,11 @@ output:
### 1.0.15.12 Release Notes (2018-10-16)
### 1.0.15.13 Release Notes (2018-10-17)
#### New features
- <code>CreateRunOptions()</code> now presents a <code>warnings</code> argument to replace the verbose action (the <code>verbose</code> argument is keep to print messages).
____________________________________________________________________________________
......@@ -217,7 +218,7 @@ ________________________________________________________________________________
#### New features
- <code>ErrorCrit&#42;()</code> functions gain a warnings argument to replace the verbose action and the verbose argument now prints the criterion value(s).
- <code>ErrorCrit&#42;()</code> functions gain a <code>warnings</code> argument to replace the verbose action and the <code>verbose</code> argument now prints the criterion value(s).
#### Bug fixes
......@@ -241,7 +242,7 @@ ________________________________________________________________________________
#### New features
- <code>SeriesAggreg()</code> gains a TimeLag argument that corresponds to a numeric value indicating a time lag (in seconds) for the time series aggregation (useful to aggregate hourly time series to the daily time step for instance).
In addition, the function now accepts input dates in both POSIXt formats (POSIXct and POSIXlt). The output is in POSIXct format.
In addition, the function now accepts input dates in both <code>POSIXt</code> formats (<code>POSIXct</code> and <code>POSIXlt</code>). The output is in <code>POSIXct</code> format.
- <code>plot_OutputsModel()</code> gains a <code>log_scale</code> argument in order to plot the flow with a log scale.
......@@ -271,7 +272,7 @@ ________________________________________________________________________________
#### Minor user-visible changes
- <code>CreateInputsModel()</code> and <code>DataAltiExtrapolation_Valery()</code> functions now allow both POSIXt formats (POSIXct and POSIXlt).
- <code>CreateInputsModel()</code> and <code>DataAltiExtrapolation_Valery()</code> functions now allow both <code>POSIXt</code> formats (<code>POSIXct</code> and <code>POSIXlt</code>).
____________________________________________________________________________________
......
CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run, IniStates = NULL, IniResLevels = NULL,
Outputs_Cal = NULL, Outputs_Sim = "all", RunSnowModule, MeanAnSolidPrecip = NULL, verbose = TRUE) {
CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
IniStates = NULL, IniResLevels = NULL,
Outputs_Cal = NULL, Outputs_Sim = "all",
RunSnowModule, MeanAnSolidPrecip = NULL,
warnings = TRUE, verbose = TRUE) {
if (!missing(RunSnowModule)) {
warning("argument RunSnowModule is deprecated; please adapt FUN_MOD instead.", call. = FALSE)
......@@ -143,14 +146,14 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
stop("IndPeriod_Run should be of type integer \n")
return(NULL)
}
if (identical(IndPeriod_WarmUp, as.integer(0))) {
WTxt <- paste0(WTxt, "\t No warm up period is used! \n")
if (identical(IndPeriod_WarmUp, as.integer(0)) & verbose) {
message(paste0(WTxt, "\t No warm up period is used \n"))
}
if ((IndPeriod_Run[1] - 1) != tail(IndPeriod_WarmUp, 1) & !identical(IndPeriod_WarmUp, as.integer(0))) {
WTxt <- paste0(WTxt, "\t Model warm up period is not directly before the model run period \n")
}
}
if (!is.null(WTxt) & verbose) {
if (!is.null(WTxt) & warnings) {
warning(WTxt)
}
......@@ -188,10 +191,10 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
}
}
## check IniStates
if (is.null(IniStates) & is.null(IniResLevels) & verbose) {
if (is.null(IniStates) & is.null(IniResLevels) & warnings) {
warning("\t Model states initialisation not defined -> default configuration used \n")
}
if (!is.null(IniStates) & !is.null(IniResLevels) & verbose) {
if (!is.null(IniStates) & !is.null(IniResLevels) & warnings) {
warning("\t IniStates and IniResLevels are both defined -> Store levels are taken from IniResLevels \n")
}
if ("CemaNeige" %in% ObjectClass) {
......@@ -390,7 +393,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
}
MeanAnSolidPrecip <- rep(mean(SolidPrecip) * Factor, NLayers)
### default value: same Gseuil for all layers
if (verbose) {
if (warnings) {
warning("\t MeanAnSolidPrecip not defined -> it was automatically set to c(",
paste(round(MeanAnSolidPrecip), collapse = ","), ") \n")
}
......@@ -417,7 +420,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
WTxt <- NULL
WTxt <- paste0(WTxt, "\t PliqAndMelt was not defined in Outputs_Cal but is needed to feed the hydrological model with the snow modele outputs \n")
WTxt <- paste0(WTxt, "\t -> it was automatically added \n")
if (!is.null(WTxt) & verbose) {
if (!is.null(WTxt) & warnings) {
warning(WTxt)
}
Outputs_Cal <- c(Outputs_Cal, "PliqAndMelt")
......@@ -426,7 +429,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
WTxt <- NULL
WTxt <- paste0(WTxt, "\t PliqAndMelt was not defined in Outputs_Sim but is needed to feed the hydrological model with the snow modele outputs \n")
WTxt <- paste0(WTxt, "\t -> it was automatically added \n")
if (!is.null(WTxt) & verbose) {
if (!is.null(WTxt) & warnings) {
warning(WTxt)
}
Outputs_Sim <- c(Outputs_Sim, "PliqAndMelt")
......
......@@ -9,10 +9,12 @@
\usage{
CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
IniStates = NULL, IniResLevels = NULL, Outputs_Cal = NULL,
Outputs_Sim = "all", RunSnowModule, MeanAnSolidPrecip = NULL,
verbose = TRUE)
CreateRunOptions(FUN_MOD, InputsModel,
IndPeriod_WarmUp = NULL, IndPeriod_Run,
IniStates = NULL, IniResLevels = NULL,
Outputs_Cal = NULL, Outputs_Sim = "all",
RunSnowModule, MeanAnSolidPrecip = NULL,
warnings = TRUE, verbose = TRUE)
}
......@@ -39,6 +41,8 @@ CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
\item{MeanAnSolidPrecip}{(optional) [numeric] vector giving the annual mean of average solid precipitation for each layer (computed from InputsModel if not defined) [mm/y]}
\item{warnings}{(optional) [boolean] boolean indicating if the warning messages are shown, default = \code{TRUE}}
\item{verbose}{(optional) [boolean] boolean indicating if the function is run in verbose mode or not, default = \code{TRUE}}
}
......
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