From 69f1e711ee4897e4ee9fb0d56703240486b5f537 Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Tue, 17 Nov 2020 08:18:59 +0100 Subject: [PATCH] v1.6.3.63 style: simplify the condition tests (FALSE) in the RunModel_CemaNeigeGR* functions Refs #14 --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/RunModel_CemaNeigeGR5J.R | 22 +++++++++++----------- R/RunModel_CemaNeigeGR6J.R | 22 +++++++++++----------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6a4cb6e9..2262f50b 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.62 +Version: 1.6.3.63 Date: 2020-11-17 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 7586e403..505395fe 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ -### 1.6.3.62 Release Notes (2020-11-17) +### 1.6.3.63 Release Notes (2020-11-17) #### New features diff --git a/R/RunModel_CemaNeigeGR5J.R b/R/RunModel_CemaNeigeGR5J.R index 808339ff..7482fe51 100644 --- a/R/RunModel_CemaNeigeGR5J.R +++ b/R/RunModel_CemaNeigeGR5J.R @@ -10,25 +10,25 @@ RunModel_CemaNeigeGR5J <- 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(InputsModel, "CemaNeige") == FALSE) { + if (!inherits(InputsModel, "CemaNeige")) { stop("'InputsModel' must be of class 'CemaNeige'") } - 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 (inherits(RunOptions, "CemaNeige") == FALSE) { + if (!inherits(RunOptions, "CemaNeige")) { stop("'RunOptions' must be of class 'CemaNeige'") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -128,7 +128,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel, RunOptions, Param) { } ### ENDFOR_iLayer names(CemaNeigeLayers) <- sprintf("Layer%02i", seq_len(NLayers)) } ### ENDIF_RunSnowModule - if (inherits(RunOptions, "CemaNeige") == FALSE) { + if (!inherits(RunOptions, "CemaNeige")) { CemaNeigeLayers <- list() CemaNeigeStateEnd <- NULL NameCemaNeigeLayers <- NULL @@ -187,20 +187,20 @@ RunModel_CemaNeigeGR5J <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR & !ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(CemaNeigeLayers)) names(OutputsModel) <- c(FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers) } ## 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]), list(CemaNeigeLayers)) names(OutputsModel) <- c("DatesR", FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers) } ## 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(CemaNeigeLayers), list(RESULTS$StateEnd)) diff --git a/R/RunModel_CemaNeigeGR6J.R b/R/RunModel_CemaNeigeGR6J.R index 6f250281..62e1786b 100644 --- a/R/RunModel_CemaNeigeGR6J.R +++ b/R/RunModel_CemaNeigeGR6J.R @@ -10,25 +10,25 @@ RunModel_CemaNeigeGR6J <- 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(InputsModel, "CemaNeige") == FALSE) { + if (!inherits(InputsModel, "CemaNeige")) { stop("'InputsModel' must be of class 'CemaNeige'") } - 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 (inherits(RunOptions, "CemaNeige") == FALSE) { + if (!inherits(RunOptions, "CemaNeige")) { stop("'RunOptions' must be of class 'CemaNeige'") } if (!is.vector(Param) | !is.numeric(Param)) { @@ -132,7 +132,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel, RunOptions, Param) { } ### ENDFOR_iLayer names(CemaNeigeLayers) <- sprintf("Layer%02i", seq_len(NLayers)) } ### ENDIF_RunSnowModule - if (inherits(RunOptions, "CemaNeige") == FALSE) { + if (!inherits(RunOptions, "CemaNeige")) { CemaNeigeLayers <- list() CemaNeigeStateEnd <- NULL NameCemaNeigeLayers <- NULL @@ -192,20 +192,20 @@ RunModel_CemaNeigeGR6J <- function(InputsModel, RunOptions, Param) { ## Output_data_preparation ## OutputsModel_only - if (ExportDatesR == FALSE & ExportStateEnd == FALSE) { + if (!ExportDatesR== FALSE & !ExportStateEnd) { OutputsModel <- c(lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]), list(CemaNeigeLayers)) names(OutputsModel) <- c(FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers) } ## 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]), list(CemaNeigeLayers)) names(OutputsModel) <- c("DatesR", FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers) } ## 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(CemaNeigeLayers), list(RESULTS$StateEnd)) -- GitLab