R/monitor_dailyThreshold.R
monitor_dailyThreshold.Rd
Calculates the number of hours per day each time series in monitor
was
at or above a given threshold.
Because the returned mts_monitor object is defined on a daily axis in a
specific time zone, it is important that the incoming monitor
contain
only timeseries within a single time zone.
mts_monitor object.
AQI level name (e.g. "unhealthy"
) or numerical
threshold at and above which a measurement is counted.
Logical value indicating whether NA values should be ignored.
Minimum number of valid hourly records per day required to
calculate statistics. Days with fewer valid records will be assigned NA
.
Treatment of daylight savings time: "clock" uses daylight savings time as defined in the local timezone, "LST" uses "local standard time" all year round.
Version of NAAQS levels to use. See Note.
A mts_monitor object containing daily counts of hours at or above
a threshold value. (A list with
meta
and data
dataframes.)
When dayBoundary = "clock"
, the returned monitor$data$datetime
time axis will be defined in the local timezone (not "UTC") with days defined
by midnight as it appears on a clock in that timezone. The transition from
DST to standard time will result in a 23 hour day and standard to DST in a
25 hour day.
When dayBoundary = "LST"
, the returned monitor$data$datetime
time axis will be defined in "UTC" with times as they appear in standard
time in the local timezone. These days will be one hour off from clock
time during DST but every day will consist of 24 hours.
On February 7, 2024, EPA strengthened the National Ambient Air Quality Standards for Particulate Matter (PM NAAQS) to protect millions of Americans from harmful and costly health impacts, such as heart attacks and premature death. Particle or soot pollution is one of the most dangerous forms of air pollution, and an extensive body of science links it to a range of serious and sometimes deadly illnesses. EPA is setting the level of the primary (health-based) annual PM2.5 standard at 9.0 micrograms per cubic meter to provide increased public health protection, consistent with the available health science. See PM NAAQS update.
library(AirMonitor)
# Hours at MODERATE or above
Carmel_Valley %>%
monitor_dailyThreshold("Moderate") %>%
monitor_getData()
#> # A tibble: 24 × 2
#> datetime a9572a904a4ed46d_840060530002
#> <dttm> <int>
#> 1 2016-07-22 00:00:00 0
#> 2 2016-07-23 00:00:00 9
#> 3 2016-07-24 00:00:00 13
#> 4 2016-07-25 00:00:00 24
#> 5 2016-07-26 00:00:00 19
#> 6 2016-07-27 00:00:00 11
#> 7 2016-07-28 00:00:00 7
#> 8 2016-07-29 00:00:00 5
#> 9 2016-07-30 00:00:00 9
#> 10 2016-07-31 00:00:00 19
#> # ℹ 14 more rows
# Hours at MODERATE or above with the 2024 updated NAAQS
Carmel_Valley %>%
monitor_dailyThreshold("Moderate", NAAQS = "PM2.5_2024") %>%
monitor_getData()
#> # A tibble: 24 × 2
#> datetime a9572a904a4ed46d_840060530002
#> <dttm> <int>
#> 1 2016-07-22 00:00:00 0
#> 2 2016-07-23 00:00:00 9
#> 3 2016-07-24 00:00:00 13
#> 4 2016-07-25 00:00:00 24
#> 5 2016-07-26 00:00:00 19
#> 6 2016-07-27 00:00:00 11
#> 7 2016-07-28 00:00:00 7
#> 8 2016-07-29 00:00:00 5
#> 9 2016-07-30 00:00:00 9
#> 10 2016-07-31 00:00:00 19
#> # ℹ 14 more rows
# Hours at UNHEALTHY or above
Carmel_Valley %>%
monitor_dailyThreshold("Unhealthy") %>%
monitor_getData()
#> # A tibble: 24 × 2
#> datetime a9572a904a4ed46d_840060530002
#> <dttm> <int>
#> 1 2016-07-22 00:00:00 0
#> 2 2016-07-23 00:00:00 0
#> 3 2016-07-24 00:00:00 0
#> 4 2016-07-25 00:00:00 0
#> 5 2016-07-26 00:00:00 14
#> 6 2016-07-27 00:00:00 1
#> 7 2016-07-28 00:00:00 1
#> 8 2016-07-29 00:00:00 0
#> 9 2016-07-30 00:00:00 0
#> 10 2016-07-31 00:00:00 5
#> # ℹ 14 more rows