Commit 7845b31a authored by Dorchies David's avatar Dorchies David
Browse files

v1.6.8.27 fix: date not taken into account if first column not named DatesR

Refs #41
parent 6995f167
Pipeline #18088 passed with stages
in 12 minutes and 25 seconds
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.8.26
Date: 2020-12-02
Version: 1.6.8.27
Date: 2020-12-03
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"),
......
......@@ -102,7 +102,7 @@ SeriesAggreg.data.frame <- function(x,
stop <-
sprintf("%i-12-31 00:00:00", as.numeric(format(TabSeries2$DatesR[nrow(TabSeries2)], format = "%Y")) +
1)
Ts <- format(diff(x$DatesR[1:2]))
Ts <- format(diff(x[1:2, 1]))
if(gsub("[0-9]+ ", "", Ts) == "hours") {
by <- "hours"
} else {
......
......@@ -197,3 +197,12 @@ test_that("SeriesAggreg from and to the same time step should return initial tim
expect_warning(SeriesAggreg(I2, "%Y%m"), regexp = "No time-step conversion was performed")
expect_equal(I2, suppressWarnings(SeriesAggreg(I2, "%Y%m")))
})
test_that("SeriesAggreg.data.frame with first column not named DatesR should work",
{
expect_warning(SeriesAggreg(
data.frame(BasinObs$DatesR, BasinObs$Qmm),
Format = "%Y%m",
ConvertFun = "sum"
),
regexp = NA)
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment