Method & data
How HEATSYNC works, and where it stops.
Problem statement
During a heatwave, district control rooms in Maharashtra must decide — every day, for 36 districts — which areas are worst, which neighbours will be next, where relief can be staged from, and what to tell citizens, farmers and hospitals. The inputs exist but arrive scattered: hourly weather streams, decades of records, IMD’s criteria. HEATSYNC is a response engine that turns them into a ranked, clustered, explained and audience-ready picture in milliseconds, using one classic data structure per step.
Experiment → module
Every lab experiment, mapped.
| Exp | Data structure | Module | Job in the heat response | Key operations |
|---|---|---|---|---|
| 01 | Array of structures | Station Registry | Fixed-capacity registry of the 36 district automated weather stations; insert/delete at the end, linear search by code or name. | insertLast · O(1)deleteLast · O(1)search · O(n)display · O(n) |
| 02 | Singly linked list | Alert Chain | Newest-first chain of heat bulletins; follow-ups are inserted after the bulletin they update. | insertAtBegin · O(1)insertAfter · O(n)deleteBefore · O(n)deleteFirst · O(1) |
| 03 | Stack using SLL and infix to postfix | Rule Compiler | Compiles IMD heatwave criteria written as infix rules into postfix and evaluates them for every district. | push · O(1)pop · O(1)peek · O(1)tokenize · O(n) |
| 04 | Circular queue (counter method) | Sensor Ring | 24-slot ring buffer of hourly station readings giving a rolling 24-hour max without shifting memory. | enqueue · O(1)dequeue · O(1)push (overwrite oldest) · O(1)peek · O(1) |
| 05 | Binary search tree | Hotspot Index | Districts keyed by heat score; reverse in-order gives the live hotspot ranking and range queries find every district in a severity band. | insert · O(h): avg O(log n), worst O(n)search · O(h): avg O(log n), worst O(n)delete · O(h): avg O(log n), worst O(n)min / max · O(h) |
| 06 | Graph BFS (adjacency matrix) | Heat Spread Graph | Districts sharing a border are edges; BFS finds contiguous heatwave clusters, alert rings and the nearest cooler district for relief staging. | build matrix · O(V²)hasEdge · O(1)enqueue / dequeue · O(1)bfs · O(V²) with an adjacency matrix |
| 07 | Sorting and binary search | Climate Archive | Sorts 11 seasons of ERA5 daily maxima so binary search can rank today's heat against history in O(log n). | insertionSort · O(n²) worst, O(n) bestquickSort · O(n log n) avg, O(n²) worstmergeSort · O(n log n)binarySearch · O(log n) |
| 08 | Hash table (linear probing) | Instant Lookup | O(1) lookup of a district by name, former name or HQ PIN code. | insert · O(1) average, O(n) worstsearch · O(1) average, O(n) worstdelete · O(1) average, O(n) worstloadFactor · O(1) |
The C implementations of all eight experiments, adapted to this use case, are in the repository’s c/ folder with their run transcripts.
Heatwave criteria
IMD’s rules, as code.
The rule compiler tokenises each rule, converts it to postfix with a linked stack and evaluates it for every district. A reference classifier written directly in TypeScript checks the compiled rules on every snapshot.
Plains stations
- severe
- tmax >= 47 || (tmax >= 40 && dep >= 6.5)
- heatwave
- tmax >= 45 || (tmax >= 40 && dep >= 4.5)
- watch
- tmax >= 40
Coastal stations (Konkan)
- severe
- tmax >= 37 && dep >= 6.5
- heatwave
- tmax >= 37 && dep >= 4.5
- watch
- tmax >= 37
tmax = daily maximum (°C) · dep = departure from normal (°C). “Watch” is HEATSYNC’s early flag for a hot day that does not yet meet IMD’s heatwave definition.
Open-Meteo historical weather API · CC BY 4.0
ERA5 reanalysis
Daily maximum temperature for all 36 district points, 1 March – 30 June, 2015–2025 (48,312 values); May 2024 daily and hourly fields for the replay.
Open-Meteo forecast API · CC BY 4.0
Open-Meteo forecast
Live mode: 7-day maximum, feels-like, humidity and wind, plus the last 24 hourly readings, fetched in one request and cached for 30 minutes.
geoBoundaries IND ADM1 / ADM2 · ODbL / CC BY
District boundaries
36 Maharashtra districts, simplified with shared borders preserved; 77 border-sharing pairs become the edges of the adjacency matrix.
India Meteorological Department
Heatwave criteria
Plains, coastal and absolute-temperature thresholds, written as rules and compiled by the stack module.
Limitations
What this prototype is not.
- 01
ERA5 is a model reanalysis on a ~25 km grid, sampled at one point per district. It runs a few degrees cooler than station maxima in hot, dry interiors, so fewer days meet the heatwave criteria than IMD station records would show.
- 02
“Normal” is the ERA5 2015–2024 mean for the same calendar window (±7 days), a documented stand-in for IMD’s 30-year station normals. Outside March–June no normal is defined and only absolute thresholds apply.
- 03
Live mode uses numerical forecast guidance, not observations. HEATSYNC never presents either as an official warning.
- 04
IoT weather stations (the use case’s Phase III) are represented by the sensor-ring module fed with reanalysis or forecast hourly data; physical stations would plug into the same ring buffer.
- 05
Advisories come from a deterministic template engine following national heat-action guidance. They are drafts until a person approves them.