Commit 7dc82d29 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.3.59 style: simplify the condition tests in the RunModel_GR* functions

Refs #14
parent 2846934f
Pipeline #17586 passed with stages
in 11 minutes and 18 seconds
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.3.58
Version: 1.6.3.59
Date: 2020-11-16
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -4,7 +4,7 @@
### 1.6.3.58 Release Notes (2020-11-16)
### 1.6.3.59 Release Notes (2020-11-16)
#### New features
......
......@@ -97,19 +97,19 @@ RunModel_GR2M <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- FortranOutputs[IndOutputs]
}
## DatesR_and_OutputsModel_only
if (ExportDatesR == TRUE & ExportStateEnd == FALSE) {
if (ExportDatesR & ExportStateEnd == FALSE) {
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 == FALSE & 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))
......
......@@ -102,19 +102,19 @@ RunModel_GR4H <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- FortranOutputs[IndOutputs]
}
## DatesR_and_OutputsModel_only
if (ExportDatesR == TRUE & ExportStateEnd == FALSE) {
if (ExportDatesR & ExportStateEnd == FALSE) {
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 == FALSE & 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))
......
......@@ -101,19 +101,19 @@ RunModel_GR4J <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- FortranOutputs[IndOutputs]
}
## DatesR_and_OutputsModel_only
if (ExportDatesR == TRUE & ExportStateEnd == FALSE) {
if (ExportDatesR & ExportStateEnd == FALSE) {
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 == TRUE) {
if (ExportDatesR == FALSE & 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_StateEnd
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))
......
......@@ -112,19 +112,19 @@ RunModel_GR5H <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- FortranOutputs[IndOutputs]
}
## DatesR_and_OutputsModel_only
if (ExportDatesR == TRUE & ExportStateEnd == FALSE) {
if (ExportDatesR & ExportStateEnd == FALSE) {
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 == TRUE) {
if (ExportDatesR == FALSE & 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_StateEnd
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))
......
......@@ -102,19 +102,19 @@ RunModel_GR5J <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- FortranOutputs[IndOutputs]
}
## DatesR_and_OutputsModel_only
if (ExportDatesR == TRUE & ExportStateEnd == FALSE) {
if (ExportDatesR & ExportStateEnd == FALSE) {
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 == FALSE & 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))
......
......@@ -107,19 +107,19 @@ RunModel_GR6J <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- FortranOutputs[IndOutputs]
}
## DatesR_and_OutputsModel_only
if (ExportDatesR == TRUE & ExportStateEnd == FALSE) {
if (ExportDatesR & ExportStateEnd == FALSE) {
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 == FALSE & 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))
......
Markdown is supported
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