monitor_dailyThreshold: Calculate Daily Counts of Values At or Above a Threshold

Description Usage Arguments Details Value Examples

View source: R/monitor_dailyThreshold.R

Description

Calculates the number of hours per day each monitor in ws_monitor was at or above a given threshold

Usage

1
2
3
4
5
6
7
monitor_dailyThreshold(
  ws_monitor,
  threshold = "unhealthy",
  dayStart = "midnight",
  minHours = 0,
  na.rm = TRUE
)

Arguments

ws_monitor

ws_monitor object

threshold

AQI level name (e.g. "unhealthy") or numerical threshold at or above which a measurement is counted

dayStart

one of "sunset|midnight|sunrise"

minHours

minimum number of hourly observations required

na.rm

logical value indicating whether NA values should be ignored

Details

NOTE: The returned counts include values at OR ABOVE the given threshold; this applies to both categories and values. For example, passing a threshold argument = "unhealthy" will return a daily count of values that are unhealthy, very unhealthy, or extreme (i.e. >= 55.5), as will passing a threshold argument = 55.5.

AQI levels for threshold argument = one of "good|moderate|usg|unhealthy|very unhealthy|extreme"

Sunrise and sunset times are calculated based on the first monitor encountered. This should be accurate enough for all use cases involving co-located monitors. Monitors from different regions should have daily statistics calculated separately.

The returned ws_monitor object has a daily time axis where each time is set to 00:00, local time.

Value

A ws_monitor object with a daily count of hours at or above threshold.

Examples

1
2
3
4
5
6
7
library(PWFSLSmoke)

N_M <- monitor_subset(Northwest_Megafires, tlim=c(20150801,20150831))
Twisp <- monitor_subset(N_M, monitorIDs='530470009_01')
Twisp_daily <- monitor_dailyThreshold(Twisp, "unhealthy", dayStart='midnight', minHours=1)
monitor_timeseriesPlot(Twisp_daily, type='h', lwd=6, ylab="Hours")
title("Twisp, Washington Hours per day Above 'Unhealthy', 2015")

PWFSLSmoke documentation built on Nov. 23, 2021, 5:06 p.m.