Enhance raw synoptic data from PurpleAir to create an improved dataframe compatible with the MazamaLocationUtils package.

Steps include:

1) Replace variable names with more consistent, human readable names.

2) Add spatial metadata for each sensor including:

  • timezone -- Olson timezone

  • countryCode -- ISO 3166-1 alpha-2

  • stateCode -- ISO 3166-2 alpha-2

3) Convert data types from character to POSIXct and numeric.

4) Add additional metadata items:

  • sensorManufacturer = "Purple Air"

Filtering by country can speed up the process of enhancement and may be performed by providing a vector of ISO country codes to the countryCodes argument. By default, no subsetting is performed.

Users may also limit results by specifying stateCodes when countryCodes is limited to a single country.

When a single US state is specified, named counties may be specified to further limit the results.

pas_enhanceRawData(
  pas_raw = NULL,
  countryCodes = NULL,
  stateCodes = NULL,
  counties = NULL,
  includePWFSL = TRUE
)

Arguments

pas_raw

Dataframe returned by pas_downloadParseRawData().

countryCodes

ISO 3166-1 alpha-2 country codes used to subset the data.

stateCodes

ISO-3166-2 alpha-2 state codes used to subset the data.

counties

US county names or 5-digit FIPS codes used to subset the data.

includePWFSL

Logical specifying whether to calculate distances from PWFSL monitors.

Value

Enhanced dataframe of synoptic PurpleAir data.