A pre-generated airsensor object will be loaded for the given time interval. Archived data for SCAQMD sensors go back to January, 2018.

Dates can be anything that is understood by lubrdiate::parse_date_time() including either of the following recommended formats:

  • "YYYYmmdd"

  • "YYYY-mm-dd"

By default, the current week is loaded.

sensor_load(
  collection = "scaqmd",
  startdate = NULL,
  enddate = NULL,
  days = 7,
  timezone = "America/Los_Angeles"
)

Arguments

collection

Name associated with the collection.

startdate

Desired start datetime (ISO 8601).

enddate

Desired end datetime (ISO 8601).

days

Number of days of data to include (7 or 45).

timezone

Timezone used to interpret start and end dates.

Value

An object of class "airsensor".

Examples

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

library(AirSensor)

setArchiveBaseUrl("https://airsensor.aqmd.gov/PurpleAir/v1")

sensor_load("scaqmd", 20200411, 20200521) %>%
  PWFSLSmoke::monitor_timeseriesPlot(style = 'gnats')

}, silent = FALSE)
#> ERROR [2023-04-03 16:31:32] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/airsensor/2020/airsensor_scaqmd_2020.rda
#> ERROR [2023-04-03 16:31:32] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/airsensor/2020/airsensor_scaqmd_202004.rda
#> ERROR [2023-04-03 16:31:32] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/airsensor/2020/airsensor_scaqmd_202005.rda
#> Error in sensor_load("scaqmd", 20200411, 20200521) : 
#>   No data found in the archive covering the period 2020-04-11 to 2020-05-20 PDT
# }