Trims the date range of a ws_monitor object to local time date boundaries which are within the range of data. This has the effect of removing partial-day data records at the start and end of the timeseries and is useful when calculating full-day statistics.

Day boundaries are calculated using the specified timezone or, if NULL, from ws_monitor$meta$timezone.

monitor_trimDate(ws_monitor = NULL, timezone = NULL)

Arguments

ws_monitor

ws_monitor ws_monitor object.

timezone

Olson timezone used to interpret dates.

Value

A subset of the given ws_monitor object.

Examples

library(AirMonitorPlots) UTC_week <- PWFSLSmoke::monitor_subset( PWFSLSmoke::Carmel_Valley, tlim = c(20160801, 20160808), timezone = "UTC" ) # UTC day boundaries head(UTC_week$data)
#> datetime a9572a904a4ed46d_060530002 #> 1 2016-08-01 00:00:00 NA #> 2 2016-08-01 01:00:00 16 #> 3 2016-08-01 02:00:00 18 #> 4 2016-08-01 03:00:00 12 #> 5 2016-08-01 04:00:00 16 #> 6 2016-08-01 05:00:00 16
# Trim to local time day boundaries local_week <- monitor_trimDate(UTC_week) head(local_week$data)
#> datetime a9572a904a4ed46d_060530002 #> 1 2016-08-01 07:00:00 17 #> 2 2016-08-01 08:00:00 15 #> 3 2016-08-01 09:00:00 14 #> 4 2016-08-01 10:00:00 12 #> 5 2016-08-01 11:00:00 17 #> 6 2016-08-01 12:00:00 20