From 43c54cc047a836858fc266c1d1f6198778bcacd8 Mon Sep 17 00:00:00 2001 From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv> Date: Wed, 5 Apr 2017 16:13:58 +0200 Subject: [PATCH] v1.0.6.8 remove the using of the switch function (generate NOTE) --- DESCRIPTION | 2 +- R/plot.OutputsModel.R | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 85dc466a..0171a3ed 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.0.6.7 +Version: 1.0.6.8 Date: 2017-04-05 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl")), diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R index 50677f3d..9261b1dd 100644 --- a/R/plot.OutputsModel.R +++ b/R/plot.OutputsModel.R @@ -142,11 +142,15 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = } if (!is.null(BasinArea)) { - # function to use switch avoiding a NOTE when the package is check - UNIT_M3S <- function(x) { - return(switch(x, hour = 60*60, day = 24*60*60, month = 365.25/12*24*60*60, year = 365.25*24*60*60)) - } - Factor_UNIT_M3S <- BasinArea/(UNIT_M3S(NameTS)/1e3) + Factor_MMH_M3S <- 60 * 60 + Factor_MMD_M3S <- 60 * 60 * 24 + Factor_MMM_M3S <- 60 * 60 * 24 * 365.25 / 12 + Factor_MMY_M3S <- 60 * 60 * 24 * 365.25 + if (NameTS == "hour" ) Factor_UNIT_M3S <- Factor_MMH_M3S + if (NameTS == "day" ) Factor_UNIT_M3S <- Factor_MMD_M3S + if (NameTS == "month") Factor_UNIT_M3S <- Factor_MMM_M3S + if (NameTS == "year" ) Factor_UNIT_M3S <- Factor_MMY_M3S + Factor_UNIT_M3S <- BasinArea / (Factor_UNIT_M3S / 1000) } } -- GitLab