Air QualityAir in Beijing is bad. Very bad. How bad? Well, it is hard to say. There are lots of places that provide pollution level information, but none seem make historical information available, so it is hard to compare now with before, except anecdotally. So, I decided to do it. I wrote a cron job that runs on my server that stores the hourly aqi information in a database, and a program to display the data graphically. It also makes the current level available so I can display it on my desktop, and it emails me if the level gets too high. I wrote this and started collecting data January 24, 2013, but recently found stateair.net, which has data from as far back as 2008, so I added that data as well (their source is also the US Embassy readings, so the data is consistent) The code is available if anyone wants it: the main display page and the fetcher (to be run regularly as a cron jon). (the files must be renamed to .php to be used). (NOTE: this is not good code, it was written before I really understood how to use php. Don't judge me on it, please) |
Custom ChartsAdded as of early 2016: generate charts based on the US Embassy AQI. After spending days with emacs and libreoffice generating charts and statistics for all records, all cities, I realized it would be quicker and more useful to generate the charts online. After finding Google charts I spent a day writing up the PHP and Javascript to get the same charts for custom intervals. (and then a second day redoing the code nicer). The code is here: PHP code and Javascript. |