Commit 69f1e711 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.3.63 style: simplify the condition tests (FALSE) in the RunModel_CemaNeigeGR* functions

Refs #14
parent 987c8320
Pipeline #17609 passed with stages
in 11 minutes and 21 seconds
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")),
......
......@@ -4,7 +4,7 @@
### 1.6.3.62 Release Notes (2020-11-17)
### 1.6.3.63 Release Notes (2020-11-17)
#### New features
......
......@@ -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))
......
......@@ -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))
......
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