Optionally applies QC thresholds to a pat object based on the documented specs of the PurpleAir sensor.
The pat_load()
function returns raw "engineering" data for a
PurpleAir Sensor. The very first level of QC that should always be applied
is the removal of out-of-spec values that should never be generated by the
sensor components. Out-of-spec values imply an electrical or software problem
and can never be considered valid measurements.
Setting a max_humidity
threshold is less fundamental. There are many
cases where PM2.5 readings during periods of high humidity should be called
into question which is why this QC option is provided. However, this type of
filtering is dependent upon a properly functioning humidity sensor. Humidity
filtering is disabled by default because it can result in the invalidation
of many potentially valid PM2.5 measurements.
pat_qc(pat = NULL, removeOutOfSpec = TRUE, max_humidity = NULL)
PurpleAir Timeseries pat object
Logical determining whether measurements that are out of instrument specs should be invalidated.
Maximum humidity threshold above which pm25 measurements are invalidated. Disabled unless explicitly set.
A cleaned up pat object.
Out of spec thresholds are set so that anything outside of these the given range should represent a value that is not physically possible in an ambient setting on planet Earth.
humidity
-- [0:100]
temperature
-- [-40:185]
pm25
-- [0:2000]
# \donttest{
library(AirSensor)
# Use a sensor with problems
pat <- example_pat
# Basic plot shows out-of-spec values for humidity
pat %>% pat_multiPlot(sampleSize = NULL)
# Applying QC removes these records
pat %>% pat_qc() %>% pat_multiPlot(sampleSize = NULL)
# We can also remove PM2.5 data at high humidities
pat %>% pat_qc(max_humidity = 80) %>% pat_multiPlot(sampleSize = NULL)
#> Warning: Removed 1011 rows containing missing values (`geom_point()`).
#> Warning: Removed 1011 rows containing missing values (`geom_point()`).
# }