sensortoolkit.reference._ref_api_query
This module contains methods for querying reference data APIs, including the AirNow and Air Quality System (AQS) API services.
These services are operated by the U.S. EPA, and users should have previously registered with either service before submitting queries (authentication tokens are required for each service to validate query requests).
Resources
AQS API documentation: https://aqs.epa.gov/aqsweb/documents/data_api.html
Note
Information about registering an account with the AQS API can be found under the ‘Sign Up’ section.
AirNow API documentation: https://docs.airnowapi.org/
Note
Information about registering an account with the AirNow API can be found at the following link (https://docs.airnowapi.org/account/request/)
- @Author:
- Samuel Frederick, NSSC Contractor (ORAU)U.S. EPA / ORD / CEMM / AMCD / SFSB
- Created:
Mon May 3 12:56:38 2021
- Last Updated:
Wed Jul 14 14:27:21 2021
Functions
Generate two arrays (month_starts and month_ends) for which queries will be constructed in consecutive monthly segments. |
|
Convert AirNow query data to SDFS formatted datasets. |
|
Convert AQS query data to SDFS formatted datasets. |
|
Modify the data type of columns in reference data and reorder columns. |
|
Subroutine for Ref_API_Query tha replaces various characters in data columns containing text, including the method name and the parameter units. |
|
Helper function for ingesting AQS |
|
Construct an AirNow API query request and parse response. |
|
Construct an AQS API query request and parse response. |
|
Generate a dictionary with consecutive monthly intervals to query where dates are formatted a little differently depending on the API to query. |
|
Wrapper function for sending an API data query to either the AQS or AirNow API for a specified parameter ( |
|
Save processed datasets at regular monthly intervals. |
|
Ask the user for a single POC if multiple codes present in dataset. |