Python code to read in AQS data from the EPA API (https://aqs.epa.gov/aqsweb/documents/data_api.html)
Before Using you need a login and key
1. Get a login and key
https://aqs.epa.gov/data/api/signup?email=myemail@example.com
a.) Update myemail@example.com to your email
b.) Past updated link in address bar of your browser
2. Update user_info.py with:
- login
- key
- preferred directory to save files
3. Make a input.py file (or update an example file) for the data you would like to retrieve
Info needed:
- param
- bdate (starting date in YYYYMMDD)
- edate (ending date in YYYYMMDD)
- state code
4. Run input.py
| State Name | State Code |
|---|---|
| Alabama | 01 |
| Alaska | 02 |
| Arizona | 04 |
| Arkansas | 05 |
| California | 06 |
| Colorado | 08 |
| Connecticut | 09 |
| Delaware | 10 |
| District Of Columbia | 11 |
| Florida | 12 |
| Georgia | 13 |
| Hawaii | 15 |
| Idaho | 16 |
| Illinois | 17 |
| Indiana | 18 |
| Iowa | 19 |
| Kansas | 20 |
| Kentucky | 21 |
| Louisiana | 22 |
| Maine | 23 |
| Maryland | 24 |
| Massachusetts | 25 |
| Michigan | 26 |
| Minnesota | 27 |
| Mississippi | 28 |
| Missouri | 29 |
| Montana | 30 |
| Nebraska | 31 |
| Nevada | 32 |
| New Hampshire | 33 |
| New Jersey | 34 |
| New Mexico | 35 |
| New York | 36 |
| North Carolina | 37 |
| North Dakota | 38 |
| Ohio | 39 |
| Oklahoma | 40 |
| Oregon | 41 |
| Pennsylvania | 42 |
| Rhode Island | 44 |
| South Carolina | 45 |
| South Dakota | 46 |
| Tennessee | 47 |
| Texas | 48 |
| Utah | 49 |
| Vermont | 50 |
| Virginia | 51 |
| Washington | 53 |
| West Virginia | 54 |
| Wisconsin | 55 |
| Wyoming | 56 |
| Guam | 66 |
| Puerto Rico | 72 |
| Virgin Islands | 78 |
| Country Of Mexico | 80 |
| Canada | CC |
| Parameter Name | Parameter Code |
|---|---|
| Carbon monoxide | 42101 |
| Lead (TSP) LC | 14129 |
| Lead PM10 LC FRM/FEM | 85129 |
| Nitrogen dioxide (NO2) | 42602 |
| Ozone | 44201 |
| PM10 Total 0-10um STP | 81102 |
| PM2.5 - Local Conditions | 88101 |
| Sulfur dioxide | 42401 |