Bengaluru · Jan–Dec 2024 · CPCB and KSPCB daily AQI
The city AQI number is an average of places that have nothing in common.
News apps show one number for all of Bengaluru. On the same day, a traffic junction and a quiet residential road can be 80 AQI points apart, so that single number does not describe either of them.
I collected a year of daily readings from every station I could get a clean export for, worked out six numbers that describe each station's year, and then grouped the stations three different ways to see which ones keep coming out worst.
- 57.1AQI points between the dirtiest and cleanest station, averaged over the year
- 13stations with full 2024 coverage, out of 14 exports I downloaded
- 500worst single reading, at Silk Board. That is the top of the scale
- 2stations that all three grouping methods agreed were the worst
01Every station on the map
These are measured 2024 values. Circle colour is the station's average AQI for the year, and circle size is how much of the year it spent in unhealthy air. Click a station to see all six numbers I used.
Show all 13 stations as a table
| Station | Network | Avg AQI | Worst day | Unhealthy days | Weekly swing | Winter avg | Flagged by |
|---|
02Three ways of grouping the stations
I ran K-Means, hierarchical clustering with Ward linkage, and DBSCAN on the same six features. They give different answers, and the differences are useful, so all three are here with their scores.
| Model | Groups | Left out | Silhouette | Davies–Bouldin | Calinski–Harabasz | Settings |
|---|
Why I went with DBSCAN
DBSCAN has the best silhouette score at 0.475 and the best Davies–Bouldin at 0.597. The bigger reason is how it behaves. K-Means has to put every station into some group, so a station with extreme readings gets pulled into a broad “high” group and stops looking extreme. DBSCAN is allowed to leave a station out of every group, and it left out 8 of them. Those 8 are the ones I care about.
Hierarchical clustering scores better than DBSCAN on Calinski–Harabasz, 13.34 against 7.50. And with 13 stations and 6 features, all of these scores move around a lot. So I would defend the ranking of the stations, and I would not defend the exact number of groups.
03Stations more than one model flagged
The three methods make different assumptions, so a station that shows up in two or three of them is a stronger result than one that shows up in only one.
RVCE-Mailasandra and Silk Board are the only two that all three methods agreed on. Silk Board is the station that hit 500, and it sits on a junction, which is roughly what you would guess before looking at any of this.
04How I actually did it
Most of the time went on cleaning the files. The clustering at the end was quick.
-
Downloading the data
The CPCB portal gives you one Excel file per station, laid out as a wide day-by-month grid. The layout is not the same between stations, so I had to reshape each file into a plain date-and-value list before any two stations could be compared.
-
Dropping one station
I downloaded 14 files and used 13. The Kadabesanahalli export only covers 2023, so including it would have meant comparing one station's 2023 against everyone else's 2024. The file is still in
data/raw/and the notebook drops it. -
Six numbers per station
Average AQI, worst reading, share of days in unhealthy air, how much it swings week to week, winter average, and whether it trended up or down over the year. AQI and a trend slope are on completely different scales, so everything gets standardised before clustering.
-
Running the three methods
K-Means with the elbow method to pick the number of groups, hierarchical with Ward linkage, and DBSCAN with
eps=0.940andmin_samples=2. I scored all three on the same metrics so I was not just picking whichever map looked nicest. -
Writing it up
A ranked list of the worst stations, a map per method, and a combined view. Everything is in
results/and the notebook runs top to bottom.
05Figures from the notebook
Straight out of Air Quality Analysis.ipynb, unedited.
06Where this falls short
- Thirteen stations is a small sample. Cluster scores on 13 points give you a hint, not a conclusion. Treat the station ranking as the result and the group count as a choice I made.
- AQI is already a summary. It squashes PM2.5, PM10, NO₂, SO₂, CO and O₃ into one number, so a station can be dirty in a way this analysis cannot see at all.
- I know nothing about where the sensors sit. A monitor at road level and one on a rooftop are measuring different things, and I had no metadata to correct for it.
- This says where, and nothing about why. Working out what is producing the pollution needs different data and a different study.
- Missing days were filled in, not modelled. The notebook handles gaps in a simple way, so a station that reported less often has noisier numbers than the others.
Have a look at the rest
Data comes from the CPCB CAAQMS portal and KSPCB, both public. Analysis and figures are mine. MIT licensed.