From b3e94744507b09ff993253c30e0096551376b4ff Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.fr>
Date: Thu, 30 Apr 2020 21:07:50 +0200
Subject: [PATCH] v1.4.7.3 fix: plot.OutputsModel function updated in order to
 allow to plot OutputsModel returned by SeriesAggreg function #41

---
 DESCRIPTION           |  2 +-
 NEWS.md               |  2 +-
 R/plot.OutputsModel.R | 24 ++++++++++++------------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index cd205ce0..46f13e2c 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.4.7.2
+Version: 1.4.7.3
 Date: 2020-04-30
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/NEWS.md b/NEWS.md
index 81136563..19623bbd 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,7 +4,7 @@
 
 
 
-### 1.4.7.2 Release Notes (2020-04-30)
+### 1.4.7.3 Release Notes (2020-04-30)
 
 #### New features
 
diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R
index 8a52f9d3..f80438cb 100644
--- a/R/plot.OutputsModel.R
+++ b/R/plot.OutputsModel.R
@@ -159,23 +159,23 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
       return(filter(x, filter = rep(1 / n, n), sides = 2, circular = TRUE))
     }    
     BOOL_TS  <- FALSE
-    TimeStep <- difftime(tail(OutputsModel$DatesR, 1), tail(OutputsModel$DatesR, 2), units = "secs")[[1]]
-    if (inherits(OutputsModel, "hourly") &
-        TimeStep %in% (60 * 60)) {
+    # TimeStep <- difftime(tail(OutputsModel$DatesR, 1), tail(OutputsModel$DatesR, 2), units = "secs")[[1]]
+    if (inherits(OutputsModel, "hourly")){# &
+        # TimeStep %in% (60 * 60)) {
       BOOL_TS <- TRUE
       NameTS <- "hour"
       plotunit <- "[mm/h]"
       formatAxis <- "%m/%Y"
     }
-    if (inherits(OutputsModel, "daily") &
-        TimeStep %in% (24 * 60 * 60)) {
+    if (inherits(OutputsModel, "daily")) {# &
+        # TimeStep %in% (24 * 60 * 60)) {
       BOOL_TS <- TRUE
       NameTS <- "day"
       plotunit <- "[mm/d]"
       formatAxis <- "%m/%Y"
     }
-    if (inherits(OutputsModel, "monthly") &
-        TimeStep %in% (c(28, 29, 30, 31) * 24 * 60 * 60)) {
+    if (inherits(OutputsModel, "monthly")){# &
+        # TimeStep %in% (c(28, 29, 30, 31) * 24 * 60 * 60)) {
       BOOL_TS <- TRUE
       NameTS <- "month"
       plotunit <- "[mm/month]"
@@ -184,16 +184,16 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
         OutputsModel$DatesR <- as.POSIXlt(format(OutputsModel$DatesR, format = "%Y-%m-01"), tz = "UTC", format = "%Y-%m-%d")
       }
     }
-    if (inherits(OutputsModel, "yearly") &
-        TimeStep %in% (c(365, 366) * 24 * 60 * 60)) {
+    if (inherits(OutputsModel, "yearly")){#} &
+        # TimeStep %in% (c(365, 366) * 24 * 60 * 60)) {
       BOOL_TS <- TRUE
       NameTS <- "year"
       plotunit <- "[mm/y]"
       formatAxis <- "%Y"
     }
-    if (!BOOL_TS) {
-      stop("the time step of the model inputs could not be found")
-    }
+    # if (!BOOL_TS) {
+    #   stop("the time step of the model inputs could not be found")
+    # }
   }
   if (length(IndPeriod_Plot) == 0) {
     IndPeriod_Plot <- 1:length(OutputsModel$DatesR)
-- 
GitLab