From 0fb9d7dc4ef68b576fded7b5421236043242eaa8 Mon Sep 17 00:00:00 2001
From: David <david.dorchies@inrae.fr>
Date: Thu, 27 Oct 2022 11:10:15 +0200
Subject: [PATCH] docs: changes in RunModel.Supervisor example

- Simplify date selection

Refs #100
---
 man-examples/RunModel.Supervisor.R | 6 +++---
 man/CreateController.Rd            | 6 +++---
 man/CreateSupervisor.Rd            | 6 +++---
 man/RunModel.Supervisor.Rd         | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/man-examples/RunModel.Supervisor.R b/man-examples/RunModel.Supervisor.R
index 91bcf4f..6eacf4f 100644
--- a/man-examples/RunModel.Supervisor.R
+++ b/man-examples/RunModel.Supervisor.R
@@ -95,9 +95,9 @@ funDamLogic <- factoryDamLogic(
 CreateController(sv, "DamRelease", Y = c("54095", "54057"), U = c("Dam"), FUN = funDamLogic)
 
 # GRiwrmRunOptions object simulation of the hydrological year 2002-2003
-IndPeriod_Run <- seq.int(
-  which(IM_severn[[1]]$DatesR == as.POSIXct("2002-10-15", tz = "UTC")),
-  length.out = 365
+IndPeriod_Run <- which(
+  DatesR >= as.POSIXct("2002-10-15", tz = "UTC") &
+  DatesR <= as.POSIXct("2003-10-15", tz = "UTC")
 )
 IndPeriod_WarmUp <- seq.int(IndPeriod_Run[1] - 366, IndPeriod_Run[1] - 1)
 RO_severn <- CreateRunOptions(
diff --git a/man/CreateController.Rd b/man/CreateController.Rd
index 470638b..93c1021 100644
--- a/man/CreateController.Rd
+++ b/man/CreateController.Rd
@@ -140,9 +140,9 @@ funDamLogic <- factoryDamLogic(
 CreateController(sv, "DamRelease", Y = c("54095", "54057"), U = c("Dam"), FUN = funDamLogic)
 
 # GRiwrmRunOptions object simulation of the hydrological year 2002-2003
-IndPeriod_Run <- seq.int(
-  which(IM_severn[[1]]$DatesR == as.POSIXct("2002-10-15", tz = "UTC")),
-  length.out = 365
+IndPeriod_Run <- which(
+  DatesR >= as.POSIXct("2002-10-15", tz = "UTC") &
+  DatesR <= as.POSIXct("2003-10-15", tz = "UTC")
 )
 IndPeriod_WarmUp <- seq.int(IndPeriod_Run[1] - 366, IndPeriod_Run[1] - 1)
 RO_severn <- CreateRunOptions(
diff --git a/man/CreateSupervisor.Rd b/man/CreateSupervisor.Rd
index d758518..053aa41 100644
--- a/man/CreateSupervisor.Rd
+++ b/man/CreateSupervisor.Rd
@@ -122,9 +122,9 @@ funDamLogic <- factoryDamLogic(
 CreateController(sv, "DamRelease", Y = c("54095", "54057"), U = c("Dam"), FUN = funDamLogic)
 
 # GRiwrmRunOptions object simulation of the hydrological year 2002-2003
-IndPeriod_Run <- seq.int(
-  which(IM_severn[[1]]$DatesR == as.POSIXct("2002-10-15", tz = "UTC")),
-  length.out = 365
+IndPeriod_Run <- which(
+  DatesR >= as.POSIXct("2002-10-15", tz = "UTC") &
+  DatesR <= as.POSIXct("2003-10-15", tz = "UTC")
 )
 IndPeriod_WarmUp <- seq.int(IndPeriod_Run[1] - 366, IndPeriod_Run[1] - 1)
 RO_severn <- CreateRunOptions(
diff --git a/man/RunModel.Supervisor.Rd b/man/RunModel.Supervisor.Rd
index 3aa4f6b..540bc33 100644
--- a/man/RunModel.Supervisor.Rd
+++ b/man/RunModel.Supervisor.Rd
@@ -119,9 +119,9 @@ funDamLogic <- factoryDamLogic(
 CreateController(sv, "DamRelease", Y = c("54095", "54057"), U = c("Dam"), FUN = funDamLogic)
 
 # GRiwrmRunOptions object simulation of the hydrological year 2002-2003
-IndPeriod_Run <- seq.int(
-  which(IM_severn[[1]]$DatesR == as.POSIXct("2002-10-15", tz = "UTC")),
-  length.out = 365
+IndPeriod_Run <- which(
+  DatesR >= as.POSIXct("2002-10-15", tz = "UTC") &
+  DatesR <= as.POSIXct("2003-10-15", tz = "UTC")
 )
 IndPeriod_WarmUp <- seq.int(IndPeriod_Run[1] - 366, IndPeriod_Run[1] - 1)
 RO_severn <- CreateRunOptions(
-- 
GitLab