Commit 6ff9d576 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.3.28 style: reformat conditional tests in RunModel_GR1A

Refs #65
Showing with 10 additions and 11 deletions
+10 -11
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")),
......
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))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment