DFS Method

Detecting heatwave events in space and time

Depth-First Search converts daily high-temperature exceedances into reproducible three-dimensional event objects. This page separates the method into three operations: define active heat, connect adjacent space-time cells, and calculate event characteristics.

Method at a glance

Temperature field to event catalog

  1. 01ThresholdMark heatwave-active grid cells
  2. 02ConnectTraverse adjacent cells with DFS
  3. 03LabelAssign one event identity
  4. 04MeasureCalculate duration, area, and magnitude
01

Input and heat signal

Define where and when heat is active

DFS does not decide whether a temperature is extreme. It begins from a prepared active-cell mask. For the current ERA5 heatwave workflow, the mask is derived from daily maximum temperature and a calendar-day threshold, while daily magnitude \(M_d\) describes the strength of the heat signal at each active cell.

Detection threshold

Calendar-day P90

The current website description uses a centered 31-day sample around calendar day \(d\) across the 1981-2010 reference years.

\[ A_d(x,y)=\bigcup_{r=1981}^{2010}\ \bigcup_{i=d-15}^{d+15} T_{max}(x,y,r,i) \] \[ Q_{90}(x,y,d)=P_{90}\left(A_d(x,y)\right) \]
Active-cell rule

Threshold exceedance

A grid cell becomes a candidate heatwave voxel when daily maximum temperature exceeds the applicable threshold.

\[ I(x,y,t)=\mathbf{1}\left[T_{max}(x,y,t)>Q_{90}(x,y,d(t))\right] \]
Detection and magnitude use different reference quantities

P90 determines whether a cell enters the event mask. The legacy HWMId formulation uses reference \(T_{25p}\) and \(T_{75p}\) values to standardize daily magnitude. They should not be read as interchangeable thresholds.

02

DFS connectivity

Group adjacent heat into one event object

Each active cell is a voxel in \((t, y, x)\) space. DFS starts from one unlabelled voxel, follows every valid neighbour until no new neighbour remains, and assigns all visited voxels to the same event. It then repeats from the next unlabelled active voxel.

Conceptual DFS sequence: detect active magnitude points, connect neighbours in space and time, then reconstruct the event as daily cross-sections. The diagram explains topology and is not a map of a specific archived event.
Stage 1 Detect active voxels

Cells with a valid positive heatwave magnitude enter the candidate mask.

Stage 2 Traverse neighbours

Spatially and temporally adjacent active voxels receive the same event label.

Stage 3 Recover the event object

Daily horizontal slices reveal the complete footprint and lifetime of the event.

Dimensionstime, latitude, longitude

A three-dimensional connected-component problem.

Spatial rule8-neighbour adjacency

All surrounding cells in the horizontal grid are considered.

Temporal rulet - 1, t, t + 1

Connectivity is evaluated across adjacent daily slices.

BoundariesPeriodic longitude

The global grid wraps across the date-line; latitude boundaries remain closed.

Duration gateAt least 3 days

Shorter connected signals are excluded from the heatwave event catalog.

ReproducibilityDeterministic relabelling

Labels are ordered consistently after connected components are formed.

03

Metric calculation

Turn the event object into heatwave characteristics

Once event membership is fixed, the event can be summarized without losing its three physical dimensions. Let \(E\) be the connected event, \(G_t\) its active grid cells on day \(t\), and \(a_g\) the area of grid cell \(g\).

TimeHWDevent days
SpaceHWMAmean affected area
MagnitudeHWMMmean magnitude per unit
Event scaleHWMScumulative heat load
HWD

Heatwave duration

\[HWD=edT-stT+1\]

Elapsed event time from the first to the final detected day, inclusive.

HWV and HWMA

Affected space through time

\[A_t=\sum_{g\in G_t}a_g,\qquad HWV=\sum_{t\in E}A_t\] \[HWMA=\frac{HWV}{HWD}\]

HWV accumulates daily affected area; HWMA is the mean daily footprint.

HWMS and HWMM

Magnitude across the event object

\[HWMS=\sum_{(g,t)\in E}M_d(g,t)\,a_g\] \[HWMM=\frac{HWMS}{HWV}\]

HWMS is cumulative area-weighted event magnitude; HWMM is mean magnitude per unit event volume.

Identity

The three characteristics combine directly

\[\boxed{HWMS=HWD\times HWMA\times HWMM}\]

This identity is why HWD, HWMA, and HWMM explain HWMS but should not be added to HPRI as separate hidden weights.

FieldCalculation or roleScientific reading
maxHWA\(\max_t(A_t)\)Maximum daily affected area reached by the event.
HWMDHWV / maxHWADerived catalog measure retained for legacy output parity.
sumofMdLegacy magnitude accumulation fieldPreserved in the source schema; use only with its production provenance.
AREAClimate-region codeThe catalog can report one connected event by intersected region.
tol_j, tol_iRepresentative event coordinatesUseful for search; event boundary layers are preferred for exact spatial overlap.
stT, edTStart and end day indexSupport timing, duration, and historical-day queries.
04

Reading the characteristics

Different values describe different event structures

HWDPersistence

A larger value means the connected event lasts longer.

HWMAFootprint

A larger value means the event covers a broader mean daily area.

HWMMMean magnitude

A larger value means stronger average magnitude across the event volume.

HWMSIntegrated scale

A larger value can result from longer duration, wider area, stronger magnitude, or their combination.

Event characteristics are not interchangeable

Two events can have similar HWMS but very different structures. One may be brief and spatially extensive; another may be compact but persistent and intense. Read HWMS together with HWD, HWMA, and HWMM before interpreting the event.

05

Output and provenance

What the website publishes from DFS

ProductCurrent website sourceUse
Event catalogHeatwave/data/list_data.jsonEvent metrics used across Home, Data, Insights, Charts, and Risk.
Search sourceevent_data/ERA5_mxt2m_Heatwave_h1t05v4_20260129.csvSpatial and calendar-date event search with the full legacy field set.
Event boundariesboundary_data/ETid_<year>_boundaries.geojsonFootprint inspection and future asset-overlap analysis.
Validated coverage1940-2025; 15,634 recordsCurrent local website validation status; revalidate after any archive refresh.

The website preserves the event fields Year, Nu, AREA, HWV, HWMA, maxHWA, HWMD, HWMS, HWMM, sumofMd, tol_j, tol_i, stT, edT, and HWD. HPRI is added later as an interpretation layer.

06

Method boundaries

What must remain explicit

Threshold provenance

The archive follows the legacy h1t05v4 heatwave signal. Exact source files, leap-day treatment, calendar handling, and production rounding must accompany a reproducible release.

Connectivity is a method choice

The current contract uses 8-neighbour spatial adjacency, adjacent time slices, periodic longitude, and a minimum three-day event. Other variables require their own signal and connectivity contract.

Event scale is not impact

DFS describes physical event structure. Health, crop, power, water, labor, and financial effects require independent exposure and vulnerability evidence.

Official warning products are separate

This event archive supports research and retrospective screening. It is not a substitute for operational high-temperature warnings.

Next method

From event characteristics to comparable hazard ranking