From 6ff9d57615316df9d636571344a0d239d902a06a Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Fri, 6 Nov 2020 11:57:56 +0100 Subject: [PATCH] v1.6.3.28 style: reformat conditional tests in RunModel_GR1A Refs #65 --- DESCRIPTION | 2 +- R/RunModel_GR1A.R | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4f61d773..5e98fec5 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.27 +Version: 1.6.3.28 Date: 2020-11-06 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/R/RunModel_GR1A.R b/R/RunModel_GR1A.R index 8972e003..609b6ae2 100644 --- a/R/RunModel_GR1A.R +++ b/R/RunModel_GR1A.R @@ -1,23 +1,22 @@ RunModel_GR1A <- function(InputsModel, RunOptions, Param) { NParam <- 1 - FortranOutputs <- .FortranOutputs(GR = "GR1A")$GR ## Arguments_check - if (inherits(InputsModel, "InputsModel") == FALSE) { + if (!inherits(InputsModel, "InputsModel")) { stop("'InputsModel' must be of class 'InputsModel'") } - if (inherits(InputsModel, "yearly") == FALSE) { + if (!inherits(InputsModel, "yearly")) { stop("'InputsModel' must be of class 'yearly'") } - 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)) { @@ -68,24 +67,24 @@ RunModel_GR1A <- 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 == TRUE & 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 == TRUE) { + 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") } ## DatesR and OutputsModel and SateEnd - if ((ExportDatesR == TRUE & ExportStateEnd == TRUE) | "all" %in% RunOptions$Outputs_Sim) { + if ((ExportDatesR & ExportStateEnd) | "all" %in% RunOptions$Outputs_Sim) { OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]), lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(RESULTS$StateEnd)) -- GitLab