A pre-generated PurpleAir Timeseries pat object will be loaded for the given time interval if available. Data are loaded from the archive set with either setArchiveBaseUrl() or setArchiveBaseDir() for locally archived files.

Dates can be anything that is understood by MazamaCoreUtils::parseDatetime() including any of the following recommended formats:

  • "YYYYmmdd"

  • "YYYY-mm-dd"

  • "YYYY-mm-dd HH:MM:SS"

When no dates are specified, pat_loadLatest() is used, loading data for the last 7 days.

pat_load(
  id = NULL,
  label = NULL,
  pas = NULL,
  startdate = NULL,
  enddate = NULL,
  timezone = "America/Los_Angeles"
)

Arguments

id

PurpleAir sensor 'deviceDeploymentID'.

label

PurpleAir sensor 'label'.

pas

PurpleAir Synoptic pas object.

startdate

Desired start time (ISO 8601) or POSIXct.

enddate

Desired end time (ISO 8601) or POSIXct.

timezone

Timezone used to interpret start and end dates.

Value

A PurpleAir Timeseries pat object.

Note

Archive file names are generated with a unique "device-deployment" identifier by combining a unique location ID with a unique device ID. These "device-deployment" identifiers guarantee that movement of a sensor will result in the creation of a new time series.

Users may request a pat object in one of two ways:

1) Pass in id with a valid a deviceDeploymentID

2) Pass in both label and pas so that the deviceDeploymentID can be looked up.

Examples

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

library(AirSensor)

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

# Reference an older 'pas' before this sensor was dropped
pas <- pas_load(20190901, archival = TRUE)

pat <- pat_load(
  label = "SCNP_20", 
  pas = pas,
  startdate = 20190411, 
  enddate = 20190521
)

pat_multiPlot(pat)

}, silent = FALSE)
#> ERROR [2023-04-03 16:31:07] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190901_archival.rda
#> ERROR [2023-04-03 16:31:07] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190831_archival.rda
#> ERROR [2023-04-03 16:31:07] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190830_archival.rda
#> ERROR [2023-04-03 16:31:07] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190829_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190828_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190827_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190826_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190825_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190824_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190823_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190822_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190821_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190820_archival.rda
#> ERROR [2023-04-03 16:31:08] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190819_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190818_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190817_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190816_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190815_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190814_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190813_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190812_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190811_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190810_archival.rda
#> ERROR [2023-04-03 16:31:09] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190809_archival.rda
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190808_archival.rda
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190807_archival.rda
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190806_archival.rda
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190805_archival.rda
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190804_archival.rda
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2019/pas_20190803_archival.rda
#> Error : Data file could not be loaded after 30 tries
# }