Converts data from a pat object with an irregular time axis to an airsensor object where the numeric data has been aggregated along a standardized hourly time axis, as well as adding additional required metadata for compatibility with the *PWFSLSmoke* package.

Current QC algorithms exist for channel = "ab" and include:

  • hourly_AB_00

  • hourly_AB_01

pat_createAirSensor_old(
  pat = NULL,
  period = "1 hour",
  parameter = "pm25",
  channel = "ab",
  qc_algorithm = "hourly_AB_01",
  min_count = 20,
  aggregation_FUN = pat_aggregate
)

Arguments

pat

PurpleAir Timeseries pat object.

period

Time period to average over. Can be "sec", "min", "hour", "day", "DSTday", "week", "month", "quarter" or "year". A number can also precede these options followed by a space (i.e. "2 day" or "37 min").

parameter

Parameter for which to create an as object -- one of "pm25", "humidity" or "temperature".

channel

Data channel to use for PM2.5 -- one of "a", "b or "ab".

qc_algorithm

Named QC algorithm to apply to hourly aggregation stats.

min_count

Aggregation bins with fewer than `min_count` measurements will be marked as `NA`.

aggregation_FUN

Function used to convert a pat object into a tibble of hourly statistics.

Value

An "airsensor" object of aggregated PurpleAir Timeseries data.

Note

The aggregation_FUN, allows users to pass in custom functions that generate new aggregation statistics. These statistics can then be utilized in a custom QC algorithm function. The algorithm function applied is generated from the qc_algorithm parameter with paste0("PurpleAirQC_", qc_algorithm).

See also

Examples

if (FALSE) { sensor <- example_pat %>% pat_filterDate(20180701, 20180901) %>% pat_createAirSensor_old() PWFSLSmoke::monitor_dailyBarplot(sensor) }