Skip to content

Commit

Permalink
sort times and provide warning on time fill #15
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulMelloy committed Sep 1, 2023
1 parent 6533604 commit 4cff3fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/format_weather.R
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,8 @@ format_weather <- function(w,
w_dt_agg[, mm := rep(0, .N)]
mm <- "mm"

w_dt_agg <- w_dt_agg[order(station,times)]

return(.fill_times(w_dt_agg))

} else{
Expand All @@ -597,6 +599,7 @@ format_weather <- function(w,
"Please supply a standard deviation of wind direction."
)
}
x_dt <- x_dt[order(station,times)]
return(.fill_times(x_dt))
}
}
Expand Down Expand Up @@ -699,6 +702,11 @@ format_weather <- function(w,
by = "hours"))

if(length(tseq_dt$times) != length(w_bystat$times)) {
warning("Non-continuous data detected. Extra lines will be merged into data
to ensure no time gaps. All weather data will be filled as NA.",
"\n This format request will likely cause the function to fail if
dat_check = TRUE. If set to false ensure data is imputed to prevent
model run errors.")
# merge in missing times
w_bystat <- merge(
x = tseq_dt,
Expand Down

0 comments on commit 4cff3fb

Please sign in to comment.