Well, for the moment, more like the start of parsing Air Quality Health Index (AQHI) data.
Air Quality Health Index
The data files are from the Government of Canada open data site open.canada.ca , as part of the MSC (Meteorological Service of Canada) Datamart.
Air Quality Health Index Forecasts - MSC Datamart
For Ontario AQHI, you want to go to
https://dd.weather.gc.ca/air_quality/aqhi/ont/observation/realtime/
You have two options:
There is zero documentation of the file metadata as far as I can tell, so I basically have to guess.
The CSV directory has a single file for every hour, but it's some kind of rolling update, as the file itself contains multiple hours worth of data. Column headings are five-letter station names, with useful names like "FEAKO" and "FEVNT". I don't see any documentation of the mapping between station names and cities. The columns appear to contain an AQHI value, it looks like over 10 they just put 11 as a maximum. Yes, "it goes to 11". (The AQHI scale for display usually runs from 1 to 10+, but you can actually calculate much higher values than 11, it's just a formula.)
The CSV will be the easiest to parse, once you know the station names.
The XML directory contains a file per station per hour, with a single reading in the file. As a bonus, the XML contains both the station name and the city name, so now I can tell you:
Station FEVNT is Ottawa.
With this info you should be able to use either a spreadsheet or e.g. Jupyter Notebook code to read and display the "realtime" (basically delayed by an hour I would guess) AQHI for the city of your choice.
PM2.5 Sort Of
I could only find realtime AQHI, there was nothing I could find on realtime PM2.5
Ontario has realtime PM2.5 on its website, e.g. Ottawa Downtown: Hourly Fine Particulate Matter (PM2.5) Readings - Table format (&showType=table)
You'd have to set it to "table" and then scrape the data I guess.
I did a manual extract, just copy and pasting from the website to Apple Numbers, applying conditional highlighting, and then copy-pasting in turn to a Google Drive spreadsheet.
If you want to see what the PM2.5 looked like from June 4, 2023 to June 9, 2023 for Ottawa, here it is
https://docs.google.com/spreadsheets/d/1pVVjOGhYMeJePwDreAFIUEv-EIE8iJjSpfC5VvKwSYw/edit?usp=sharing
If you dig around, there is downloadable data, but it doesn't include realtime PM2.5
Here's what they have available as open data sets...
Data Sets (Ontario Ministry of Environment)
- Air Quality Alert Statistics: Ontario Smog Events from 2015 to 2023
- Atom News Feeds (XML): Current Air Quality Observations, Forecasts and Alerts
- Historical Air Quality Pollutant Data
You may think Historical Air Quality might get you there, but the latest date the input form will accept is December 2021.
Data Sets (Ontario Open Data)
Ontario does post yearly PM2.5 numbers, at the end of each year, it looks like delayed by a year (e.g. we only have 2021 data that was posted in 2022).
Go to the Ontario open data site data.ontario.ca and search air quality and one of the results is
It looks like it is updated on a yearly basis, not realtime.
So if you're interested in PM2.5 from 2003 to 2021, here you go:
Comments