Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.

Commit 033bd78

Browse files
authored
Merge pull request #61 from limnoliver/master
Fixes timezone issue in RMevents_samples
2 parents dca9b4d + f7dbb46 commit 033bd78

10 files changed

Lines changed: 24 additions & 16 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ Depends:
2323
R (>= 3.0)
2424
LazyLoad: yes
2525
LazyData: yes
26-
RoxygenNote: 6.0.1
26+
RoxygenNote: 6.1.0
2727
Suggests: testthat

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export(RMintensity)
1010
export(RMprep)
1111
export(discharge_events)
1212
import(dplyr)
13+
importFrom(lubridate,tz)
1314
importFrom(rlang,sym)

R/RMevents_sample.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#' @param bdate character column name in dfsamples for the beginning of the sampling period
1616
#' @param edate character column name in dfsamples for the ending of the sampling period
1717
#' @return list of storms and storms2
18+
#' @importFrom lubridate tz
1819
#' @export
1920
#' @examples
2021
#' RDB <- CedarRRain
@@ -48,6 +49,8 @@ RMevents_sample <- function(df,
4849
startRainDates <- numeric()
4950
endRainDates <- numeric()
5051
tipsbystorm <- data.frame()
52+
53+
rain_timezone <- lubridate::tz(df[,time])
5154

5255
for (i in 1:nrow(dfsamples)){
5356
beginRow <- max(which(df[,time]<dfsamples[i,bdate])+1)
@@ -109,8 +112,8 @@ RMevents_sample <- function(df,
109112
}
110113
tipsbystorm <- sub_tips
111114
} else {
112-
startRainDates <- as.POSIXct(c(startRainDates,BD), origin = "1970-01-01")
113-
endRainDates <- as.POSIXct(c(endRainDates,ED), origin = "1970-01-01")
115+
startRainDates <- as.POSIXct(c(startRainDates,BD), origin = "1970-01-01", tz = rain_timezone)
116+
endRainDates <- as.POSIXct(c(endRainDates,ED), origin = "1970-01-01", tz = rain_timezone)
114117
if (nrow(sub_tips) > 0) {
115118
event <- event + 1
116119
} else {

man/RMarf.Rd

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/RMerosivity.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/RMevents.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/RMevents.plotQ.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/RMevents_sample.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/RMintensity.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/RMprep.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)