Downloading Historical PurpleAir Sensor Data
You can download historical sensor data from the
PurpleAir Map.
The data does not include the sensor name or coordinates in the data.
See the
Using PurpleAir data
document provided by PurpleAir for more information on various other ways to get sensor data.
There is a link to pre-compiled data
on the main page which may be a better option for you.
- From the map
zoom and pan the screen so the sensors you are interested in are visible.
- At the bottom right of the screen click the "download data" icon.
- Choose start and end dates at the top of the PurpleAir page. I find it is best to limit the range to a few months, otherwise it may be slow.
- Click the download Primary or download Secondary button next to the sensor you want to download.
- Although there is an option to check multiple sensors and choose the download selected option
I find that sometimes this causes the page to hang.
- Save the file to a location on your computer.
- The file will be stored as as a csv file which may be opened in Excel, Google Sheets or other spreadsheet or database applications.
- The downloaded files may be copied and pasted into a single file.
- You may want to add columns for the sensor name, latitude and longitude coordinates.
- The sensor names and latitude / longitude coordinates are in the file name.
- You may also want to strip the "UTC" text from the end of the timestamp to make it a true datetime stamp and not a string.
- In a new column the Excel formula "=LEFT([datecell], LEN([datecell]) -4)" can be used to strip the UTC text from the end of the timestamp.
You may now analyze the data any number of ways in your spreadsheet program.
I have written a Python Program
that facilitates working with the downloaded data. The script has the following features.
- Combines the seperate sensor files into a single file.
- Automatically adds the sensor names and geograhic coordinates to the data.
- Calculates the PM2.5 Air Quality Index (AQI).
- Can add data downloaded from regulatory sites.
- Can add wind data downloaded from DarkSky.
- Summarizes the data by averaging values over longer timeframes which significantly reduces the size of the files.
- Has various output options, including the EPA RETIGO format which may be uploaded to RETIGO for further analysis.