# NOT RUN {
library(AirSensor)
# Default FUN = PurpleAirQC_hourly_AB_00
sensor <- pat_createAirSensor(example_pat)
PWFSLSmoke::monitor_timeseriesPlot(sensor, shadedNight = TRUE)
# Try out other package QC functions
example_pat %>%
pat_createAirSensor(FUN = PurpleAirQC_hourly_AB_01) %>%
PWFSLSmoke::monitor_timeseriesPlot(shadedNight = TRUE)
example_pat %>%
pat_createAirSensor(FUN = PurpleAirQC_hourly_AB_01) %>%
PWFSLSmoke::monitor_timeseriesPlot(shadedNight = TRUE)
# Custom FUN
humidity_correction <- function(pat, z = 0) {
# Default hourly aggregation
hourlyData <-
pat %>%
pat_aggregate() %>%
pat_extractData()
# Create custom_pm variable
pm25 <- (hourlyData$pm25_A + hourlyData$pm25_B) / 2
hum <- hourlyData$humidity
temp <- hourlyData$temperature
hourlyData$custom_pm <- pm25 - (pm25 * hum * z)
return(hourlyData)
}
# Evaluate custom FUN
sensor <- pat_createAirSensor(
example_pat,
parameter = "custom_pm",
FUN = humidity_correction,
z = .005
)
PWFSLSmoke::monitor_timeseriesPlot(sensor, shadedNight = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab