From 87bb2834f98e491b953dee3524f6c0a3df9b9698 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.fr>
Date: Sun, 18 Apr 2021 09:53:29 +0200
Subject: [PATCH] fix(test): use the 365.25 day by a year accordinf to the
 complete leap cycle of 400 years

---
 R/CreateRunOptions.R |  4 ++--
 R/Utils.R            | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/R/CreateRunOptions.R b/R/CreateRunOptions.R
index dfdedfc7..4edbdd71 100644
--- a/R/CreateRunOptions.R
+++ b/R/CreateRunOptions.R
@@ -387,10 +387,10 @@ CreateRunOptions <- function(FUN_MOD, InputsModel,
     }
     Factor <- NULL
     if (inherits(InputsModel, "hourly")) {
-      Factor <- 365.2425 * 24
+      Factor <- 365.25 * 24
     }
     if (inherits(InputsModel, "daily")) {
-      Factor <- 365.2425
+      Factor <- 365.25
     }
     if (inherits(InputsModel, "monthly")) {
       Factor <- 12
diff --git a/R/Utils.R b/R/Utils.R
index 7dd28d77..dadf299f 100644
--- a/R/Utils.R
+++ b/R/Utils.R
@@ -55,10 +55,10 @@
                            monthly =   28:31 * 24,
                            yearly  = 365:366 * 24)
     res$TimeStepMean <- switch(res$TimeUnit,
-                               hourly  =             1,
-                               daily   =             1 * 24,
-                               monthly = 365.2425 / 12 * 24,
-                               yearly  =      365.2425 * 24)
+                               hourly  =           1,
+                               daily   =           1 * 24,
+                               monthly = 365.25 / 12 * 24,
+                               yearly  =      365.25 * 24)
     res$TimeStep     <- res$TimeStep * 3600
     res$TimeStepMean <- as.integer(res$TimeStepMean * 3600)
     res$Class <- c(res$TimeUnit, res$Class)
@@ -68,7 +68,7 @@
     res$Class <- res$Class[!is.na(res$Class)]
     if (!is.null(DatesR)) {
       if (all(DiffTimeStep != res$TimeStep)) {
-        stop("the time step of the model inputs must be ", res$TimeUnit, "\n")
+        stop("the time step of the model inputs must be ", res$TimeUnit)
       }
     }
     return(res)
-- 
GitLab