R/airnow_createMetaDataframes.R
airnow_createMetaDataframes.Rd
The airnow_createMetaDataframes()
function uses the airnow_downloadSites()
function
to download site metadata from AirNow and restructures that data into a format that is compatible
with the PWFSLSmoke package ws_monitor data model.
The meta
dataframe in the ws_monitor data model has metadata associated with monitoring
site locations for a specific parameter and must contain at least the following columns:
monitorID -- per deployment unique ID
longitude -- decimal degrees E
latitude -- decimal degrees N
elevation -- height above sea level in meters
timezone -- olson timezone
countryCode -- ISO 3166-1 alpha-2
stateCode -- ISO 3166-2 alpha-2
The meta
dataframe will have rownames matching monitorID
.
This function takes a dataframe obtained from AirNowTech's
monitoring_site_locations.dat
file, splits it up into separate dataframes,
one for each parameter, and performs the following cleanup:
convert incorrect values to NA
e.g. longitude=0 & latitude=0
add timezone information
Parameters included in AirNow data include at least the following list:
BARPR
BC
CO
NO
NO2
NO2Y
NO2X
NOX
NOOY
OC
OZONE
PM10
PM2.5
PRECIP
RHUM
SO2
SRAD
TEMP
UV-AETH
WD
WS
Setting parameters=NULL
will generate a separate dataframe for each of the above parameters.
airnow_createMetaDataframes( parameters = NULL, pwfslDataIngestSource = "AIRNOW", addGoogleMeta = TRUE )
parameters | vector of names of desired pollutants or NULL for all pollutants |
---|---|
pwfslDataIngestSource | identifier for the source of monitoring data, e.g. |
addGoogleMeta | logicial specifying wheter to use Google elevation and reverse geocoding services |
List of 'meta' dataframes with site metadata for unique parameters (e.g: "PM2.5", "NOX").
if (FALSE) { # Fail gracefully if any resources are not available try({ metaList <- airnow_createMetaDataframes(parameters = "PM2.5") }, silent = FALSE) }