Download, parse and enhance hourly timeseries data from PurpleAir and create an object of class mts_monitor for use with the AirMonitor package.

PurpleAir_createMonitor(
  api_key = NULL,
  pas = NULL,
  sensor_index = NULL,
  parameter = c("pm2.5_atm"),
  startdate = NULL,
  enddate = NULL,
  timezone = "UTC",
  verbose = FALSE
)

Arguments

api_key

PurpleAir API READ Key. If api_key = NULL, it will be obtained using getAPIKey("PurpleAir-read").

pas

Previously generated pas object containing sensor_index.

sensor_index

PurpleAir sensor identifier.

parameter

Parameter to use for data ("pm2.5_atm")

startdate

Desired start time (ISO 8601) or POSIXct.

enddate

Desired end time (ISO 8601) or POSIXct.

timezone

Olson timezone used to interpret dates.

verbose

Logical controlling the generation of warning and error messages.

Value

An AirMonitor package mts_monitor object.

Note

This is a very earily implementation that does not include any QC or correction equations.

Examples

# \donttest{
# Fail gracefully if any resources are not available
try({

library(AirSensor2)

initializeMazamaSpatialUtils()

mon <-
  PurpleAir_createMonitor(
    api_key = PurpleAir_API_READ_KEY,
    pas = MY_PAS,
    sensor_index = "76545",
    startdate = "2023-01-01",
    enddate = "2023-01-08",
    timezone = "UTC",
    verbose = TRUE
  )

}, silent = FALSE)
#> Error in PurpleAir_createMonitor(api_key = PurpleAir_API_READ_KEY, pas = MY_PAS,  : 
#>   object 'PurpleAir_API_READ_KEY' not found
# }