Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

What has to happen between detector counts and a heatwave warning?

GeoStack · background · L0 → L5

Abstract

Earth-observation data are sorted into levels, from raw instrument output to finished indicators. This page is about the arrows between the levels: what each transition does to the data, what kind of operator performs it, and what software that operator needs underneath. One variable, sea surface temperature, is simulated from counts to heatwave events and scored against a known truth at every level.

The levels

L0Unstructured observationsraw instrument output

SST exampledetector counts, 2 channels

read + calibrateunits change: counts →\to physics

L1Structured observationscalibrated, located

SST examplebrightness temperature, with positions

retrievemeaning changes: what was seen →\to what is there

L2Retrieved observationsa geophysical variable per pixel, with gaps

SST exampleSST on the swath, cloud-masked

grid + gap-fillgeometry and completeness change

the carrier changes here: swath →\to cube

L3Analysisa regular, gap-filled grid

SST exampledaily SST map with its variance

model + assimilatetime is connected: dynamics enter

L4Reanalysis and forecasta model constrained by data

SST exampleSST carried by the flow, day after day

derivea question is answered

L5Derived productsindicators, extremes, impacts

SST examplemarine heatwave events

Six levels and five transitions. Blue levels are observations in the sensor’s own geometry; green are fields on a regular grid; orange is whatever answers the question. Each arrow changes one thing about the data, named beside it.

The names and numbers are those of the stack’s overview. They follow the agencies’ convention up to L2 and differ above it, so check which scheme a product uses before comparing labels.

Table 1:The levels on this page against two agency conventions.

This page (GeoStack overview)NASA / CEOS conventionGHRSST, for sea surface temperature
L0raw instrument outputraw data at full resolution—
L1calibrated and locatedL1A: annotated with calibration; L1B: calibrated to sensor units—
L2geophysical variable per pixel, gaps where retrieval failsgeophysical variables at the L1 resolution and locationL2P: SST on the swath with per-pixel error statistics
L3regular grid, gap-filledvariables on a uniform space-time grid; gaps may remainL3U, L3C, L3S: gridded, gaps remain
L4dynamical model constrained by data: reanalysis, forecastmodel output, or analyses of lower-level dataL4: gap-free analysis
L5indicators, extremes, impactsnot defined—

So a product called “L4” by GHRSST, a gap-free SST analysis, is L3 on this page; L4 here means a dynamical model is involved. The middle and right columns are from the agencies’ definitions as I know them.

The running example

Truth: what the ocean did; black line: true heatwave

Truth · what the ocean did; black line: true heatwave

L2 swath: clear pixels only; white: cloud. 0.19 K

L2 · swath · clear pixels only; white: cloud. Right to 0.19 K0.19\ \mathrm{K}

L3 binned: swath averaged into cells; 31% filled

L3 · binned · swath averaged into cells; 31% filled

L3 gap-filled: every cell, from this day alone. 0.47 K

L3 · gap-filled · every cell, from this day alone. Right to 0.47 K0.47\ \mathrm{K}

L4 assimilated: every cell, with earlier days carried in. 0.27 K

L4 · assimilated · every cell, with earlier days carried in. Right to 0.27 K0.27\ \mathrm{K}

L5 heatwave: black line: heatwave found from L4

L5 · heatwave · black line: heatwave found from L4

Day 32 at every level, as the difference from climatology: blue is 2.5 K2.5\ \mathrm{K} colder, red 2.5 K2.5\ \mathrm{K} warmer. The domain is 1 600 km1\ 600\ \mathrm{km} across.

Part 1 · Every transition is an operator

Each transition below is written as an operator. The rows of its table sort what it needs: the input is the data from the level below; an external input is information from outside, given per scene; a parameter was fitted or tuned and then held fixed; a constant is known physics and geometry; the state is the operator’s own output from the last call; an estimated quantity is computed inside the call; the output is the next level. Each symbol in the equations takes the colour of its role. Indices: nn a swath pixel, jj a channel, ii a grid cell, tt a day. Shapes name the grid axes row and col, so that xx and yy keep their roles as the state and the observation. A map of the 64 × 64 grid is a vector over the cells ii in the equations, of shape (cell,), and is stored as (row, col). The data-assimilation symbols are the standard ones: μx\gvect{\mu}_x and Σx\gmat{\Sigma}_x for the background mean and covariance, Σε\gmat{\Sigma}_\varepsilon for the observation error, t∣t−1t \mid t-1 for a forecast and t∣tt \mid t for an analysis (papers write xb\vect{x}_b, B\mat{B}, R\mat{R}, xf\vect{x}^f and xa\vect{x}^a).

L1 · Read and calibrate

Turn the detector’s counts into physical units and put each pixel on the ground. A linear calibration gives radiance, the inverse Planck function gives brightness temperature, and the orbit and attitude locate the pixel.

Ln,j=θgain,jDNn,j+θoff,j\rEst{L_{n,j}} = \rPar{\theta_{\text{gain},j}} \rIn{\mathrm{DN}_{n,j}} + \rPar{\theta_{\text{off},j}}
Tn,j=c2λjln⁡(1+c1/(λj5Ln,j))\rOut{T_{n,j}} = \frac{\rCon{c_2}}{\rCon{\lambda_j} \ln(1 + \rCon{c_1} / (\rCon{\lambda_j}^5 \rEst{L_{n,j}}))}
sn=s0(t)+ΔsR(φ)an\rOut{\vect{s}_n} = \rExt{\vect{s}_0(t)} + \rCon{\Delta s} \mat{R}(\rExt{\varphi}) \vect{a}_n

where R(φ)\mat{R}(\varphi), of shape (2, 2), rotates by the attitude angle and an\vect{a}_n, of shape (2,), is the (line, pixel) position of pixel nn in the swath. The other symbols are in the table.

RoleSymbolNameShapeUnitNote
InputDN\rIn{\mathrm{DN}}digital numbers(day, channel, line, pixel)counts
External inputs0(t)\rExt{\vect{s}_0(t)}satellite position(day, 2)km
φ\rExt{\varphi}attitude angle()rad
Parameterθgain\rPar{\gvect{\theta}_\text{gain}}calibration gain(channel,)[L] count⁻¹
θoff\rPar{\gvect{\theta}_\text{off}}calibration offset(channel,)[L]
Constantc1\rCon{c_1}first radiation constant()W m⁻² sr⁻¹ µm⁴
c2\rCon{c_2}second radiation constant()µm K
λc\rCon{\lambda_c}channel wavelength(channel,)µm
Δs\rCon{\Delta s}pixel spacing()km
EstimatedL\rEst{L}radiance(day, channel, line, pixel)[L](1)
OutputT\rOut{T}brightness temperature(day, channel, line, pixel)K(2)
s\rOut{\vect{s}}pixel location(day, line, pixel, 2)km(3)

L2 · Retrieve

Mask the clouds, then remove the atmosphere. A pixel warmer than TcloudT_\text{cloud} in channel 1 counts as clear, and a split-window regression on the two channels turns each clear pixel into SST.

mn=1[Tn,1>Tcloud]\rOut{m_n} = \mathbf{1}[\rIn{T_{n,1}} > \rPar{T_\text{cloud}}]
yn=θ0+θ1Tn,1+θ2(Tn,1−Tn,2)\rOut{y_n} = \rPar{\theta_0} + \rPar{\theta_1} \rIn{T_{n,1}} + \rPar{\theta_2} (\rIn{T_{n,1}} - \rIn{T_{n,2}})

where 1[⋅]\mathbf{1}[\cdot] is 1 when its argument holds and 0 otherwise. The retrieved SST is written yny_n because every level above treats it as an observation.

RoleSymbolNameShapeUnitNote
InputT\rIn{T}brightness temperature(day, channel, line, pixel)K
External inputnone—full-physics retrievals take weather fields here
Parameterθ0\rPar{\theta_0}retrieval intercept()Kfitted on matchups
θ1\rPar{\theta_1}retrieval slope()—fitted on matchups
θ2\rPar{\theta_2}split-window coefficient()—fitted on matchups
Tcloud\rPar{T_\text{cloud}}cloud threshold()Ktuned
Outputm\rOut{m}clear-sky mask(day, line, pixel)bool(4)
y\rOut{y}sea surface temperature(day, line, pixel)K(5), where mn=1m_n = 1

L3 · Grid and gap-fill

Average the clear pixels into grid cells, then fill the cells nothing saw. Optimal interpolation blends the cell averages with climatology through the background covariance Σx\gmat{\Sigma}_x and returns a variance for every cell.

yˉi=1∣Ni∣∑n∈Niyn\rEst{\bar{y}_i} = \frac{1}{\vert \rCon{\mathcal{N}_i} \vert} \sum_{n \in \rCon{\mathcal{N}_i}} \rIn{y_n}
x^=μx+ΣxH⊤(HΣxH⊤+Σε)−1(yˉ−Hμx)\rOut{\hat{\vect{x}}} = \rCon{\gvect{\mu}_x} + \rPar{\gmat{\Sigma}_x} \rEst{\mat{H}}^\top (\rEst{\mat{H}} \rPar{\gmat{\Sigma}_x} \rEst{\mat{H}}^\top + \rPar{\gmat{\Sigma}_\varepsilon})^{-1} (\rEst{\bar{\vect{y}}} - \rEst{\mat{H}} \rCon{\gvect{\mu}_x})
v^=diag(Σx−ΣxH⊤(HΣxH⊤+Σε)−1HΣx)\rOut{\hat{\vect{v}}} = \mathrm{diag}(\rPar{\gmat{\Sigma}_x} - \rPar{\gmat{\Sigma}_x} \rEst{\mat{H}}^\top (\rEst{\mat{H}} \rPar{\gmat{\Sigma}_x} \rEst{\mat{H}}^\top + \rPar{\gmat{\Sigma}_\varepsilon})^{-1} \rEst{\mat{H}} \rPar{\gmat{\Sigma}_x})

where yˉ\bar{\vect{y}} stacks the MM observed cell averages yˉi\bar{y}_i, so H\mat{H} picks those MM cells out of all NN, and diag\mathrm{diag} keeps the diagonal.

RoleSymbolNameShapeUnitNote
Inputy\rIn{y}pixel SST(line, pixel)Kone day
s\rIn{\vect{s}}pixel location(line, pixel, 2)kmone day
ParameterΣx\rPar{\gmat{\Sigma}_x}background error covariance(cell, cell)K²length 150 km, std 0.8 K
Σε\rPar{\gmat{\Sigma}_\varepsilon}observation error covariance(obs, obs)K²diagonal, from the L2 error
Constantμx\rCon{\gvect{\mu}_x}background(cell,)K
Ni\rCon{\mathcal{N}_i}pixels in cell ii——the grid definition
Estimatedyˉ\rEst{\bar{\vect{y}}}cell averages(obs,)K(6)
H\rEst{\mat{H}}observation operator(obs, cell)—which cells were seen
Outputx^\rOut{\hat{\vect{x}}}analysis(day, row, col)K(7)
v^\rOut{\hat{\vect{v}}}analysis variance(day, row, col)K²(8)

L4 · Model and assimilate

Carry yesterday’s analysis forward and correct it with today’s map. A damped advection model makes the forecast, and a gain in each cell weighs it against the L3 map by their variances.

xt∣t−1=μx+ρF(xt−1∣t−1−μx)\rEst{\vect{x}_{t \mid t-1}} = \rCon{\gvect{\mu}_x} + \rPar{\rho} \rCon{\mat{F}} (\rSta{\vect{x}_{t-1 \mid t-1}} - \rCon{\gvect{\mu}_x})
pt∣t−1=ρ2Fpt−1∣t−1+(1−ρ2)σ2\rEst{\vect{p}_{t \mid t-1}} = \rPar{\rho}^2 \rCon{\mat{F}} \rSta{\vect{p}_{t-1 \mid t-1}} + (1 - \rPar{\rho}^2) \rPar{\sigma}^2
gt=pt∣t−1⊘(pt∣t−1+v^t)\rEst{\vect{g}_t} = \rEst{\vect{p}_{t \mid t-1}} \oslash (\rEst{\vect{p}_{t \mid t-1}} + \rIn{\hat{\vect{v}}_t})
xt∣t=xt∣t−1+gt⊙(x^t−xt∣t−1)\rOut{\vect{x}_{t \mid t}} = \rEst{\vect{x}_{t \mid t-1}} + \rEst{\vect{g}_t} \odot (\rIn{\hat{\vect{x}}_t} - \rEst{\vect{x}_{t \mid t-1}})
pt∣t=(1−gt)⊙pt∣t−1\rOut{\vect{p}_{t \mid t}} = (1 - \rEst{\vect{g}_t}) \odot \rEst{\vect{p}_{t \mid t-1}}

where ⊙\odot and ⊘\oslash multiply and divide cell by cell. Applying F\mat{F} to the variance pt−1∣t−1\vect{p}_{t-1 \mid t-1} is exact here only because F\mat{F} is a permutation (it moves each cell one step east); a general model would need diag(FΣx,t−1∣t−1F⊤)\mathrm{diag}(\mat{F} \gmat{\Sigma}_{x,t-1 \mid t-1} \mat{F}^\top) with the full covariance.

RoleSymbolNameShapeUnitNote
Inputx^t\rIn{\hat{\vect{x}}_t}today’s L3 map(row, col)K
v^t\rIn{\hat{\vect{v}}_t}today’s L3 variance(row, col)K²
Statext−1∣t−1\rSta{\vect{x}_{t-1 \mid t-1}}yesterday’s analysis(row, col)K
pt−1∣t−1\rSta{\vect{p}_{t-1 \mid t-1}}its variance(row, col)K²
Parameterρ\rPar{\rho}day-to-day persistence()—
σ\rPar{\sigma}anomaly spread()K
ConstantF\rCon{\mat{F}}advection operator(cell, cell)—moves the field by one cell
μx\rCon{\gvect{\mu}_x}climatology(cell,)Kused as the background
Estimatedxt∣t−1\rEst{\vect{x}_{t \mid t-1}}forecast(row, col)K(9)
pt∣t−1\rEst{\vect{p}_{t \mid t-1}}forecast variance(row, col)K²(10)
gt\rEst{\vect{g}_t}gain(row, col)—(11)
Outputxt∣t\rOut{\vect{x}_{t \mid t}}analysis(day, row, col)K(12)
pt∣t\rOut{\vect{p}_{t \mid t}}analysis variance(day, row, col)K²(13)

L5 · Derive

Compare each day with a long baseline and keep what lasts. A cell is hot when it is above its 90th percentile, it is in a heatwave when that holds for at least DminD_\text{min} days, and connected hot regions become events.

ht,i=1[xt∣t,i>qi]\rEst{h_{t,i}} = \mathbf{1}[\rIn{x_{t \mid t, i}} > \rCon{q_i}]
wt,i=ht,i⋅1[run of h through t lasts≥Dmin]\rOut{w_{t,i}} = \rEst{h_{t,i}} \cdot \mathbf{1}[\text{run of } \rEst{h} \text{ through } t \text{ lasts} \ge \rPar{D_\text{min}}]
E=connected regions of w in (t,row,col)\rOut{\mathcal{E}} = \text{connected regions of } \rOut{w} \text{ in } (t, \text{row}, \text{col})

where a run is a stretch of consecutive days on which ht,i=1h_{t,i} = 1 in the same cell, and two cell-days are connected when they share a face in (day, row, col).

RoleSymbolNameShapeUnitNote
Inputxa\rIn{\vect{x}_a}L4 analysis(day, row, col)K
ParameterDmin\rPar{D_\text{min}}minimum duration()days5, by convention
Constantq\rCon{\vect{q}}heatwave threshold(row, col)K90th percentile of a long baseline
Estimatedh\rEst{h}hot-cell indicator(day, row, col)bool(14)
Outputw\rOut{w}heatwave indicator(day, row, col)bool(15)
E\rOut{\mathcal{E}}heatwave events(event, 5)days, K, km²(16): a table

L0 → L1 · read and calibrate: undo the instrument

The detector reports integers. Calibration turns them into a physical radiance with a gain and an offset per channel, and geolocation works out where each pixel was looking from where the satellite was and how it was pointed. No science choice is made here; the operator is fixed by the instrument.

def calibrate(counts, calibration):
    """L0 → L1: counts to brightness temperature, per channel."""
    # L = g · DN + o
    radiance = einx.add(                                        # (D, C, S, P) → (D, C, S, P)
        "d c s p, c -> d c s p",
        einx.multiply("d c s p, c -> d c s p", counts.astype(np.float64), calibration.gain),
        calibration.offset,
    )
    # T_b = c₂ / (λ ln(1 + c₁ / (λ⁵ L)))
    wavelength = einx.rearrange("c -> 1 c 1 1", WAVELENGTH_UM)
    brightness = inverse_planck(radiance, wavelength)           # (D, C, S, P) K
    return brightness

Program 1:Calibration and the inverse Planck function, from the example’s notebook.

L1 → L2 · retrieve: from what was seen to what is there

The sensor saw the sea through an atmosphere that absorbed part of the signal: the 11 µm brightness temperature is 1.46 K away from the true SST. Water vapour absorbs more at 12 µm than at 11 µm, so the difference between the two channels measures the atmosphere, and a three-coefficient formula removes it. The coefficients are fitted, on pixels matched to buoys; the fit gives 1.63 for the channel-difference weight where the simulated physics says 1.67.

def fit_split_window(brightness, reference):
    """Fit θ on matchups: SST ≈ θ₀ + θ₁ T₁₁ + θ₂ (T₁₁ − T₁₂)."""
    t11, t12 = brightness
    design = np.column_stack([np.ones_like(t11), t11, t11 - t12])         # (M, 3)
    # θ = argmin ‖Aθ − y‖²
    theta, *_ = np.linalg.lstsq(design, reference, rcond=None)         # (3,)
    residual = reference - design @ theta                              # (M,) K
    return theta, float(residual.std())

def retrieve(brightness, theta, cloud_limit=270.0):
    """L1 → L2: brightness temperatures to SST, with a cloud flag."""
    t11 = brightness[:, 0]                                      # (D, S, P) K
    t12 = brightness[:, 1]
    # cloud test: a sea surface is never this cold
    clear = t11 > cloud_limit                                   # (D, S, P) bool
    # SST = θ₀ + θ₁ T₁₁ + θ₂ (T₁₁ − T₁₂)
    sst = theta[0] + theta[1] * t11 + theta[2] * (t11 - t12)    # (D, S, P) K
    return np.where(clear, sst, np.nan), clear

Program 2:Fitting the split-window coefficients on matchups, then retrieving SST with a cloud flag.

L2 → L3 · grid and gap-fill: change the geometry, fill the holes

Two different jobs share this arrow. Binning moves swath pixels onto the grid by averaging those that fall in each cell: local and cheap. Gap-filling estimates the cells nothing saw from the ones something did, using how strongly nearby cells vary together: one linear solve over the whole map. The result is complete, and comes with a variance that is small where there were observations and large where there were not.

def bin_to_grid(sst, x, y):
    """L2 → L3, step 1: average the clear pixels that fall in each grid cell."""
    row = np.floor(y / CELL_KM).astype(int)
    col = np.floor(x / CELL_KM).astype(int)
    inside = np.isfinite(sst) & (row >= 0) & (row < GRID) & (col >= 0) & (col < GRID)
    index = row[inside] * GRID + col[inside]
    total = np.bincount(index, weights=sst[inside], minlength=GRID * GRID)
    count = np.bincount(index, minlength=GRID * GRID)
    mean = np.where(count > 0, total / np.maximum(count, 1), np.nan)
    return einx.rearrange("(y x) -> y x", mean, y=GRID), einx.rearrange("(y x) -> y x", count, y=GRID)

def gap_fill(binned, count, climatology, covariance, obs_std):
    """L2 → L3, step 2: optimal interpolation of the anomalies onto every cell."""
    observed = np.flatnonzero(count.ravel() > 0)                # (M,)
    innovation = (binned - climatology).ravel()[observed]       # ȳ − H μ_x      (M,)
    obs_variance = obs_std**2 / count.ravel()[observed]         # R diagonal     (M,)
    cross = covariance[:, observed]                             # Σ_x Hᵀ         (N, M)
    system = covariance[np.ix_(observed, observed)] + np.diag(obs_variance)   # H Σ_x Hᵀ + Σ_ε
    # x̂ = μ_x + Σ_x Hᵀ (H Σ_x Hᵀ + Σ_ε)⁻¹ (ȳ − H μ_x)
    weights = np.linalg.solve(system, innovation)               # (M,)
    mean = climatology.ravel() + cross @ weights                # (N,) K
    # v̂ = diag(Σ_x − Σ_x Hᵀ (H Σ_x Hᵀ + Σ_ε)⁻¹ H Σ_x)
    solved = np.linalg.solve(system, einx.rearrange("n m -> m n", cross))   # (M, N)
    reduction = einx.dot("n m, m n -> n", cross, solved)                    # (N,)
    variance = np.diag(covariance) - reduction                  # (N,) K²
    return einx.rearrange("(y x) -> y x", mean, y=GRID), einx.rearrange("(y x) -> y x", variance, y=GRID)

Program 3:Binning the swath onto the grid, then optimal interpolation of the anomalies.

Measured over days 6 to 60, after the first five days that the L4 filter needs to spin up (every L3 and L4 error on this page uses the same days): on cells that were observed, L3 is right to 0.07 K (averaging several pixels beats one); on cells that were not, 0.57 K, against 0.85 K for climatology alone.

L3 → L4 · model and assimilate: connect the days

Each L3 map uses one day’s data. But the ocean has memory: yesterday’s warm water is still there today, a little further east. A model carries yesterday’s estimate forward; assimilation corrects that forecast with today’s L3, trusting each in proportion to its variance. Cells under cloud today keep what was learned when they were clear.

def assimilate(analysis_l3, variance_l3, climatology):
    """L3 → L4: a forecast-analysis cycle with a per-cell Kalman filter."""
    state = np.zeros((GRID, GRID))                              # anomaly, K
    spread = np.full((GRID, GRID), ANOMALY_STD**2)              # its variance, K²
    states, spreads = [], []
    for day in range(DAYS):
        # forecast: x_{t|t−1} = ρ F x_{t−1|t−1};  p_{t|t−1} = ρ² F p_{t−1|t−1} + (1 − ρ²) σ²
        state = PERSISTENCE * np.roll(state, 1, axis=-1)
        spread = PERSISTENCE**2 * np.roll(spread, 1, axis=-1) + (1 - PERSISTENCE**2) * ANOMALY_STD**2
        # analysis: g = p_{t|t−1} ⊘ (p_{t|t−1} + v̂_t);  x_{t|t} = x_{t|t−1} + g ⊙ (x̂_t − x_{t|t−1});  p_{t|t} = (1 − g) ⊙ p_{t|t−1}
        gain = spread / (spread + variance_l3[day])
        state = state + gain * (analysis_l3[day] - climatology - state)
        spread = (1 - gain) * spread
        states.append(climatology + state)
        spreads.append(spread)
    return np.stack(states), np.stack(spreads)                  # (D, Y, X) K, K²

Program 4:A forecast-analysis cycle with one Kalman gain per cell.

Measured: error over all cells drops from 0.47 K to 0.27 K, and on unobserved cells from 0.57 K to 0.32 K. Running the model on without data gives a forecast: 0.39 K after one day and 0.52 K after five, against 0.90 K and 0.78 K for climatology on the same two days.

L4 → L5 · derive: answer a question

Nobody asks for a temperature field; they ask whether there is a heatwave. A derived product applies a definition: here, warmer than the local 90th percentile for at least five days in a row. The output is first a mask, then a list of events with a start, a duration, a peak and an area.

def heatwave_mask(sst, threshold, min_days=5):
    """L4 → L5, step 1: above the 90th percentile for at least five days running."""
    hot = sst > threshold                                       # (D, Y, X) bool
    run = np.zeros(hot.shape, dtype=int)
    for day in range(hot.shape[0]):
        previous = run[day - 1] if day else 0
        run[day] = np.where(hot[day], previous + 1, 0)
    # a day belongs to a heatwave if its run reaches min_days at some point
    longest = run.copy()
    for day in range(hot.shape[0] - 2, -1, -1):
        longest[day] = np.where(hot[day] & hot[day + 1], np.maximum(longest[day], longest[day + 1]), longest[day])
    return hot & (longest >= min_days)

def heatwave_events(mask, sst, climatology):
    """L4 → L5, step 2: connected regions in (day, y, x) become rows of a table."""
    labels, count = scipy.ndimage.label(mask)
    events = []
    for event in range(1, count + 1):
        days, rows, cols = np.nonzero(labels == event)
        intensity = (sst - climatology)[days, rows, cols]
        area = np.bincount(days).max() * CELL_KM**2
        events.append({
            "start_day": int(days.min()), "end_day": int(days.max()),
            "duration_days": int(days.max() - days.min() + 1),
            "peak_intensity_K": round(float(intensity.max()), 2),
            "max_area_km2": int(area),
        })
    return sorted(events, key=lambda e: -e["max_area_km2"])

Program 5:The heatwave mask, then connected regions turned into a table of events.

Table 3:The largest event found in the truth and in L4.

Largest eventStart dayDurationPeak above climatologyLargest area
From the truth060 days3.52 K273 750 km²
From L4456 days3.31 K251 875 km²

The largest “event” runs for the whole record although the warm blob exists only from day 20 to day 46. The threshold is the 90th percentile of the undisturbed ocean, so about one cell in ten is hot on an ordinary day, and those cells touch the blob in (day, row, col): connected-region labelling merges them into one region. A real heatwave product guards against this with a minimum area or a gap rule, and the table measures merged regions, not the blob alone.

Over all 60 days the truth has 22 626 heatwave cell-days. L4 flags 15 845, of which 15 313 are true: it misses the edges and the first days, and raises few false alarms. From L3 alone, only 7 989 are flagged, since a gap-filled cell relaxes to climatology and breaks the five-day run.

The numbers, level by level

Climatology (no data at all)

0.85 K0.85\ \mathrm{K}reference

L1 · 11 μm11\ \mathrm{\mu m} brightness temperature

1.46 K1.46\ \mathrm{K}clear pixels

L2 · retrieved SST

0.19 K0.19\ \mathrm{K}clear pixels

L3 · gap-filled analysis

0.47 K0.47\ \mathrm{K}every cell

L4 · model + assimilation

0.27 K0.27\ \mathrm{K}every cell

Error against the known truth. L2 is the most accurate and the least complete (58% of the swath, 31% of the grid on a given day). L3 and L4 cover every cell, so their error includes the cells nothing observed.

Table 4:Each level’s shape, size, coverage and error against the truth.

LevelShapeStored asSizeCoversError vs truth
L0(60, 2, 70, 50)uint16 counts0.84 MBthe swath—
L1(60, 2, 70, 50)float32, plus a position per pixel3.36 MBthe swath1.46 K (not yet SST)
L2(60, 70, 50)float32, flag, positions2.73 MB58% of the swath0.19 K
L3(60, 64, 64)mean and variance, float321.97 MBevery cell0.47 K
L4(60, 64, 64)mean and variance, float321.97 MBevery cell0.27 K
L520 events × 5a table2.0 kB—68% of true cell-days found

Five kinds of operator

Put side by side, the transitions differ in the properties that decide how software is built around them.

Table 5:The five transitions side by side.

L0→L1 calibrateL1→L2 retrieveL2→L3 grid + fillL3→L4 assimilateL4→L5 derive
Looks atone detector sampleone pixel, all channelsthe whole mapthe whole map, and yesterdayall of time at one place (the mask); neighbouring cells too (the events)
Geometryunchanged (adds positions)unchangedswath → gridunchangedfield → table
Outside inputsorbit, attitudeweather, angles, priorsother sensors, in-situforcing, boundary conditionsa long baseline
Fitted parametersfrom the laboratory and in flightfrom matchups, or nonecovariance modelmodel and error parametersnone: conventions
Keeps state between callsnononoyesno (but needs the whole record)
Splits freely overgranulespixels and granulestiles with overlapensemble members, not timegrid cells for the mask; the events need the whole cube
Typical failurewrong table versioncloud leaking throughsmearing, false confidence in gapsdrift, double countinga threshold crossed by noise

This is why one pipeline framework has to offer more than “map a function over files”: a per-pixel map, a tiled solve, a stateful cycle and a reduction over time are four different shapes of computation.

Part 2 · The engineering under every level

Whatever the level, the same eight jobs sit under the computation. The overview’s engineering figure names the stack’s package for each; this section says what each job is, with examples from outside the stack.

observations · L0 to L2fields and products · L3 to L5

computeone transition’s science

calibrate

retrieve

grid + fill

model + DA

derive

composewire operators together

one layer for every level

transformcarrier →\to carrier, no model

reproject, mask, resample

regrid, aggregate, verify

patchcut into pieces, process, stitch

one layer for every level

carrywhat operators exchange

array + georeference

labelled cube

readbytes →\to a labelled array

a reader per sensor product

a backend per file format

indexwhat covers here and then

scenes: footprint ×\times time

runs: time ×\times member ×\times lead

storewhere the bytes live

granules and scenes

chunked cubes

The engineering axis, read from the bottom up: bytes are stored, found, read into a carrier, cut into pieces, transformed, and composed into the computation of a level. Rows that split do so because the data change shape at the dashed line.

JobThe ideaObservations sideFields sideIn the stack
Storebytes at rest, readable in partone file per granule or scene: HDF5, NetCDF swaths, COGchunked arrays: Zarr, NetCDF, GRIB; versioned with Icechunkgeocloud
Indexanswer “what covers here and then?” without opening filesscene catalogs: STAC, NASA’s CMRmodel-run catalogs: ESGF, the Copernicus data stores, intake; rows need run, member and lead timegeocatalog; its state profile
Readturn bytes into an array that knows its units, grid and nodataper-product readers: GDAL and rasterio, SatPy, h5pyper-format backends: xarray with netCDF4, zarr, cfgribgeoreader, geoproducts; xrreader
Carrythe one object every operator takes and returnsarray + georeference + nodata: rioxarray, a SatPy scene, a swath definitionlabelled cube: xarray, IrisGeoArray (GeoTensor in the overview figure); xarray
Patchcut what does not fit, process pieces, stitchwindows and tiles: rasterio windows, torchgeo samplerschunks and batches: Dask chunks, xbatchergeopatcher, for both
Transformcarrier to carrier, no science model insidereproject, resample, mask: GDAL warp, pyresampleregrid, aggregate, verify: xESMF, xarraygeoops; xrtoolz
Composewire operators into pipelines, graphs and cycles, and save the wiringtask graphs and workflow managers: Dask, Airflow, Prefectthe same, plus cycling managers: ecFlow, Cylcpipekit, for both
Computethe transition itselfinstrument processors, retrieval codesinterpolation, models, assimilation, indicator librariesradtrax; GeoML; GeoModels with filterax and vardax; xtremax

One naming note: the overview figure labels the observation carrier GeoTensor, which is georeader’s; geotoolz at 640670c carries its own GeoArray.

Why the data change shape between L2 and L3

Before: a swath

values(line, pixel)

xx, yy of every pixel2×2 \times(line, pixel)

quality flag(line, pixel)

time of every line(line,)

Positions are data: every pixel has its own.

Stacking two passes makes no sense.

After: a cube

values(time, y, x)

variance(time, y, x)

coordinatestime, yy, xx: one vector each

grid definitionCRS + origin + spacing

Positions are implied by the index.

Stacking days is one more axis.

Why the carrier changes between L2 and L3. Up to L2 the data keep the sensor’s geometry, and each pixel needs its own coordinates. From L3 on, every array shares one grid, so coordinates shrink to three vectors and arrays can be stacked, sliced by label and compared.

Three jobs stay whole across the dashed line because they do not depend on the shape: storage (bytes are bytes), patching (cut and stitch works on any field) and composition (an operator is an operator). The other four split, and a stack that pretends otherwise ends up resampling too early or carrying per-pixel coordinates it no longer needs.

Six design ideas that recur

Where this goes next

Idea hereShows up as
The six levels and the eight jobsthe lifecycle figures of the overview, with the stack’s package for each cell
An operator’s rows: in, u, θ, const, state, outthe kinds of kinds and roles, and the rungs of the role ladder
One job from search to publishthe geo pipeline: the ten stages run once per transition
Stores and catalogs on both sides of the carrier switchstorage formats, databases and catalogs, Level 2 collections
Versioned parameters and baselinesversions and identity, recipe registries
References
  1. Hobday, A. J., Alexander, L. V., Perkins, S. E., Smale, D. A., Straub, S. C., Oliver, E. C. J., Benthuysen, J. A., Burrows, M. T., Donat, M. G., Feng, M., Holbrook, N. J., Moore, P. J., Scannell, H. A., Sen Gupta, A., & Wernberg, T. (2016). A hierarchical approach to defining marine heatwaves. Progress in Oceanography, 141, 227–238. 10.1016/j.pocean.2015.12.014