Commit 987c8320 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.3.62 style: simplify the condition tests (TRUE) in the RunModel_CemaNeigeGR* functions

Refs #14
Showing with 12 additions and 12 deletions
+12 -12
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.3.61
Version: 1.6.3.62
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.61 Release Notes (2020-11-17)
### 1.6.3.62 Release Notes (2020-11-17)
#### New features
......
......@@ -72,7 +72,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel, RunOptions, Param) {
## SNOW_MODULE________________________________________________________________________________
if (inherits(RunOptions, "CemaNeige") == TRUE) {
if (inherits(RunOptions, "CemaNeige")) {
if ("all" %in% RunOptions$Outputs_Sim) {
IndOutputsCemaNeige <- as.integer(1:length(FortranOutputs$CN))
} else {
......@@ -181,7 +181,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel, RunOptions, Param) {
verbose = FALSE)
}
if (inherits(RunOptions, "CemaNeige") == TRUE & "Precip" %in% RunOptions$Outputs_Sim) {
if (inherits(RunOptions, "CemaNeige") & "Precip" %in% RunOptions$Outputs_Sim) {
RESULTS$Outputs[,which(FortranOutputs$GR[IndOutputsMod] == "Precip")] <- InputsModel$Precip[IndPeriod1]
}
......@@ -193,21 +193,21 @@ RunModel_CemaNeigeGR5J <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- c(FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers)
}
## 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]),
list(CemaNeigeLayers))
names(OutputsModel) <- c("DatesR", FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers)
}
## 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(CemaNeigeLayers),
list(RESULTS$StateEnd))
names(OutputsModel) <- c(FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers, "StateEnd")
}
## DatesR_and_OutputsModel_and_SateEnd
if (ExportDatesR == TRUE & ExportStateEnd == TRUE) {
if (ExportDatesR & ExportStateEnd) {
OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]),
lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]),
list(CemaNeigeLayers),
......
......@@ -76,7 +76,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel, RunOptions, Param) {
## SNOW_MODULE________________________________________________________________________________
if (inherits(RunOptions, "CemaNeige") == TRUE) {
if (inherits(RunOptions, "CemaNeige")) {
if ("all" %in% RunOptions$Outputs_Sim) {
IndOutputsCemaNeige <- as.integer(1:length(FortranOutputs$CN))
} else {
......@@ -186,7 +186,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel, RunOptions, Param) {
verbose = FALSE)
}
if (inherits(RunOptions, "CemaNeige") == TRUE & "Precip" %in% RunOptions$Outputs_Sim) {
if (inherits(RunOptions, "CemaNeige") & "Precip" %in% RunOptions$Outputs_Sim) {
RESULTS$Outputs[,which(FortranOutputs$GR[IndOutputsMod] == "Precip")] <- InputsModel$Precip[IndPeriod1]
}
......@@ -198,21 +198,21 @@ RunModel_CemaNeigeGR6J <- function(InputsModel, RunOptions, Param) {
names(OutputsModel) <- c(FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers)
}
## 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]),
list(CemaNeigeLayers))
names(OutputsModel) <- c("DatesR", FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers)
}
## 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(CemaNeigeLayers),
list(RESULTS$StateEnd))
names(OutputsModel) <- c(FortranOutputs$GR[IndOutputsMod], NameCemaNeigeLayers, "StateEnd")
}
## DatesR_and_OutputsModel_and_SateEnd
if (ExportDatesR == TRUE & ExportStateEnd == TRUE) {
if (ExportDatesR & ExportStateEnd) {
OutputsModel <- c(list(InputsModel$DatesR[RunOptions$IndPeriod_Run]),
lapply(seq_len(RESULTS$NOutputs), function(i) RESULTS$Outputs[IndPeriod2, i]),
list(CemaNeigeLayers),
......
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