Lesson 3 · 11:30–12:30
Who is at risk?
A hot surface is a risk where people are packed in without shade:
risk = surface temperature × crowding × lack of shade.
Two maps from space, one headcount
Surface temperature and tree cover come from satellites on the same 30 m squares (lessons 1 and 2). People come from the Census 2011 headcount of each ward, carried in the GBA ward file: the latest official count, as India's next census counts people in February 2027. The ward map with every headcount is on OpenCity (KML: opens in QGIS or Google Earth). Download them:day_surface_temp = datapack.layer("lst_day") # °C, Landsat at 10:40 am (lesson 1)
night_surface_temp = datapack.layer("lst_night") # °C, MODIS at night (lesson 1)
trees = datapack.layer("canopy_frac") # 0-1 tree cover, Meta/WRI tree heights (lesson 2)
wards = load_wards() # the 369 GBA wards, with their Census 2011 headcount
wards[["label", "census2011_pop", "area_km2"]].head() # area in km²
| label | census2011_pop | area_km2 |
|---|---|---|
| Central 1 · Ramaswamy Palya | 26,124 | 0.7 |
| Central 2 · Jayamahal | 25,834 | 1.423 |
| Central 3 · Vasanth Nagar | 28,272 | 1.946 |
| Central 4 · Sampangirama Nagar | 27,874 | 4.676 |
| Central 5 · Shivajinagar | 25,484 | 1.163 |
One row per ward
Average each map inside every ward withzonal_stats (lesson 1), and divide each ward's headcount by its area
(1 km² = 100 hectares):labels = ward_labels(wards, datapack.grid30()) # each square -> its ward
f = zonal_stats({
"day_surface_temp": day_surface_temp,
"night_surface_temp": night_surface_temp,
"trees": trees,
}, labels).rename(columns=lambda c: c.removesuffix("_mean"))
w = wards.set_index("ward_uid")
f.insert(0, "ward", w["label"])
f["people_per_ha"] = w["census2011_pop"] / (w["area_km2"] * 100) # Census 2011 people ÷ hectares
f["surface_temp"] = (f.day_surface_temp + f.night_surface_temp) / 2 # one surface temperature: morning and night
f = f.round({"day_surface_temp": 2, "night_surface_temp": 2, "surface_temp": 2, "trees": 3, "people_per_ha": 0})
f.head()
| ward | day_surface_temp | night_surface_temp | trees | people_per_ha | surface_temp |
|---|---|---|---|---|---|
| Central 1 · Ramaswamy Palya | 38.48 | 24.13 | 0.213 | 373 | 31.3 |
| Central 2 · Jayamahal | 37.66 | 24.07 | 0.32 | 182 | 30.86 |
| Central 3 · Vasanth Nagar | 37.15 | 24.12 | 0.27 | 145 | 30.64 |
| Central 4 · Sampangirama Nagar | 36.7 | 24.45 | 0.402 | 60 | 30.57 |
| Central 5 · Shivajinagar | 39.47 | 24.15 | 0.185 | 219 | 31.81 |
From three numbers to one score
The three numbers are in different units, so we rescale each from 0 for the city's lowest ward to 1 for its highest: surface temperature from 29.20 °C (0) to 33.33 °C (1), people from 12 (0) to 1,337 per hectare (1), and lack of shade from 55.5 % tree cover (0) to 1.0 % (1). Multiplying the three gives a high score only to a ward that is hot, packed and treeless at once: the top 30 % of scores are High risk, the next 30 % Medium and the rest Low. The score compares wards with each other, so it says where to act first.def scale(x): # 0 = the city's lowest ward, 1 = its highest
return (x - x.min()) / (x.max() - x.min())
hot = scale(f.surface_temp)
crowded = scale(f.people_per_ha)
no_shade = scale(-f.trees) # 1 = the ward with the fewest trees
risk = hot * crowded * no_shade # high only if all three are high
Central 52 · Padarayanapura: 33.05 °C surface temperature → (33.05 − 29.20) ÷
(33.33 − 29.20) = 0.932; 1,113 people per hectare →
0.831; 2.7% tree cover → 0.969. Score: 0.932 × 0.831 ×
0.969 = 0.750, the city's highest.
Your weights
How much should each count? Each slider is a power: 1 counts it once, 2 counts it twice, 0 leaves it out. The top 30 % of wards are High risk.Try it
- Set People to 0.
- Set Lack of shade to 3.
- A plain average instead of multiplying:
plain = (hot + crowded + no_shade) / 3 # a plain average instead of multiplying
compare = f[["ward"]].assign(multiplied=risk.rank(ascending=False), plain=plain.rank(ascending=False))
compare.assign(moved=compare.multiplied - compare.plain).nlargest(10, "moved")
| ward | multiplied | plain | moved | |
|---|---|---|---|---|
| ward_uid | ||||
| 225 | South 40 · Anjanapura | 355 | 191 | 164 |
| 162 | East 27 · Vibhootipura | 315 | 155 | 160 |
| 141 | East 6 · Kalkere | 296 | 150 | 146 |
| 273 | West 16 · Ullal | 305 | 162 | 143 |
| 269 | West 12 · Andrahalli | 288 | 157 | 131 |
| 219 | South 34 · Chikkathoguru | 329 | 209 | 120 |
| 270 | West 13 · Nada prabhu Kempegowda Nagara | 268 | 159 | 109 |
| 237 | South 52 · Talagattapura | 366 | 261 | 105 |
| 220 | South 35 · Vishwapriya Nagara | 238 | 134 | 104 |
| 82 | North 19 · Thanisandra | 207 | 106 | 101 |
moved = how many places a ward climbs when the three are averaged instead of multiplied. A risk map shows where to look first; check it on the ground.
Next → 4 · When should we warn?