From 7fb10e9460135d813773629d21c1cb6a6e568994 Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Mon, 16 Nov 2020 09:03:44 +0100 Subject: [PATCH] v1.6.3.60 style: simplify the condition tests (FALSE) in the RunModel_GR* functions Refs #14 --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/RunModel_GR2M.R | 16 ++++++++-------- R/RunModel_GR4H.R | 16 ++++++++-------- R/RunModel_GR4J.R | 16 ++++++++-------- R/RunModel_GR5H.R | 16 ++++++++-------- R/RunModel_GR5J.R | 16 ++++++++-------- R/RunModel_GR6J.R | 16 ++++++++-------- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bf61cd20..6399e036 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.6.3.59 +Version: 1.6.3.60 Date: 2020-11-16 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NEWS.md b/NEWS.md index 1453cbd2..3ce055e6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ -### 1.6.3.59 Release Notes (2020-11-16) +### 1.6.3.60 Release Notes (2020-11-16) #### New features diff --git a/R/RunModel_GR2M.R b/R/RunModel_GR2M.R index 65d5e1a3..90255dbd 100644 --- a/R/RunModel_GR2M.R +++ b/R/RunModel_GR2M.R @@ -7,19 +7,19 @@ RunModel_GR2M <- function(InputsModel, RunOptions, Param) { ## Arguments_check - if (inherits(InputsModel, "InputsModel") == FALSE) { + if (!inherits(InputsModel, "InputsModel")) { stop("'InputsModel' must be of class 'InputsModel'") } - if (inherits(InputsModel, "monthly" ) == FALSE) { + if (!inherits(InputsModel, "monthly" )) { stop("'InputsModel' must be of class 'monthly' ") } - if (inherits(InputsModel, "GR" ) == FALSE) { + if (!inherits(InputsModel, "GR" )) { stop("'InputsModel' must be of class 'GR' ") } - if (inherits(RunOptions, "RunOptions" ) == FALSE) { + if (!inherits(RunOptions, "RunOptions" )) { stop("'RunOptions' must be of class 'RunOptions' ") } - if (inherits(RunOptions, "GR" ) == FALSE) { + if (!inherits(RunOptions, "GR" )) { stop("'RunOptions' must be of class 'GR' ") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -92,18 +92,18 @@ RunModel_GR2M <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR & !ExportStateEnd) { OutputsModel <- lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]) names(OutputsModel) <- FortranOutputs[IndOutputs] } ## DatesR_and_OutputsModel_only - if (ExportDatesR & ExportStateEnd == FALSE) { + if (ExportDatesR & !ExportStateEnd) { OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]), lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i])) names(OutputsModel) <- c("DatesR", FortranOutputs[IndOutputs]) } ## OutputsModel_and_SateEnd_only - if (ExportDatesR == FALSE & ExportStateEnd) { + if (!ExportDatesR & ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(RESULTS$StateEnd)) names(OutputsModel) <- c(FortranOutputs[IndOutputs], "StateEnd") diff --git a/R/RunModel_GR4H.R b/R/RunModel_GR4H.R index 7090844b..9620a630 100644 --- a/R/RunModel_GR4H.R +++ b/R/RunModel_GR4H.R @@ -7,19 +7,19 @@ RunModel_GR4H <- function(InputsModel, RunOptions, Param) { ## Arguments_check - if (inherits(InputsModel, "InputsModel") == FALSE) { + if (!inherits(InputsModel, "InputsModel")) { stop("'InputsModel' must be of class 'InputsModel'") } - if (inherits(InputsModel, "hourly" ) == FALSE) { + if (!inherits(InputsModel, "hourly" )) { stop("'InputsModel' must be of class 'hourly' ") } - if (inherits(InputsModel, "GR" ) == FALSE) { + if (!inherits(InputsModel, "GR" )) { stop("'InputsModel' must be of class 'GR' ") } - if (inherits(RunOptions, "RunOptions" ) == FALSE) { + if (!inherits(RunOptions, "RunOptions" )) { stop("'RunOptions' must be of class 'RunOptions' ") } - if (inherits(RunOptions, "GR" ) == FALSE) { + if (!inherits(RunOptions, "GR" )) { stop("'RunOptions' must be of class 'GR' ") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -97,18 +97,18 @@ RunModel_GR4H <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR & !ExportStateEnd) { OutputsModel <- lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]) names(OutputsModel) <- FortranOutputs[IndOutputs] } ## DatesR_and_OutputsModel_only - if (ExportDatesR & ExportStateEnd == FALSE) { + if (ExportDatesR & !ExportStateEnd) { OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]), lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i])) names(OutputsModel) <- c("DatesR", FortranOutputs[IndOutputs]) } ## OutputsModel_and_SateEnd_only - if (ExportDatesR == FALSE & ExportStateEnd) { + if (!ExportDatesR & ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(RESULTS$StateEnd)) names(OutputsModel) <- c(FortranOutputs[IndOutputs], "StateEnd") diff --git a/R/RunModel_GR4J.R b/R/RunModel_GR4J.R index 9720662a..00e1f10c 100644 --- a/R/RunModel_GR4J.R +++ b/R/RunModel_GR4J.R @@ -7,19 +7,19 @@ RunModel_GR4J <- function(InputsModel, RunOptions, Param) { ## Arguments_check - if (inherits(InputsModel, "InputsModel") == FALSE) { + if (!inherits(InputsModel, "InputsModel")) { stop("'InputsModel' must be of class 'InputsModel'") } - if (inherits(InputsModel, "daily" ) == FALSE) { + if (!inherits(InputsModel, "daily" )) { stop("'InputsModel' must be of class 'daily' ") } - if (inherits(InputsModel, "GR" ) == FALSE) { + if (!inherits(InputsModel, "GR" )) { stop("'InputsModel' must be of class 'GR' ") } - if (inherits(RunOptions, "RunOptions" ) == FALSE) { + if (!inherits(RunOptions, "RunOptions" )) { stop("'RunOptions' must be of class 'RunOptions' ") } - if (inherits(RunOptions, "GR" ) == FALSE) { + if (!inherits(RunOptions, "GR" )) { stop("'RunOptions' must be of class 'GR' ") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -96,18 +96,18 @@ RunModel_GR4J <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR & !ExportStateEnd) { OutputsModel <- lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]) names(OutputsModel) <- FortranOutputs[IndOutputs] } ## DatesR_and_OutputsModel_only - if (ExportDatesR & ExportStateEnd == FALSE) { + if (ExportDatesR & !ExportStateEnd) { OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]), lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i])) names(OutputsModel) <- c("DatesR", FortranOutputs[IndOutputs]) } ## OutputsModel_and_StateEnd_only - if (ExportDatesR == FALSE & ExportStateEnd) { + if (!ExportDatesR & ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(RESULTS$StateEnd)) names(OutputsModel) <- c(FortranOutputs[IndOutputs], "StateEnd") diff --git a/R/RunModel_GR5H.R b/R/RunModel_GR5H.R index e0f70bd1..6291e7b1 100644 --- a/R/RunModel_GR5H.R +++ b/R/RunModel_GR5H.R @@ -13,19 +13,19 @@ RunModel_GR5H <- function(InputsModel, RunOptions, Param) { ## Arguments_check - if (inherits(InputsModel, "InputsModel") == FALSE) { + if (!inherits(InputsModel, "InputsModel")) { stop("'InputsModel' must be of class 'InputsModel'") } - if (inherits(InputsModel, "hourly" ) == FALSE) { + if (!inherits(InputsModel, "hourly" )) { stop("'InputsModel' must be of class 'hourly' ") } - if (inherits(InputsModel, "GR" ) == FALSE) { + if (!inherits(InputsModel, "GR" )) { stop("'InputsModel' must be of class 'GR' ") } - if (inherits(RunOptions, "RunOptions" ) == FALSE) { + if (!inherits(RunOptions, "RunOptions" )) { stop("'RunOptions' must be of class 'RunOptions' ") } - if (inherits(RunOptions, "GR" ) == FALSE) { + if (!inherits(RunOptions, "GR" )) { stop("'RunOptions' must be of class 'GR' ") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -107,18 +107,18 @@ RunModel_GR5H <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR & !ExportStateEnd) { OutputsModel <- lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]) names(OutputsModel) <- FortranOutputs[IndOutputs] } ## DatesR_and_OutputsModel_only - if (ExportDatesR & ExportStateEnd == FALSE) { + if (ExportDatesR & !ExportStateEnd) { OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]), lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i])) names(OutputsModel) <- c("DatesR", FortranOutputs[IndOutputs]) } ## OutputsModel_and_StateEnd_only - if (ExportDatesR == FALSE & ExportStateEnd) { + if (!ExportDatesR & ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(RESULTS$StateEnd)) names(OutputsModel) <- c(FortranOutputs[IndOutputs], "StateEnd") diff --git a/R/RunModel_GR5J.R b/R/RunModel_GR5J.R index 1af193e5..5322ea03 100644 --- a/R/RunModel_GR5J.R +++ b/R/RunModel_GR5J.R @@ -7,19 +7,19 @@ RunModel_GR5J <- function(InputsModel, RunOptions, Param) { ## Arguments_check - if (inherits(InputsModel, "InputsModel") == FALSE) { + if (!inherits(InputsModel, "InputsModel")) { stop("'InputsModel' must be of class 'InputsModel'") } - if (inherits(InputsModel, "daily" ) == FALSE) { + if (!inherits(InputsModel, "daily" )) { stop("'InputsModel' must be of class 'daily' ") } - if (inherits(InputsModel, "GR" ) == FALSE) { + if (!inherits(InputsModel, "GR" )) { stop("'InputsModel' must be of class 'GR' ") } - if (inherits(RunOptions, "RunOptions" ) == FALSE) { + if (!inherits(RunOptions, "RunOptions" )) { stop("'RunOptions' must be of class 'RunOptions' ") } - if (inherits(RunOptions, "GR" ) == FALSE) { + if (!inherits(RunOptions, "GR" )) { stop("'RunOptions' must be of class 'GR' ") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -97,18 +97,18 @@ RunModel_GR5J <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR & !ExportStateEnd) { OutputsModel <- lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]) names(OutputsModel) <- FortranOutputs[IndOutputs] } ## DatesR_and_OutputsModel_only - if (ExportDatesR & ExportStateEnd == FALSE) { + if (ExportDatesR & !ExportStateEnd) { OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]), lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i])) names(OutputsModel) <- c("DatesR", FortranOutputs[IndOutputs]) } ## OutputsModel_and_SateEnd_only - if (ExportDatesR == FALSE & ExportStateEnd) { + if (!ExportDatesR & ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(RESULTS$StateEnd)) names(OutputsModel) <- c(FortranOutputs[IndOutputs], "StateEnd") diff --git a/R/RunModel_GR6J.R b/R/RunModel_GR6J.R index 46e5fc8d..c5b9f431 100644 --- a/R/RunModel_GR6J.R +++ b/R/RunModel_GR6J.R @@ -7,19 +7,19 @@ RunModel_GR6J <- function(InputsModel, RunOptions, Param) { ## Arguments_check - if (inherits(InputsModel, "InputsModel") == FALSE) { + if (!inherits(InputsModel, "InputsModel")) { stop("'InputsModel' must be of class 'InputsModel'") } - if (inherits(InputsModel, "daily" ) == FALSE) { + if (!inherits(InputsModel, "daily" )) { stop("'InputsModel' must be of class 'daily' ") } - if (inherits(InputsModel, "GR" ) == FALSE) { + if (!inherits(InputsModel, "GR" )) { stop("'InputsModel' must be of class 'GR' ") } - if (inherits(RunOptions, "RunOptions" ) == FALSE) { + if (!inherits(RunOptions, "RunOptions" )) { stop("'RunOptions' must be of class 'RunOptions' ") } - if (inherits(RunOptions, "GR" ) == FALSE) { + if (!inherits(RunOptions, "GR" )) { stop("'RunOptions' must be of class 'GR' ") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -102,18 +102,18 @@ RunModel_GR6J <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR & !ExportStateEnd) { OutputsModel <- lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]) names(OutputsModel) <- FortranOutputs[IndOutputs] } ## DatesR_and_OutputsModel_only - if (ExportDatesR & ExportStateEnd == FALSE) { + if (ExportDatesR & !ExportStateEnd) { OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]), lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i])) names(OutputsModel) <- c("DatesR", FortranOutputs[IndOutputs]) } ## OutputsModel_and_SateEnd_only - if (ExportDatesR == FALSE & ExportStateEnd) { + if (!ExportDatesR & ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(RESULTS$StateEnd)) names(OutputsModel) <- c(FortranOutputs[IndOutputs], "StateEnd") -- GitLab