Skip to content

[PROBE: energy] Detect cancelling errors in hourly surface energy budgets - #16

Open
cehw wants to merge 2 commits into
Flood-Lab:mainfrom
cehw:codex/surface-energy-closure
Open

[PROBE: energy] Detect cancelling errors in hourly surface energy budgets#16
cehw wants to merge 2 commits into
Flood-Lab:mainfrom
cehw:codex/surface-energy-closure

Conversation

@cehw

@cehw cehw commented Sep 10, 2026

Copy link
Copy Markdown

Closes #15

What this probe asserts

A model with +20 W m-2 of surface-energy residual by day and -20 W m-2 by night passes the existing signed cumulative energy_closure. This probe catches that temporal cancellation by requiring every contiguous day/night block to satisfy

mean(abs(Rn - H - LE - G)) <= max(0.05 * mean(abs(Rn)), 2 W m-2).

The seeded hourly case contains two spinup days and fourteen scored days, starting at 06:00 local-solar time so all 28 scored blocks are complete. The new energy_closure_by_phase reuses the existing window/segment machinery; the cumulative criterion is unchanged. reference_coupled now declares its verified PT1H support, and reference_diurnal_bias changes only H using the current timestamp.

The boundary is a snow-free, zero-capacity bare skin with G at the actual soil surface. Negative turbulent fluxes are permitted. Boundary compatibility needs adapter documentation/review; passing does not establish realistic partitioning, thermal inertia, or component accuracy.

Discrimination

Reference model Expected Criterion that catches it
reference_coupled PASS n/a
reference_diurnal_bias FAIL energy_closure_by_phase

Both outcomes hold for the five declared gate seeds. An additional 20-seed check through the real adapter subprocess path found: positive control 20/20 passes, temporal-bias control 20/20 fails all 28 blocks, and the unchanged cumulative criterion still passes the bias control 20/20. Unit regressions also cover cancellation within a phase and weak-radiation allowances.

Validation

  • ht validate: 17 probes, 30 models.
  • pytest -q: 233 passed.
  • ht gate: all 17 probes separate their declared references.
  • ht verify-adapter --model <reference> --probe energy/surface-energy-closure: both references pass with 384 rows.
  • New-probe gate on Windows restricted to two logical CPUs (processor affinity mask 3): 1.59 s including ten adapter runs; the per-run budget is 60 s. This is a local two-CPU measurement, not a claim about an already-completed GitHub runner.
  • ht run --model <model> --probe energy/surface-energy-closure --gate-seeds --csv models/result.csv archived all five existing evaluated models as INCOMPLETE for missing hfls/hfss/hfg; Google and dhbv2 additionally declare no PT1H support. No physical-violation claim is made for them.

README, roadmap, contributor credit, the three-language site/flowchart and the probe-writing reference are synchronized. The focused tests verify deterministic forcing, complete blocks, annotation stripping, the minimum window, tolerance boundaries and spinup exclusion.

Checklist

  • There is an accepted proposal issue and this PR closes it
  • ht validate passes
  • ht gate --probe energy/surface-energy-closure passes
  • The generator is deterministic given a seed and commits no data
  • The probe runs in under a minute on two CPUs (local affinity-constrained measurement above)
  • Tolerance and denominator are justified in probe.yaml
  • I constructed a model that passes cumulative closure with unphysical temporal errors, and the new criterion catches it

@cehw
cehw requested a review from chrimerss as a code owner September 10, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PROBE] energy/surface-energy-closure: hourly budgets without day-night cancellation

1 participant