monitor_rollingMean: Calculate Rolling Means

Description Usage Arguments Details Value Examples

View source: R/monitor_rollingMean.R

Description

Calculates rolling means for each monitor in ws_monitor using the openair::rollingMean() function

Usage

1
monitor_rollingMean(ws_monitor, width = 8, data.thresh = 75, align = "center")

Arguments

ws_monitor

ws_monitor object

width

number of periods to average (e.g. for hourly data, width = 24 calculates 24-hour rolling means)

data.thresh

minimum number of valid observations required as a percent of width; NA is returned if insufficient valid data to calculate mean

align

alignment of averaging window relative to point being calculated; one of "left|center|right"

Details

Value

A ws_monitor object with data thaty have been processed by a rolling mean algorithm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(PWFSLSmoke)

N_M <- Northwest_Megafires
wa_smoky <- monitor_subset(N_M, stateCodes='WA', tlim=c(20150801, 20150808), vlim=c(100,Inf))
wa_smoky_3hr <- monitor_rollingMean(wa_smoky, width=3, align="center")
wa_smoky_24hr <- monitor_rollingMean(wa_smoky, width=24, align="right")

monitor_timeseriesPlot(wa_smoky, type='l', shadedNight=TRUE)
monitor_timeseriesPlot(wa_smoky_3hr, type='l', col='red', add=TRUE)
monitor_timeseriesPlot(wa_smoky_24hr, type='l', col='blue', lwd=2, add=TRUE)
legend('topright', c("hourly","3-hourly","24-hourly"),
       col=c('black','red','blue'), lwd=c(1,1,2))
title('Smoky Monitors in Washington -- August, 2015')

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