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

v1.0.15.13 NEW: add warnings argument in CreateRunOptions

parent f04ab6db
Package: airGR Package: airGR
Type: Package Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.0.15.12 Version: 1.0.15.13
Date: 2018-10-16 Date: 2018-10-17
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), 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")), person("Charles", "Perrin", role = c("aut", "ths"), comment = c(ORCID = "0000-0001-8552-1881")),
......
...@@ -13,10 +13,11 @@ output: ...@@ -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 @@ ________________________________________________________________________________ ...@@ -217,7 +218,7 @@ ________________________________________________________________________________
#### New features #### 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 #### Bug fixes
...@@ -241,7 +242,7 @@ ________________________________________________________________________________ ...@@ -241,7 +242,7 @@ ________________________________________________________________________________
#### New features #### 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). - <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. - <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 @@ ________________________________________________________________________________ ...@@ -271,7 +272,7 @@ ________________________________________________________________________________
#### Minor user-visible changes #### 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, CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
Outputs_Cal = NULL, Outputs_Sim = "all", RunSnowModule, MeanAnSolidPrecip = NULL, verbose = TRUE) { IniStates = NULL, IniResLevels = NULL,
Outputs_Cal = NULL, Outputs_Sim = "all",
RunSnowModule, MeanAnSolidPrecip = NULL,
warnings = TRUE, verbose = TRUE) {
if (!missing(RunSnowModule)) { if (!missing(RunSnowModule)) {
warning("argument RunSnowModule is deprecated; please adapt FUN_MOD instead.", call. = FALSE) 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 ...@@ -143,14 +146,14 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
stop("IndPeriod_Run should be of type integer \n") stop("IndPeriod_Run should be of type integer \n")
return(NULL) return(NULL)
} }
if (identical(IndPeriod_WarmUp, as.integer(0))) { if (identical(IndPeriod_WarmUp, as.integer(0)) & verbose) {
WTxt <- paste0(WTxt, "\t No warm up period is used! \n") 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))) { 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") 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) warning(WTxt)
} }
...@@ -188,10 +191,10 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -188,10 +191,10 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
} }
} }
## check IniStates ## 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") 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") warning("\t IniStates and IniResLevels are both defined -> Store levels are taken from IniResLevels \n")
} }
if ("CemaNeige" %in% ObjectClass) { if ("CemaNeige" %in% ObjectClass) {
...@@ -390,7 +393,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -390,7 +393,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
} }
MeanAnSolidPrecip <- rep(mean(SolidPrecip) * Factor, NLayers) MeanAnSolidPrecip <- rep(mean(SolidPrecip) * Factor, NLayers)
### default value: same Gseuil for all layers ### default value: same Gseuil for all layers
if (verbose) { if (warnings) {
warning("\t MeanAnSolidPrecip not defined -> it was automatically set to c(", warning("\t MeanAnSolidPrecip not defined -> it was automatically set to c(",
paste(round(MeanAnSolidPrecip), collapse = ","), ") \n") paste(round(MeanAnSolidPrecip), collapse = ","), ") \n")
} }
...@@ -417,7 +420,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -417,7 +420,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
WTxt <- NULL 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 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") WTxt <- paste0(WTxt, "\t -> it was automatically added \n")
if (!is.null(WTxt) & verbose) { if (!is.null(WTxt) & warnings) {
warning(WTxt) warning(WTxt)
} }
Outputs_Cal <- c(Outputs_Cal, "PliqAndMelt") Outputs_Cal <- c(Outputs_Cal, "PliqAndMelt")
...@@ -426,7 +429,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -426,7 +429,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
WTxt <- NULL 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 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") WTxt <- paste0(WTxt, "\t -> it was automatically added \n")
if (!is.null(WTxt) & verbose) { if (!is.null(WTxt) & warnings) {
warning(WTxt) warning(WTxt)
} }
Outputs_Sim <- c(Outputs_Sim, "PliqAndMelt") Outputs_Sim <- c(Outputs_Sim, "PliqAndMelt")
......
...@@ -9,10 +9,12 @@ ...@@ -9,10 +9,12 @@
\usage{ \usage{
CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run, CreateRunOptions(FUN_MOD, InputsModel,
IniStates = NULL, IniResLevels = NULL, Outputs_Cal = NULL, IndPeriod_WarmUp = NULL, IndPeriod_Run,
Outputs_Sim = "all", RunSnowModule, MeanAnSolidPrecip = NULL, IniStates = NULL, IniResLevels = NULL,
verbose = TRUE) 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, ...@@ -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{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}} \item{verbose}{(optional) [boolean] boolean indicating if the function is run in verbose mode or not, default = \code{TRUE}}
} }
......
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