Commit 98cbf01a authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

fix(airGRteaching): temporarily restore the deprecated FUN_CRIT argument in...

fix(airGRteaching): temporarily restore the deprecated FUN_CRIT argument in Calibration and Calibration_Michel
- to avoid error on CRAN version of airGRteaching
Refs #81, #146
Showing with 20 additions and 2 deletions
+20 -2
...@@ -3,6 +3,7 @@ Calibration <- function(InputsModel, ...@@ -3,6 +3,7 @@ Calibration <- function(InputsModel,
InputsCrit, InputsCrit,
CalibOptions, CalibOptions,
FUN_MOD, FUN_MOD,
FUN_CRIT, # deprecated
FUN_CALIB = Calibration_Michel, FUN_CALIB = Calibration_Michel,
FUN_TRANSFO = NULL, FUN_TRANSFO = NULL,
verbose = TRUE, verbose = TRUE,
...@@ -10,6 +11,10 @@ Calibration <- function(InputsModel, ...@@ -10,6 +11,10 @@ Calibration <- function(InputsModel,
FUN_MOD <- match.fun(FUN_MOD) FUN_MOD <- match.fun(FUN_MOD)
if (!missing(FUN_CRIT)) {
FUN_CRIT <- match.fun(FUN_CRIT)
}
FUN_CALIB <- match.fun(FUN_CALIB) FUN_CALIB <- match.fun(FUN_CALIB)
if (!is.null(FUN_TRANSFO)) { if (!is.null(FUN_TRANSFO)) {
......
...@@ -3,6 +3,7 @@ Calibration_Michel <- function(InputsModel, ...@@ -3,6 +3,7 @@ Calibration_Michel <- function(InputsModel,
InputsCrit, InputsCrit,
CalibOptions, CalibOptions,
FUN_MOD, FUN_MOD,
FUN_CRIT, # deprecated
FUN_TRANSFO = NULL, FUN_TRANSFO = NULL,
verbose = TRUE, verbose = TRUE,
...) { ...) {
...@@ -10,6 +11,10 @@ Calibration_Michel <- function(InputsModel, ...@@ -10,6 +11,10 @@ Calibration_Michel <- function(InputsModel,
FUN_MOD <- match.fun(FUN_MOD) FUN_MOD <- match.fun(FUN_MOD)
if (!missing(FUN_CRIT)) {
FUN_CRIT <- match.fun(FUN_CRIT)
}
# Handling 'FUN_TRANSFO' from direct argument or provided by 'CaliOptions' # Handling 'FUN_TRANSFO' from direct argument or provided by 'CaliOptions'
if (!is.null(FUN_TRANSFO)) { if (!is.null(FUN_TRANSFO)) {
FUN_TRANSFO <- match.fun(FUN_TRANSFO) FUN_TRANSFO <- match.fun(FUN_TRANSFO)
...@@ -52,6 +57,10 @@ Calibration_Michel <- function(InputsModel, ...@@ -52,6 +57,10 @@ Calibration_Michel <- function(InputsModel,
if (!inherits(CalibOptions, "HBAN")) { if (!inherits(CalibOptions, "HBAN")) {
stop("'CalibOptions' must be of class 'HBAN' if 'Calibration_Michel' is used") stop("'CalibOptions' must be of class 'HBAN' if 'Calibration_Michel' is used")
} }
if (!missing(FUN_CRIT)) {
warning("argument 'FUN_CRIT' is deprecated. The error criterion function is now automatically get from the 'InputsCrit' object")
}
##_variables_initialisation ##_variables_initialisation
ParamFinalR <- NULL ParamFinalR <- NULL
......
...@@ -15,7 +15,7 @@ Calibration algorithm that optimises the error criterion selected as objective f ...@@ -15,7 +15,7 @@ Calibration algorithm that optimises the error criterion selected as objective f
\usage{ \usage{
Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions, Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions,
FUN_MOD, FUN_CALIB = Calibration_Michel, FUN_MOD, FUN_CRIT, FUN_CALIB = Calibration_Michel,
FUN_TRANSFO = NULL, verbose = TRUE, ...) FUN_TRANSFO = NULL, verbose = TRUE, ...)
} }
...@@ -31,6 +31,8 @@ Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions, ...@@ -31,6 +31,8 @@ Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions,
\item{FUN_MOD}{[function] hydrological model function (e.g. \code{\link{RunModel_GR4J}}, \code{\link{RunModel_CemaNeigeGR4J}})} \item{FUN_MOD}{[function] hydrological model function (e.g. \code{\link{RunModel_GR4J}}, \code{\link{RunModel_CemaNeigeGR4J}})}
\item{FUN_CRIT}{(deprecated) [function] error criterion function (e.g. \code{\link{ErrorCrit_RMSE}}, \code{\link{ErrorCrit_NSE}})}
\item{FUN_CALIB}{(deprecated) [function] calibration algorithm function (e.g. \code{\link{Calibration_Michel}}), \code{default = Calibration_Michel}} \item{FUN_CALIB}{(deprecated) [function] calibration algorithm function (e.g. \code{\link{Calibration_Michel}}), \code{default = Calibration_Michel}}
\item{FUN_TRANSFO}{(optional) [function] model parameters transformation function, if the \code{FUN_MOD} used is native in the package \code{FUN_TRANSFO} is automatically defined} \item{FUN_TRANSFO}{(optional) [function] model parameters transformation function, if the \code{FUN_MOD} used is native in the package \code{FUN_TRANSFO} is automatically defined}
......
...@@ -19,7 +19,7 @@ Then a steepest descent local search algorithm is performed, starting from the r ...@@ -19,7 +19,7 @@ Then a steepest descent local search algorithm is performed, starting from the r
\usage{ \usage{
Calibration_Michel(InputsModel, RunOptions, InputsCrit, CalibOptions, Calibration_Michel(InputsModel, RunOptions, InputsCrit, CalibOptions,
FUN_MOD, FUN_TRANSFO = NULL, verbose = TRUE, ...) FUN_MOD, FUN_CRIT, FUN_TRANSFO = NULL, verbose = TRUE, ...)
} }
...@@ -34,6 +34,8 @@ Calibration_Michel(InputsModel, RunOptions, InputsCrit, CalibOptions, ...@@ -34,6 +34,8 @@ Calibration_Michel(InputsModel, RunOptions, InputsCrit, CalibOptions,
\item{FUN_MOD}{[function] hydrological model function (e.g. \code{\link{RunModel_GR4J}}, \code{\link{RunModel_CemaNeigeGR4J}})} \item{FUN_MOD}{[function] hydrological model function (e.g. \code{\link{RunModel_GR4J}}, \code{\link{RunModel_CemaNeigeGR4J}})}
\item{FUN_CRIT}{(deprecated) [function] error criterion function (e.g. \code{\link{ErrorCrit_RMSE}}, \code{\link{ErrorCrit_NSE}})}
\item{FUN_TRANSFO}{(optional) [function] model parameters transformation function, if the \code{FUN_MOD} used is native in the package \code{FUN_TRANSFO} is automatically defined} \item{FUN_TRANSFO}{(optional) [function] model parameters transformation function, if the \code{FUN_MOD} used is native in the package \code{FUN_TRANSFO} is automatically defined}
\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}}
......
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