From 73d492387d9b3cce56e5ffc590d0665f4bb7756c Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Mon, 20 May 2019 11:01:39 +0200
Subject: [PATCH] v1.3.0.2 UPDATE: CreateRunOptions modified to take into
 account RunModel_CemaNeigeGR4H

---
 DESCRIPTION          |  2 +-
 NEWS.rmd             |  2 +-
 R/CreateRunOptions.R | 10 +++++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 168a3e55..012f5d14 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.3.0.1
+Version: 1.3.0.2
 Date: 2019-05-20
 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 e40e821e..a95daa51 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -14,7 +14,7 @@ output:
 
 
 
-### 1.3.0.1 Release Notes (2019-05-20)
+### 1.3.0.2 Release Notes (2019-05-20)
 
 
 #### New features
diff --git a/R/CreateRunOptions.R b/R/CreateRunOptions.R
index 0dc15e76..d1eb8b1c 100644
--- a/R/CreateRunOptions.R
+++ b/R/CreateRunOptions.R
@@ -40,6 +40,10 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
     ObjectClass <- c(ObjectClass, "GR", "CemaNeige", "daily")
     BOOL <- TRUE
   }
+  if (identical(FUN_MOD, RunModel_CemaNeigeGR4H)) {
+    ObjectClass <- c(ObjectClass, "GR", "CemaNeige", "hourly")
+    BOOL <- TRUE
+  }
   if (IsHyst) {
     ObjectClass <- c(ObjectClass, "hysteresis")
   }
@@ -156,7 +160,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
       if (!is.vector(IniResLevels) | !is.numeric(IniResLevels) | any(is.na(IniResLevels))) {
         stop("'IniResLevels' must be a vector of numeric values")
       }
-      if ((identical(FUN_MOD, RunModel_GR4H) |
+      if ((identical(FUN_MOD, RunModel_GR4H) | identical(FUN_MOD, RunModel_CemaNeigeGR4H) |
            identical(FUN_MOD, RunModel_GR4J) | identical(FUN_MOD, RunModel_CemaNeigeGR4J) |
            identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) |
            identical(FUN_MOD, RunModel_GR2M)) &
@@ -194,7 +198,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
   NState <- NULL
   if ("GR" %in% ObjectClass | "CemaNeige" %in% ObjectClass) {
     if ("hourly"  %in% ObjectClass) {
-      NState <- 7 + 3 * 24 * 20
+      NState <- 7 + 3 * 24 * 20+ 4 * NLayers
     }
     if ("daily"   %in% ObjectClass) {
       NState <- 7 + 3 * 20 + 4 * NLayers
@@ -267,7 +271,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
   
   ##Outputs_all
   Outputs_all <- NULL
-  if (identical(FUN_MOD,RunModel_GR4H)) {
+  if (identical(FUN_MOD,RunModel_GR4H) | identical(FUN_MOD,RunModel_CemaNeigeGR4H)) {
     Outputs_all <- c(Outputs_all, .FortranOutputs(GR = "GR4H")$GR)
   }
   if (identical(FUN_MOD,RunModel_GR4J) | identical(FUN_MOD,RunModel_CemaNeigeGR4J)) {
-- 
GitLab