The https://airnowtech.org site provides both air pollution monitoring data as well as monitoring site location metadata. This function retrieves a single, hourly data file and returns it as a dataframe which includes a monitor's site name and parameters monitored.
airnow_downloadHourlyData( datestamp = strftime(lubridate::now(tzone = "UTC"), "%Y%m%d00", tz = "UTC"), baseUrl = "https://files.airnowtech.org/airnow" )
datestamp | Integer or character representing YYYYMMDDHH. |
---|---|
baseUrl | Base URL for archived hourly data. |
Dataframe of AirNow hourly data.
As of 2016-12-27, it appears that hourly data are available only for 2016 and not for earlier years.
Data from locations whose timezones have a fractional offset from UTC are removed as the PWFSLSmoke data model only supports data reported on hour boundaries. As of 2019-06-26, this only applies to US Department of State monitors in Myanmar, Sri Lanka, India and Nepal.
if (FALSE) { # Fail gracefully if any resources are not available try({ df <- airnow_downloadHourlyData(2018070112) }, silent = FALSE) }