Commit 7dff15da authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.2.12.12 CLEAN: many warning or error messages modified in many functions

parent dca99120
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.2.12.11 Version: 1.2.12.12
Date: 2019-03-29 Date: 2019-04-01
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("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@irstea.fr"), person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@irstea.fr"),
......
...@@ -13,7 +13,7 @@ output: ...@@ -13,7 +13,7 @@ output:
### 1.2.12.11 Release Notes (2019-03-28) ### 1.2.12.12 Release Notes (2019-04-01)
...@@ -31,8 +31,6 @@ output: ...@@ -31,8 +31,6 @@ output:
#### New features #### New features
- Added <code>TransfoParam_CemaNeigeHyst()</code> function in order to take into account transformation of the parameters of the CemaNeige module when the hysteresis is used.
- <code>CreateInputsCrit()</code> now can prepare an <code>InputsCrit</code> object in order to compute a single criterion (<code>Single</code> class), multiple criteria (<code>Multi</code> class) with the <code>ErrorCrit()</code> function. So it is now possible to set the following arguments as atomic (as before) or as list: <code>FUN_CRIT</code>, <code>obs</code>, <code>BoolCrit</code>, <code>transfo</code>, <code>weights</code>. If the list format is chosen, all the lists must have the same length. - <code>CreateInputsCrit()</code> now can prepare an <code>InputsCrit</code> object in order to compute a single criterion (<code>Single</code> class), multiple criteria (<code>Multi</code> class) with the <code>ErrorCrit()</code> function. So it is now possible to set the following arguments as atomic (as before) or as list: <code>FUN_CRIT</code>, <code>obs</code>, <code>BoolCrit</code>, <code>transfo</code>, <code>weights</code>. If the list format is chosen, all the lists must have the same length.
- <code>CreateInputsCrit()</code> now presents a <code>varObs</code> argument in order to allow to prepare an <code>InputsCrit</code> object in order run a criterion on other variable than observed discharges with the <code>ErrorCrit()</code> function (e.g. SCA, SWE). - <code>CreateInputsCrit()</code> now presents a <code>varObs</code> argument in order to allow to prepare an <code>InputsCrit</code> object in order run a criterion on other variable than observed discharges with the <code>ErrorCrit()</code> function (e.g. SCA, SWE).
...@@ -49,6 +47,8 @@ output: ...@@ -49,6 +47,8 @@ output:
- <code>CreateCalibOptions()</code> now presents a <code>IsHyst</code> argument to give the possibility to use the hysteresis with CemaNeige. - <code>CreateCalibOptions()</code> now presents a <code>IsHyst</code> argument to give the possibility to use the hysteresis with CemaNeige.
- Added <code>TransfoParam_CemaNeigeHyst()</code> function in order to take into account transformation of the parameters of the CemaNeige module when the hysteresis is used.
- Added the <code>X0310010</code> dataset to run the examples using the hysteresis with CemaNeige. - Added the <code>X0310010</code> dataset to run the examples using the hysteresis with CemaNeige.
- Added the cemaneige_hysteresis vignette to explain how to manage the use of the hysteresis with CemaNeige. - Added the cemaneige_hysteresis vignette to explain how to manage the use of the hysteresis with CemaNeige.
......
...@@ -19,16 +19,16 @@ Calibration_Michel <- function(InputsModel, ...@@ -19,16 +19,16 @@ Calibration_Michel <- function(InputsModel,
##_____Arguments_check_____________________________________________________________________ ##_____Arguments_check_____________________________________________________________________
if (!inherits(InputsModel, "InputsModel")) { if (!inherits(InputsModel, "InputsModel")) {
stop("InputsModel must be of class 'InputsModel'") stop("'InputsModel' must be of class 'InputsModel'")
} }
if (!inherits(RunOptions, "RunOptions")) { if (!inherits(RunOptions, "RunOptions")) {
stop("RunOptions must be of class 'RunOptions'") stop("'RunOptions' must be of class 'RunOptions'")
} }
if (!inherits(InputsCrit, "InputsCrit")) { if (!inherits(InputsCrit, "InputsCrit")) {
stop("InputsCrit must be of class 'InputsCrit'") stop("'InputsCrit' must be of class 'InputsCrit'")
} }
if (inherits(InputsCrit, "Multi")) { if (inherits(InputsCrit, "Multi")) {
stop("InputsCrit must be of class 'Single' or 'Compo'") stop("'InputsCrit' must be of class 'Single' or 'Compo'")
} }
if (inherits(InputsCrit, "Single")) { if (inherits(InputsCrit, "Single")) {
listVarObs <- InputsCrit$varObs listVarObs <- InputsCrit$varObs
...@@ -45,10 +45,10 @@ Calibration_Michel <- function(InputsModel, ...@@ -45,10 +45,10 @@ Calibration_Michel <- function(InputsModel,
RunOptions$Outputs_Cal <- c(RunOptions$Outputs_Cal, "SnowPack") RunOptions$Outputs_Cal <- c(RunOptions$Outputs_Cal, "SnowPack")
} }
if (!inherits(CalibOptions, "CalibOptions")) { if (!inherits(CalibOptions, "CalibOptions")) {
stop("CalibOptions must be of class 'CalibOptions'") stop("'CalibOptions' must be of class 'CalibOptions'")
} }
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)) { if (!missing(FUN_CRIT)) {
warning("argument 'FUN_CRIT' is deprecated. The error criterion function is now automatically get from the 'InputsCrit' object") warning("argument 'FUN_CRIT' is deprecated. The error criterion function is now automatically get from the 'InputsCrit' object")
...@@ -131,7 +131,7 @@ Calibration_Michel <- function(InputsModel, ...@@ -131,7 +131,7 @@ Calibration_Michel <- function(InputsModel,
} }
if (is.null(FUN_TRANSFO)) { if (is.null(FUN_TRANSFO)) {
stop("FUN_TRANSFO was not found (in Calibration function)") stop("'FUN_TRANSFO' was not found (in 'Calibration' function)")
} }
} }
...@@ -512,7 +512,3 @@ Calibration_Michel <- function(InputsModel, ...@@ -512,7 +512,3 @@ Calibration_Michel <- function(InputsModel,
} }
...@@ -15,7 +15,7 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -15,7 +15,7 @@ CreateCalibOptions <- function(FUN_MOD,
FUN_TRANSFO <- match.fun(FUN_TRANSFO) FUN_TRANSFO <- match.fun(FUN_TRANSFO)
} }
if (!is.logical(IsHyst) | length(IsHyst) != 1L) { if (!is.logical(IsHyst) | length(IsHyst) != 1L) {
stop("'IsHyst' must be a 'logical' of length 1") stop("'IsHyst' must be a logical of length 1")
} }
##check_FUN_MOD ##check_FUN_MOD
BOOL <- FALSE BOOL <- FALSE
...@@ -64,7 +64,7 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -64,7 +64,7 @@ CreateCalibOptions <- function(FUN_MOD,
ObjectClass <- c(ObjectClass, "hysteresis") ObjectClass <- c(ObjectClass, "hysteresis")
} }
if (!BOOL) { if (!BOOL) {
stop("incorrect FUN_MOD for use in CreateCalibOptions") stop("incorrect 'FUN_MOD' for use in 'CreateCalibOptions'")
return(NULL) return(NULL)
} }
...@@ -76,7 +76,7 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -76,7 +76,7 @@ CreateCalibOptions <- function(FUN_MOD,
BOOL <- TRUE BOOL <- TRUE
} }
if (!BOOL) { if (!BOOL) {
stop("incorrect FUN_CALIB for use in CreateCalibOptions") stop("incorrect 'FUN_CALIB' for use in 'CreateCalibOptions'")
return(NULL) return(NULL)
} }
...@@ -113,7 +113,7 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -113,7 +113,7 @@ CreateCalibOptions <- function(FUN_MOD,
} }
} }
if (is.null(FUN1)) { if (is.null(FUN1)) {
stop("FUN1 was not found") stop("'FUN1' was not found")
return(NULL) return(NULL)
} }
##_set_FUN2 ##_set_FUN2
...@@ -164,7 +164,7 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -164,7 +164,7 @@ CreateCalibOptions <- function(FUN_MOD,
} }
} }
if (is.null(FUN_TRANSFO)) { if (is.null(FUN_TRANSFO)) {
stop("FUN_TRANSFO was not found") stop("'FUN_TRANSFO' was not found")
return(NULL) return(NULL)
} }
...@@ -211,13 +211,13 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -211,13 +211,13 @@ CreateCalibOptions <- function(FUN_MOD,
stop("FixedParam must be a vector") stop("FixedParam must be a vector")
} }
if (length(FixedParam) != NParam) { if (length(FixedParam) != NParam) {
stop("Incompatibility between FixedParam length and FUN_MOD") stop("Incompatibility between 'FixedParam' length and 'FUN_MOD'")
} }
if (all(!is.na(FixedParam))) { if (all(!is.na(FixedParam))) {
stop("At least one parameter must be not set (NA)") stop("At least one parameter must be not set (NA)")
} }
if (all(is.na(FixedParam))) { if (all(is.na(FixedParam))) {
warning("You have not set any parameter in \"FixedParam\"") warning("You have not set any parameter in 'FixedParam'")
} }
} }
...@@ -229,19 +229,19 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -229,19 +229,19 @@ CreateCalibOptions <- function(FUN_MOD,
} else { } else {
if (!is.matrix(SearchRanges)) { if (!is.matrix(SearchRanges)) {
stop("SearchRanges must be a matrix") stop("'SearchRanges' must be a matrix")
} }
if (!is.numeric(SearchRanges)) { if (!is.numeric(SearchRanges)) {
stop("SearchRanges must be a matrix of numeric values") stop("'SearchRanges' must be a matrix of numeric values")
} }
if (sum(is.na(SearchRanges)) != 0) { if (sum(is.na(SearchRanges)) != 0) {
stop("SearchRanges must not include NA values") stop("'SearchRanges' must not include NA values")
} }
if (nrow(SearchRanges) != 2) { if (nrow(SearchRanges) != 2) {
stop("SearchRanges must have 2 rows") stop("'SearchRanges' must have 2 rows")
} }
if (ncol(SearchRanges) != NParam) { if (ncol(SearchRanges) != NParam) {
stop("Incompatibility between SearchRanges ncol and FUN_MOD") stop("Incompatibility between 'SearchRanges' ncol and 'FUN_MOD'")
} }
} }
...@@ -336,30 +336,30 @@ CreateCalibOptions <- function(FUN_MOD, ...@@ -336,30 +336,30 @@ CreateCalibOptions <- function(FUN_MOD,
##check_StartParamList_and_StartParamDistrib__format ##check_StartParamList_and_StartParamDistrib__format
if ("HBAN" %in% ObjectClass & !is.null(StartParamList)) { if ("HBAN" %in% ObjectClass & !is.null(StartParamList)) {
if (!is.matrix(StartParamList)) { if (!is.matrix(StartParamList)) {
stop("StartParamList must be a matrix") stop("'StartParamList' must be a matrix")
} }
if (!is.numeric(StartParamList)) { if (!is.numeric(StartParamList)) {
stop("StartParamList must be a matrix of numeric values") stop("'StartParamList' must be a matrix of numeric values")
} }
if (sum(is.na(StartParamList)) != 0) { if (sum(is.na(StartParamList)) != 0) {
stop("StartParamList must not include NA values") stop("'StartParamList' must not include NA values")
} }
if (ncol(StartParamList) != NParam) { if (ncol(StartParamList) != NParam) {
stop("Incompatibility between StartParamList ncol and FUN_MOD") stop("Incompatibility between 'StartParamList' ncol and 'FUN_MOD'")
} }
} }
if ("HBAN" %in% ObjectClass & !is.null(StartParamDistrib)) { if ("HBAN" %in% ObjectClass & !is.null(StartParamDistrib)) {
if (!is.matrix(StartParamDistrib)) { if (!is.matrix(StartParamDistrib)) {
stop("StartParamDistrib must be a matrix") stop("'StartParamDistrib' must be a matrix")
} }
if (!is.numeric(StartParamDistrib[1, ])) { if (!is.numeric(StartParamDistrib[1, ])) {
stop("StartParamDistrib must be a matrix of numeric values") stop("'StartParamDistrib' must be a matrix of numeric values")
} }
if (sum(is.na(StartParamDistrib[1, ])) != 0) { if (sum(is.na(StartParamDistrib[1, ])) != 0) {
stop("StartParamDistrib must not include NA values on the first line") stop("'StartParamDistrib' must not include NA values on the first line")
} }
if (ncol(StartParamDistrib) != NParam) { if (ncol(StartParamDistrib) != NParam) {
stop("Incompatibility between StartParamDistrib ncol and FUN_MOD") stop("Incompatibility between 'StartParamDistrib' ncol and 'FUN_MOD'")
} }
} }
......
...@@ -30,10 +30,10 @@ CreateInputsCrit <- function(FUN_CRIT, ...@@ -30,10 +30,10 @@ CreateInputsCrit <- function(FUN_CRIT,
} }
} }
if (!missing(Ind_zeroes) & warnings) { if (!missing(Ind_zeroes) & warnings) {
warning("Deprecated 'Ind_zeroes' argument") warning("deprecated 'Ind_zeroes' argument")
} }
if (!missing(verbose)) { if (!missing(verbose)) {
warning("Deprecated 'verbose' argument. Use 'warnings', instead") warning("deprecated 'verbose' argument. Use 'warnings', instead")
} }
...@@ -329,7 +329,7 @@ CreateInputsCrit <- function(FUN_CRIT, ...@@ -329,7 +329,7 @@ CreateInputsCrit <- function(FUN_CRIT,
apply(combInputsCrit, MARGIN = 2, function(i) { apply(combInputsCrit, MARGIN = 2, function(i) {
equalInputsCrit <- identical(InputsCrit[[i[1]]], InputsCrit[[i[2]]]) equalInputsCrit <- identical(InputsCrit[[i[1]]], InputsCrit[[i[2]]])
if(equalInputsCrit) { if(equalInputsCrit) {
warning(sprintf("Elements %i and %i of the criteria list are identical. This might not be necessary", i[1], i[2]), call. = FALSE) warning(sprintf("elements %i and %i of the criteria list are identical. This might not be necessary", i[1], i[2]), call. = FALSE)
} }
}) })
} }
......
...@@ -60,26 +60,26 @@ CreateInputsModel <- function(FUN_MOD, ...@@ -60,26 +60,26 @@ CreateInputsModel <- function(FUN_MOD,
BOOL <- TRUE BOOL <- TRUE
} }
if (!BOOL) { if (!BOOL) {
stop("Incorrect FUN_MOD for use in CreateInputsModel") stop("incorrect 'FUN_MOD' for use in 'CreateInputsModel'")
} }
##check_arguments ##check_arguments
if ("GR" %in% ObjectClass | "CemaNeige" %in% ObjectClass) { if ("GR" %in% ObjectClass | "CemaNeige" %in% ObjectClass) {
if (is.null(DatesR)) { if (is.null(DatesR)) {
stop("DatesR is missing") stop("'DatesR' is missing")
} }
if (!"POSIXlt" %in% class(DatesR) & !"POSIXct" %in% class(DatesR)) { if (!"POSIXlt" %in% class(DatesR) & !"POSIXct" %in% class(DatesR)) {
stop("DatesR must be defined as POSIXlt or POSIXct") stop("'DatesR' must be defined as 'POSIXlt' or 'POSIXct'")
} }
if (!"POSIXlt" %in% class(DatesR)) { if (!"POSIXlt" %in% class(DatesR)) {
DatesR <- as.POSIXlt(DatesR) DatesR <- as.POSIXlt(DatesR)
} }
if (!difftime(tail(DatesR, 1), tail(DatesR, 2), units = "secs")[[1]] %in% TimeStep) { if (!difftime(tail(DatesR, 1), tail(DatesR, 2), units = "secs")[[1]] %in% TimeStep) {
TimeStepName <- grep("hourly|daily|monthly|yearly", ObjectClass, value = TRUE) TimeStepName <- grep("hourly|daily|monthly|yearly", ObjectClass, value = TRUE)
stop(paste0("The time step of the model inputs must be ", TimeStepName, "\n")) stop(paste0("the time step of the model inputs must be ", TimeStepName, "\n"))
} }
if (any(duplicated(DatesR))) { if (any(duplicated(DatesR))) {
stop("DatesR must not include duplicated values") stop("'DatesR' must not include duplicated values")
} }
LLL <- length(DatesR) LLL <- length(DatesR)
} }
...@@ -88,73 +88,73 @@ CreateInputsModel <- function(FUN_MOD, ...@@ -88,73 +88,73 @@ CreateInputsModel <- function(FUN_MOD,
stop("Precip is missing") stop("Precip is missing")
} }
if (is.null(PotEvap)) { if (is.null(PotEvap)) {
stop("PotEvap is missing") stop("'PotEvap' is missing")
} }
if (!is.vector(Precip) | !is.vector(PotEvap)) { if (!is.vector(Precip) | !is.vector(PotEvap)) {
stop("Precip and PotEvap must be vectors of numeric values") stop("'Precip' and 'PotEvap' must be vectors of numeric values")
} }
if (!is.numeric(Precip) | !is.numeric(PotEvap)) { if (!is.numeric(Precip) | !is.numeric(PotEvap)) {
stop("Precip and PotEvap must be vectors of numeric values") stop("'Precip' and 'PotEvap' must be vectors of numeric values")
} }
if (length(Precip) != LLL | length(PotEvap) != LLL) { if (length(Precip) != LLL | length(PotEvap) != LLL) {
stop("Precip, PotEvap and DatesR must have the same length") stop("'Precip', 'PotEvap' and 'DatesR' must have the same length")
} }
} }
if ("CemaNeige" %in% ObjectClass) { if ("CemaNeige" %in% ObjectClass) {
if (is.null(Precip)) { if (is.null(Precip)) {
stop("Precip is missing") stop("'Precip' is missing")
} }
if (is.null(TempMean)) { if (is.null(TempMean)) {
stop("TempMean is missing") stop("'TempMean' is missing")
} }
if (!is.vector(Precip) | !is.vector(TempMean)) { if (!is.vector(Precip) | !is.vector(TempMean)) {
stop("Precip and TempMean must be vectors of numeric values") stop("'Precip' and 'TempMean' must be vectors of numeric values")
} }
if (!is.numeric(Precip) | !is.numeric(TempMean)) { if (!is.numeric(Precip) | !is.numeric(TempMean)) {
stop("Precip and TempMean must be vectors of numeric values") stop("'Precip' and 'TempMean' must be vectors of numeric values")
} }
if (length(Precip) != LLL | length(TempMean) != LLL) { if (length(Precip) != LLL | length(TempMean) != LLL) {
stop("Precip, TempMean and DatesR must have the same length") stop("'Precip', 'TempMean' and 'DatesR' must have the same length")
} }
if (is.null(TempMin) != is.null(TempMax)) { if (is.null(TempMin) != is.null(TempMax)) {
stop("TempMin and TempMax must be both defined if not null") stop("'TempMin' and 'TempMax' must be both defined if not null")
} }
if (!is.null(TempMin) & !is.null(TempMax)) { if (!is.null(TempMin) & !is.null(TempMax)) {
if (!is.vector(TempMin) | !is.vector(TempMax)) { if (!is.vector(TempMin) | !is.vector(TempMax)) {
stop("TempMin and TempMax must be vectors of numeric values") stop("'TempMin' and 'TempMax' must be vectors of numeric values")
} }
if (!is.numeric(TempMin) | !is.numeric(TempMax)) { if (!is.numeric(TempMin) | !is.numeric(TempMax)) {
stop("TempMin and TempMax must be vectors of numeric values") stop("'TempMin' and 'TempMax' must be vectors of numeric values")
} }
if (length(TempMin) != LLL | length(TempMax) != LLL) { if (length(TempMin) != LLL | length(TempMax) != LLL) {
stop("TempMin, TempMax and DatesR must have the same length") stop("'TempMin', 'TempMax' and 'DatesR' must have the same length")
} }
} }
if (!is.null(HypsoData)) { if (!is.null(HypsoData)) {
if (!is.vector(HypsoData)) { if (!is.vector(HypsoData)) {
stop("HypsoData must be a vector of numeric values if not null") stop("'HypsoData' must be a vector of numeric values if not null")
} }
if (!is.numeric(HypsoData)) { if (!is.numeric(HypsoData)) {
stop("HypsoData must be a vector of numeric values if not null") stop("'HypsoData' must be a vector of numeric values if not null")
} }
if (length(HypsoData) != 101) { if (length(HypsoData) != 101) {
stop("HypsoData must be of length 101 if not null") stop("'HypsoData' must be of length 101 if not null")
} }
if (sum(is.na(HypsoData)) != 0 & sum(is.na(HypsoData)) != 101) { if (sum(is.na(HypsoData)) != 0 & sum(is.na(HypsoData)) != 101) {
stop("HypsoData must not contain any NA if not null") stop("'HypsoData' must not contain any NA if not null")
} }
} }
if (!is.null(ZInputs)) { if (!is.null(ZInputs)) {
if (length(ZInputs) != 1) { if (length(ZInputs) != 1) {
stop("\t ZInputs must be a single numeric value if not null") stop("'ZInputs' must be a single numeric value if not null")
} }
if (is.na(ZInputs) | !is.numeric(ZInputs)) { if (is.na(ZInputs) | !is.numeric(ZInputs)) {
stop("\t ZInputs must be a single numeric value if not null") stop("'ZInputs' must be a single numeric value if not null")
} }
} }
if (is.null(HypsoData)) { if (is.null(HypsoData)) {
if (verbose) { if (verbose) {
warning("\t HypsoData is missing => a single layer is used and no extrapolation is made") warning("'HypsoData' is missing: a single layer is used and no extrapolation is made")
} }
HypsoData <- as.numeric(rep(NA, 101)) HypsoData <- as.numeric(rep(NA, 101))
ZInputs <- as.numeric(NA) ZInputs <- as.numeric(NA)
...@@ -163,15 +163,15 @@ CreateInputsModel <- function(FUN_MOD, ...@@ -163,15 +163,15 @@ CreateInputsModel <- function(FUN_MOD,
} }
if (is.null(ZInputs)) { if (is.null(ZInputs)) {
if (verbose & !identical(HypsoData, as.numeric(rep(NA, 101)))) { if (verbose & !identical(HypsoData, as.numeric(rep(NA, 101)))) {
warning("\t ZInputs is missing => HypsoData[51] is used") warning("'ZInputs' is missing: HypsoData[51] is used")
} }
ZInputs <- HypsoData[51L] ZInputs <- HypsoData[51L]
} }
if (NLayers <= 0) { if (NLayers <= 0) {
stop("NLayers must be a positive integer value") stop("'NLayers' must be a positive integer value")
} }
if (NLayers != as.integer(NLayers)) { if (NLayers != as.integer(NLayers)) {
warning("Coerce NLayers to be of integer type (", NLayers, " => ", as.integer(NLayers), ")") warning("Coerce 'NLayers' to be of integer type (", NLayers, ": ", as.integer(NLayers), ")")
NLayers <- as.integer(NLayers) NLayers <- as.integer(NLayers)
} }
} }
...@@ -185,14 +185,14 @@ CreateInputsModel <- function(FUN_MOD, ...@@ -185,14 +185,14 @@ CreateInputsModel <- function(FUN_MOD,
if (sum(BOOL_NA_TMP) != 0) { if (sum(BOOL_NA_TMP) != 0) {
BOOL_NA <- BOOL_NA | BOOL_NA_TMP BOOL_NA <- BOOL_NA | BOOL_NA_TMP
if (verbose) { if (verbose) {
warning("\t Values < 0 or NA values detected in Precip series") warning("Values < 0 or NA values detected in 'Precip' series")
} }
} }
BOOL_NA_TMP <- (PotEvap < 0) | is.na(PotEvap) BOOL_NA_TMP <- (PotEvap < 0) | is.na(PotEvap)
if (sum(BOOL_NA_TMP) != 0) { if (sum(BOOL_NA_TMP) != 0) {
BOOL_NA <- BOOL_NA | BOOL_NA_TMP BOOL_NA <- BOOL_NA | BOOL_NA_TMP
if (verbose) { if (verbose) {
warning("\t Values < 0 or NA values detected in PotEvap series") warning("Values < 0 or NA values detected in 'PotEvap' series")
} }
} }
} }
...@@ -201,14 +201,14 @@ CreateInputsModel <- function(FUN_MOD, ...@@ -201,14 +201,14 @@ CreateInputsModel <- function(FUN_MOD,
if (sum(BOOL_NA_TMP) != 0) { if (sum(BOOL_NA_TMP) != 0) {
BOOL_NA <- BOOL_NA | BOOL_NA_TMP BOOL_NA <- BOOL_NA | BOOL_NA_TMP
if (verbose) { if (verbose) {
warning("\t Values < 0 or NA values detected in Precip series") warning("Values < 0 or NA values detected in 'Precip' series")
} }
} }
BOOL_NA_TMP <- (TempMean < (-150)) | is.na(TempMean) BOOL_NA_TMP <- (TempMean < (-150)) | is.na(TempMean)
if (sum(BOOL_NA_TMP) != 0) { if (sum(BOOL_NA_TMP) != 0) {
BOOL_NA <- BOOL_NA | BOOL_NA_TMP