Skip to content

Commit

Permalink
Merge pull request #180 from lawinslow/master
Browse files Browse the repository at this point in the history
Fix issue with single-timestep observation data
  • Loading branch information
Luke Winslow committed Sep 25, 2015
2 parents b34c59d + fa882f1 commit 402464f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: glmtools
Type: Package
Title: glmtools
Version: 0.10.0
Version: 0.10.1
Date: 2013-09-18
Authors@R: c( person("Jordan", "Read", role = c("aut","cre"),
email = "jread@usgs.gov"),
Expand Down
7 changes: 6 additions & 1 deletion R/time_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ trunc_time <- function(df, start_date, stop_date){
}

df_step <- diff(as.numeric(srt_dt[1:2]))
t_unit <- get_prec_time(df_step)
t_unit <- get_prec_time(df_step)
unit_s <- get_sec_unit(t_unit)

# truncate *inclusive*
Expand All @@ -79,6 +79,11 @@ trunc_time <- function(df, start_date, stop_date){
}

get_prec_time <- function(time_secs){

if(is.na(time_secs)){
return('days')
}

if (time_secs >= 3600 & time_secs < 86400){
prec = 'hours'
} else if (time_secs >= 60 & time_secs < 3600){
Expand Down

0 comments on commit 402464f

Please sign in to comment.