diff --git a/DESCRIPTION b/DESCRIPTION index 4f61d7730afe0c2192337d592efc2182f8aae1d0..5e98fec584e7d9d0bd555e24794e4d141005ef7e 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 8972e0032f632315ed8c5b5a01a4128587fb0dc0..609b6ae2943b4c3e783f70c8e9099b609518939a 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))