Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HYCAR-Hydro
airGR
Commits
6995f167
Commit
6995f167
authored
Dec 03, 2020
by
Dorchies David
Browse files
v1.6.8.26 fix: NA produced when aggregating from montly time step
Refs
#41
,
#73
parent
b028fc19
Pipeline
#18085
failed with stages
in 1 minute and 24 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
6995f167
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.8.2
5
Version: 1.6.8.2
6
Date: 2020-12-02
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
...
...
R/SeriesAggreg.data.frame.R
View file @
6995f167
...
...
@@ -102,10 +102,16 @@ SeriesAggreg.data.frame <- function(x,
stop
<-
sprintf
(
"%i-12-31 00:00:00"
,
as.numeric
(
format
(
TabSeries2
$
DatesR
[
nrow
(
TabSeries2
)],
format
=
"%Y"
))
+
1
)
by
<-
ifelse
(
grepl
(
"hours"
,
format
(
diff
(
x
$
DatesR
[
1
:
2
]
))),
yes
=
"hours"
,
no
=
"days"
)
Ts
<-
format
(
diff
(
x
$
DatesR
[
1
:
2
]))
if
(
gsub
(
"[0-9]+ "
,
""
,
Ts
)
==
"hours"
)
{
by
<-
"hours"
}
else
{
if
(
gsub
(
" days$"
,
""
,
Ts
)
==
"1"
)
{
by
<-
"days"
}
else
{
by
<-
"months"
}
}
fakeTs
<-
data.frame
(
DatesR
=
seq
(
from
=
as.POSIXct
(
start
,
tz
=
"UTC"
),
...
...
tests/testthat/test-SeriesAggreg.R
View file @
6995f167
...
...
@@ -194,6 +194,6 @@ test_that("SeriesAggreg from and to the same time step should return initial tim
PotEvap
=
BasinObs
$
E
)
I2
<-
SeriesAggreg
(
InputsModel
,
"%Y%m"
)
I3
<-
SeriesAggreg
(
I2
,
"%Y%m"
)
expect_equal
(
I2
,
I3
)
expect_warning
(
SeriesAggreg
(
I2
,
"%Y%m"
)
,
regexp
=
"No time-step conversion was performed"
)
expect_equal
(
I2
,
suppressWarnings
(
SeriesAggreg
(
I2
,
"%Y%m"
))
)
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment