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

v1.6.3.60 style: simplify the condition tests (FALSE) in the RunModel_GR* functions

Refs #14
parent 7dc82d29
Pipeline #17587 passed with stages
in 11 minutes and 10 seconds
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.3.59
Version: 1.6.3.60
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.59 Release Notes (2020-11-16)
### 1.6.3.60 Release Notes (2020-11-16)
#### New features
......
......@@ -7,19 +7,19 @@ RunModel_GR2M <- 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, "monthly" ) == FALSE) {
if (!inherits(InputsModel, "monthly" )) {
stop("'InputsModel' must be of class 'monthly' ")
}
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)) {
......@@ -92,18 +92,18 @@ RunModel_GR2M <- 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 & 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) {
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")
......
......@@ -7,19 +7,19 @@ RunModel_GR4H <- 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, "hourly" ) == FALSE) {
if (!inherits(InputsModel, "hourly" )) {
stop("'InputsModel' must be of class 'hourly' ")
}
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)) {
......@@ -97,18 +97,18 @@ RunModel_GR4H <- 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 & 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) {
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")
......
......@@ -7,19 +7,19 @@ RunModel_GR4J <- 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(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)) {
......@@ -96,18 +96,18 @@ RunModel_GR4J <- 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 & 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_StateEnd_only
if (ExportDatesR == FALSE & ExportStateEnd) {
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")
......
......@@ -13,19 +13,19 @@ RunModel_GR5H <- 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, "hourly" ) == FALSE) {
if (!inherits(InputsModel, "hourly" )) {
stop("'InputsModel' must be of class 'hourly' ")
}
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)) {
......@@ -107,18 +107,18 @@ RunModel_GR5H <- 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 & 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_StateEnd_only
if (ExportDatesR == FALSE & ExportStateEnd) {
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")
......
......@@ -7,19 +7,19 @@ RunModel_GR5J <- 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(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)) {
......@@ -97,18 +97,18 @@ RunModel_GR5J <- 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 & 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) {
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")
......
......@@ -7,19 +7,19 @@ RunModel_GR6J <- 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(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)) {
......@@ -102,18 +102,18 @@ RunModel_GR6J <- 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 & 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) {
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")
......
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