From 480878a520d67f0b34658d347fe9bf78f9f336d2 Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.priv> Date: Wed, 10 Oct 2018 10:53:16 +0200 Subject: [PATCH] v1.0.15.0 BUG: leap years now considered in CreateRunOptions --- DESCRIPTION | 2 +- NEWS.rmd | 8 +++++++- R/CreateRunOptions.R | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 470b0f6a..22da82dc 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.14.3 +Version: 1.0.15.0 Date: 2018-10-05 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 54853db3..0634ff1c 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -13,7 +13,13 @@ output: -### 1.0.14.3 Release Notes (2018-10-05) +### 1.0.14.5 Release Notes (2018-10-10) + + +#### Bug fixes + +- Fixed bug in <code>CreateRunOptions()</code>. The function now accounts correctly for leap years when no warm-up period is defined. + ____________________________________________________________________________________ diff --git a/R/CreateRunOptions.R b/R/CreateRunOptions.R index 3ca652f5..2c69dfa7 100644 --- a/R/CreateRunOptions.R +++ b/R/CreateRunOptions.R @@ -71,7 +71,11 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP WTxt <- paste(WTxt,"\t No data were found for model warm up! \n",sep=""); ##We_look_for_the_longest_period_preceeding_the_run_period_with_a_maximum_of_one_year } else { - TmpDateR <- InputsModel$DatesR[IndPeriod_Run[1]] - 365*24*60*60; ### minimal date to start the warmup + TmpDateR0 <- InputsModel$DatesR[IndPeriod_Run[1]] + TmpDateR <- TmpDateR0 - 365*24*60*60; ### minimal date to start the warmup + if (format(TmpDateR, format = "%d") != format(TmpDateR0, format = "%d")) { ### leap year + TmpDateR <- TmpDateR - 1*24*60*60 + } IndPeriod_WarmUp <- which(InputsModel$DatesR==max(InputsModel$DatesR[1],TmpDateR)) : (IndPeriod_Run[1]-1); if("hourly" %in% ObjectClass){ TimeStep <- as.integer( 60*60); } if("daily" %in% ObjectClass){ TimeStep <- as.integer( 24*60*60); } -- GitLab