From f5cbdf19bdc18d4ccacc70a472de37ab2c013d4d Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Thu, 28 Mar 2019 17:47:17 +0100
Subject: [PATCH] v1.2.12.5 BUG: add a check to always export Qsim in
 CreateRunOptions

---
 DESCRIPTION          |  2 +-
 NEWS.rmd             |  2 +-
 R/CreateRunOptions.R | 22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 30cb2830..166fd9e0 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.2.12.4
+Version: 1.2.12.5
 Date: 2019-03-29
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/NEWS.rmd b/NEWS.rmd
index 67c6c249..3324f710 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -13,7 +13,7 @@ output:
 
 
 
-### 1.2.12.4 Release Notes (2019-03-28) 
+### 1.2.12.5 Release Notes (2019-03-28) 
 
 
 
diff --git a/R/CreateRunOptions.R b/R/CreateRunOptions.R
index 523aecdb..3118e3b7 100644
--- a/R/CreateRunOptions.R
+++ b/R/CreateRunOptions.R
@@ -401,6 +401,28 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
   }
   
   
+  ##check_Qsim
+  if ("GR" %in% ObjectClass) {
+    if (!"Qsim" %in% Outputs_Cal & !"all" %in% Outputs_Cal) {
+      WTxt <- NULL
+      WTxt <- paste0(WTxt, "\t 'Qsim' was not defined in 'Outputs_Cal' \n")
+      WTxt <- paste0(WTxt, "\t -> it was automatically added \n")
+      if (!is.null(WTxt) & warnings) {
+        warning(WTxt)
+      }
+      Outputs_Cal <- c(Outputs_Cal, "Qsim")
+    }
+    if (!"Qsim" %in% Outputs_Sim & !"all" %in% Outputs_Sim) {
+      WTxt <- NULL
+      WTxt <- paste0(WTxt, "\t 'Qsim' was not defined in 'Outputs_Sim' \n")
+      WTxt <- paste0(WTxt, "\t -> it was automatically added \n")
+      if (!is.null(WTxt) & warnings) {
+        warning(WTxt)
+      }
+      Outputs_Sim <- c(Outputs_Sim, "Qsim")
+    }
+  }
+  
   ##Create_RunOptions
   RunOptions <- list(IndPeriod_WarmUp = IndPeriod_WarmUp,
                      IndPeriod_Run = IndPeriod_Run,
-- 
GitLab