monitor_nowcast: Apply Nowcast Algorithm to ws_monitor Object

View source: R/monitor_nowcast.R

monitor_nowcastR Documentation

Apply Nowcast Algorithm to ws_monitor Object

Description

A Nowcast algorithm is applied to the data in in the ws_monitor object. The version argument specifies the minimum weight factor and number of hours to be considered in the calculation.

Available versions include:

  1. pm: hours=12, weight=0.5

  2. pmAsian: hours=3, weight=0.1

  3. ozone: hours=8, weight=NA

The default, version='pm', is appropriate for typical usage.

Usage

monitor_nowcast(ws_monitor, version = "pm", includeShortTerm = FALSE)

Arguments

ws_monitor

ws_monitor object

version

character identity specifying the type of nowcast algorithm to be used

includeShortTerm

calcluate preliminary NowCast values starting with the 2nd hour

Details

This function calculates the current hour's NowCast value based on the value for the given hour and the previous N-1 hours, where N is the number of hours corresponding to the version argument (see Description above). For example, if version=pm, then the NowCast value for Hour 12 is based on the data from Hours 1-12.

The function requires valid data for at least two of the three latest hours; NA's are returned for hours where this condition is not met.

By default, the funtion will not return a valid value until the Nth hour. If includeShortTerm=TRUE, the function will return a valid value after only the 2nd hour (provided, of course, that both hours are valid).

Calculated Nowcast values are truncated to the nearest .1 ug/m3 for 'pm' and nearest .001 ppm for 'ozone' regardless of the precision of the data in the incoming ws_monitor object.

Value

A ws_monitor object with data that have been processed by the Nowcast algorithm.

References

https://en.wikipedia.org/wiki/Nowcast_(Air_Quality_Index)

https://aqicn.org/faq/2015-03-15/air-quality-nowcast-a-beginners-guide/

https://forum.airnowtech.org/t/the-nowcast-for-ozone-and-pm/172

https://forum.airnowtech.org/t/the-aqi-equation/169

https://forum.airnowtech.org/t/how-does-airnow-handle-negative-hourly-concentrations/143

Examples


library(PWFSLSmoke)

N_M <- monitor_subset(Northwest_Megafires, tlim=c(20150815,20150831))
Omak <- monitor_subset(N_M, monitorIDs='530470013_01')
Omak_nowcast <- monitor_nowcast(Omak, includeShortTerm=TRUE)
monitor_timeseriesPlot(Omak, type='l', lwd=2)
monitor_timeseriesPlot(Omak_nowcast, add=TRUE, type='l', col='purple', lwd=2)
addAQILines()
addAQILegend(lwd=1, pch=NULL)
legend("topleft", lwd=2, col=c('black','purple'), legend=c('hourly','nowcast'))
title("Omak, Washington Hourly and Nowcast PM2.5 Values in August, 2015")
# Zooming in to check on handling of missing values
monitor_timeseriesPlot(Omak, tlim=c(20150823,20150825))
monitor_timeseriesPlot(Omak_nowcast, tlim=c(20150823,20150825), pch=16,col='red',type='b', add=TRUE)
abline(v=Omak$data[is.na(Omak$data[,2]),1])
title("Missing values")


MazamaScience/PWFSLSmoke documentation built on July 3, 2023, 11:03 a.m.