FA-71216 / Weather index computation / Open access
Antecedent precipitation index: multi-day gap decay · case 01
After a week without reports the index has barely decayed.
ROOT CAUSE
A single decay factor is applied regardless of how many days elapsed.
VERIFIED REPAIR
Decay by k to the power of the day gap.
Unsuccessful approach: Subtracting one from the gap under-decays every step.
Case contract
obs are [day, precip_mm] in any order; process in ascending day order (stable for equal days). Between observations API decays by k^(day gap); several reports on the same day accumulate without decay; negative precipitation is a sensor glitch treated as 0. Return API after each observation, rounded to 0.01.
Why this case matters
Flash-flood guidance and soil wetness models use API as a moisture state.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(k, obs):
api = 0.0
last = None
out = []
for day, p in sorted(obs, key=lambda r: r[0]):
if last is not None:
api *= k
api += max(p, 0.0)
last = day
out.append(round(api, 2))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basin 0', [0.85, [[1, 0.0], [1, -1.0], [2, -1.0], [3, 0.0], [4, 12.5], [5, 30.0]]], [0.0, 0.0, 0.0, 0.0, 12.5, 40.62]], ['basin 1', [0.9, [[7, 2.0], [10, -1.0], [9, 12.5], [3, 0.0], [13, 12.5], [11, -1.0]]], [0.0, 2.0, 14.12, 12.71, 11.44, 21.76]], ['basin 2', [0.85, [[2, 12.5], [2, 30.0], [3, -1.0], [7, 30.0], [8, 30.0], [9, 30.0], [10, 5.0]]], [12.5, 42.5, 36.12, 48.86, 71.53, 90.8, 82.18]], ['basin 3', [0.9, [[0, 5.0], [6, 2.0], [7, 12.5], [2, 2.0]]], [5.0, 6.05, 5.97, 17.87]], ['basin 4', [0.85, [[2, 30.0], [2, 12.5], [4, 30.0], [4, 12.5], [4, 12.5], [4, 12.5], [5, 5.0]]], [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48]], ['basin 5', [0.9, [[6, 2.0], [4, 30.0], [4, 2.0], [14, 12.5], [10, 0.0], [2, 30.0]]], [30.0, 54.3, 56.3, 47.6, 31.23, 32.99]], ['basin 6', [0.85, [[1, 0.0], [4, 5.0], [2, 5.0], [6, 5.0], [0, 30.0], [10, 12.5]]], [30.0, 25.5, 26.68, 24.27, 22.54, 24.26]], ['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]]], [['basin 4', [0.85, [[2, 30.0], [2, 12.5], [4, 30.0], [4, 12.5], [4, 12.5], [4, 12.5], [5, 5.0]]], [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48]], ['basin 6', [0.85, [[1, 0.0], [4, 5.0], [2, 5.0], [6, 5.0], [0, 30.0], [10, 12.5]]], [30.0, 25.5, 26.68, 24.27, 22.54, 24.26]], ['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]], ['basin 8', [0.85, [[0, 2.0], [0, 5.0], [1, -1.0], [3, 5.0], [4, 30.0], [5, 2.0], [6, 2.0]]], [2.0, 7.0, 5.95, 9.3, 37.9, 34.22, 31.09]], ['basin 9', [0.9, [[1, -1.0], [2, 2.0], [2, 30.0], [3, 12.5], [5, 30.0], [7, 2.0], [9, 30.0]]], [0.0, 2.0, 32.0, 41.3, 63.45, 53.4, 73.25]], ['basin 10', [0.85, [[6, 2.0], [3, 30.0], [4, -1.0], [4, 5.0]]], [30.0, 25.5, 30.5, 24.04]], ['basin 11', [0.9, [[3, -1.0], [5, 2.0], [6, 30.0], [7, -1.0], [9, -1.0], [10, 0.0], [14, 12.5]]], [0.0, 2.0, 31.8, 28.62, 23.18, 20.86, 26.19]], ['basin 12', [0.85, [[2, 30.0], [4, -1.0], [5, 30.0], [6, 0.0], [6, 0.0]]], [30.0, 21.67, 48.42, 41.16, 41.16]]], [['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]], ['basin 11', [0.9, [[3, -1.0], [5, 2.0], [6, 30.0], [7, -1.0], [9, -1.0], [10, 0.0], [14, 12.5]]], [0.0, 2.0, 31.8, 28.62, 23.18, 20.86, 26.19]], ['basin 14', [0.85, [[0, -1.0], [0, 30.0], [1, 5.0], [2, 0.0], [4, 5.0], [8, -1.0]]], [0.0, 30.0, 30.5, 25.93, 23.73, 12.39]], ['basin 15', [0.9, [[6, 5.0], [6, 30.0], [3, 0.0], [1, 5.0], [4, 12.5], [7, 12.5]]], [5.0, 4.05, 16.14, 18.08, 48.08, 55.77]], ['basin 16', [0.85, [[1, 30.0], [13, -1.0], [5, 30.0], [9, 30.0]]], [30.0, 45.66, 53.83, 28.1]], ['basin 17', [0.9, [[7, 5.0], [4, 12.5], [0, 0.0], [6, 30.0]]], [0.0, 12.5, 40.12, 41.11]], ['basin 18', [0.85, [[4, 12.5], [4, -1.0], [3, 2.0], [4, 12.5]]], [2.0, 14.2, 14.2, 26.7]], ['basin 19', [0.9, [[2, 2.0], [6, 2.0], [7, 2.0], [11, 2.0], [13, 0.0], [15, 0.0]]], [2.0, 3.31, 4.98, 5.27, 4.27, 3.46]]], [['basin 10', [0.85, [[6, 2.0], [3, 30.0], [4, -1.0], [4, 5.0]]], [30.0, 25.5, 30.5, 24.04]], ['basin 16', [0.85, [[1, 30.0], [13, -1.0], [5, 30.0], [9, 30.0]]], [30.0, 45.66, 53.83, 28.1]], ['basin 21', [0.9, [[2, 12.5], [2, 30.0], [4, -1.0], [3, 0.0], [7, 0.0], [5, -1.0]]], [12.5, 42.5, 38.25, 34.43, 30.98, 25.1]], ['basin 22', [0.85, [[0, 2.0], [1, -1.0], [1, -1.0], [2, 5.0], [3, 0.0], [7, 2.0], [8, 5.0]]], [2.0, 1.7, 1.7, 6.45, 5.48, 4.86, 9.13]], ['basin 23', [0.9, [[3, 30.0], [4, 30.0], [8, -1.0], [8, -1.0], [10, 0.0]]], [30.0, 57.0, 37.4, 37.4, 30.29]], ['basin 24', [0.85, [[2, 0.0], [4, -1.0], [5, -1.0], [5, 0.0], [6, 2.0], [7, 30.0], [7, 2.0]]], [0.0, 0.0, 0.0, 0.0, 2.0, 31.7, 33.7]], ['basin 25', [0.9, [[3, 0.0], [1, -1.0], [0, -1.0], [4, 2.0]]], [0.0, 0.0, 0.0, 2.0]], ['basin 26', [0.85, [[3, 30.0], [4, 2.0], [8, 0.0], [12, 0.0], [16, 12.5]]], [30.0, 27.5, 14.36, 7.49, 16.41]]], [['basin 0', [0.85, [[1, 0.0], [1, -1.0], [2, -1.0], [3, 0.0], [4, 12.5], [5, 30.0]]], [0.0, 0.0, 0.0, 0.0, 12.5, 40.62]], ['basin 13', [0.9, [[0, 12.5], [4, -1.0], [5, 5.0], [7, 12.5]]], [12.5, 8.2, 12.38, 22.53]], ['basin 21', [0.9, [[2, 12.5], [2, 30.0], [4, -1.0], [3, 0.0], [7, 0.0], [5, -1.0]]], [12.5, 42.5, 38.25, 34.43, 30.98, 25.1]], ['basin 28', [0.85, [[2, 30.0], [3, 2.0], [5, 2.0], [6, 30.0], [10, 2.0], [10, 5.0], [14, 5.0]]], [30.0, 27.5, 21.87, 48.59, 27.36, 32.36, 21.89]], ['basin 29', [0.9, [[4, 5.0], [1, 30.0], [1, 5.0], [3, 30.0]]], [30.0, 35.0, 58.35, 57.52]], ['two gauges same day', [0.9, [[1, 10.0], [1, 5.0], [3, 0.0]]], [10.0, 15.0, 12.15]], ['negative glitch', [0.8, [[0, 10.0], [1, -3.0]]], [10.0, 8.0]], ['week gap', [0.9, [[0, 20.0], [7, 0.0]]], [20.0, 9.57]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| basin 0 | [0.0, 0.0, 0.0, 0.0, 12.5, 40.62] | [0.0, 0.0, 0.0, 0.0, 12.5, 40.62] | Passed |
| basin 1 | [0.0, 2.0, 14.3, 12.87, 11.58, 22.92] | [0.0, 2.0, 14.12, 12.71, 11.44, 21.76] | Failed |
| basin 2 | [12.5, 40.62, 34.53, 59.35, 80.45, 98.38, 88.62] | [12.5, 42.5, 36.12, 48.86, 71.53, 90.8, 82.18] | Failed |
| basin 3 | [5.0, 6.5, 7.85, 19.57] | [5.0, 6.05, 5.97, 17.87] | Failed |
| basin 4 | [30.0, 38.0, 62.3, 65.45, 68.14, 70.42, 64.85] | [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48] | Failed |
| basin 5 | [30.0, 57.0, 53.3, 49.97, 44.97, 52.98] | [30.0, 54.3, 56.3, 47.6, 31.23, 32.99] | Failed |
| basin 6 | [30.0, 25.5, 26.68, 27.67, 28.52, 36.74] | [30.0, 25.5, 26.68, 24.27, 22.54, 24.26] | Failed |
| basin 7 | [2.0, 6.8, 8.12, 9.31] | [2.0, 6.8, 7.51, 8.76] | Failed |
SHA-256 / 69950792b08687fa637f0f8dc23a29fd3245b05fbd6e217e5c741bc3e18cba1d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(k, obs):
api = 0.0
last = None
out = []
for day, p in sorted(obs, key=lambda r: r[0]):
if last is not None:
api *= k ** (day - last - 1)
api += max(p, 0.0)
last = day
out.append(round(api, 2))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basin 0', [0.85, [[1, 0.0], [1, -1.0], [2, -1.0], [3, 0.0], [4, 12.5], [5, 30.0]]], [0.0, 0.0, 0.0, 0.0, 12.5, 40.62]], ['basin 1', [0.9, [[7, 2.0], [10, -1.0], [9, 12.5], [3, 0.0], [13, 12.5], [11, -1.0]]], [0.0, 2.0, 14.12, 12.71, 11.44, 21.76]], ['basin 2', [0.85, [[2, 12.5], [2, 30.0], [3, -1.0], [7, 30.0], [8, 30.0], [9, 30.0], [10, 5.0]]], [12.5, 42.5, 36.12, 48.86, 71.53, 90.8, 82.18]], ['basin 3', [0.9, [[0, 5.0], [6, 2.0], [7, 12.5], [2, 2.0]]], [5.0, 6.05, 5.97, 17.87]], ['basin 4', [0.85, [[2, 30.0], [2, 12.5], [4, 30.0], [4, 12.5], [4, 12.5], [4, 12.5], [5, 5.0]]], [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48]], ['basin 5', [0.9, [[6, 2.0], [4, 30.0], [4, 2.0], [14, 12.5], [10, 0.0], [2, 30.0]]], [30.0, 54.3, 56.3, 47.6, 31.23, 32.99]], ['basin 6', [0.85, [[1, 0.0], [4, 5.0], [2, 5.0], [6, 5.0], [0, 30.0], [10, 12.5]]], [30.0, 25.5, 26.68, 24.27, 22.54, 24.26]], ['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]]], [['basin 4', [0.85, [[2, 30.0], [2, 12.5], [4, 30.0], [4, 12.5], [4, 12.5], [4, 12.5], [5, 5.0]]], [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48]], ['basin 6', [0.85, [[1, 0.0], [4, 5.0], [2, 5.0], [6, 5.0], [0, 30.0], [10, 12.5]]], [30.0, 25.5, 26.68, 24.27, 22.54, 24.26]], ['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]], ['basin 8', [0.85, [[0, 2.0], [0, 5.0], [1, -1.0], [3, 5.0], [4, 30.0], [5, 2.0], [6, 2.0]]], [2.0, 7.0, 5.95, 9.3, 37.9, 34.22, 31.09]], ['basin 9', [0.9, [[1, -1.0], [2, 2.0], [2, 30.0], [3, 12.5], [5, 30.0], [7, 2.0], [9, 30.0]]], [0.0, 2.0, 32.0, 41.3, 63.45, 53.4, 73.25]], ['basin 10', [0.85, [[6, 2.0], [3, 30.0], [4, -1.0], [4, 5.0]]], [30.0, 25.5, 30.5, 24.04]], ['basin 11', [0.9, [[3, -1.0], [5, 2.0], [6, 30.0], [7, -1.0], [9, -1.0], [10, 0.0], [14, 12.5]]], [0.0, 2.0, 31.8, 28.62, 23.18, 20.86, 26.19]], ['basin 12', [0.85, [[2, 30.0], [4, -1.0], [5, 30.0], [6, 0.0], [6, 0.0]]], [30.0, 21.67, 48.42, 41.16, 41.16]]], [['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]], ['basin 11', [0.9, [[3, -1.0], [5, 2.0], [6, 30.0], [7, -1.0], [9, -1.0], [10, 0.0], [14, 12.5]]], [0.0, 2.0, 31.8, 28.62, 23.18, 20.86, 26.19]], ['basin 14', [0.85, [[0, -1.0], [0, 30.0], [1, 5.0], [2, 0.0], [4, 5.0], [8, -1.0]]], [0.0, 30.0, 30.5, 25.93, 23.73, 12.39]], ['basin 15', [0.9, [[6, 5.0], [6, 30.0], [3, 0.0], [1, 5.0], [4, 12.5], [7, 12.5]]], [5.0, 4.05, 16.14, 18.08, 48.08, 55.77]], ['basin 16', [0.85, [[1, 30.0], [13, -1.0], [5, 30.0], [9, 30.0]]], [30.0, 45.66, 53.83, 28.1]], ['basin 17', [0.9, [[7, 5.0], [4, 12.5], [0, 0.0], [6, 30.0]]], [0.0, 12.5, 40.12, 41.11]], ['basin 18', [0.85, [[4, 12.5], [4, -1.0], [3, 2.0], [4, 12.5]]], [2.0, 14.2, 14.2, 26.7]], ['basin 19', [0.9, [[2, 2.0], [6, 2.0], [7, 2.0], [11, 2.0], [13, 0.0], [15, 0.0]]], [2.0, 3.31, 4.98, 5.27, 4.27, 3.46]]], [['basin 10', [0.85, [[6, 2.0], [3, 30.0], [4, -1.0], [4, 5.0]]], [30.0, 25.5, 30.5, 24.04]], ['basin 16', [0.85, [[1, 30.0], [13, -1.0], [5, 30.0], [9, 30.0]]], [30.0, 45.66, 53.83, 28.1]], ['basin 21', [0.9, [[2, 12.5], [2, 30.0], [4, -1.0], [3, 0.0], [7, 0.0], [5, -1.0]]], [12.5, 42.5, 38.25, 34.43, 30.98, 25.1]], ['basin 22', [0.85, [[0, 2.0], [1, -1.0], [1, -1.0], [2, 5.0], [3, 0.0], [7, 2.0], [8, 5.0]]], [2.0, 1.7, 1.7, 6.45, 5.48, 4.86, 9.13]], ['basin 23', [0.9, [[3, 30.0], [4, 30.0], [8, -1.0], [8, -1.0], [10, 0.0]]], [30.0, 57.0, 37.4, 37.4, 30.29]], ['basin 24', [0.85, [[2, 0.0], [4, -1.0], [5, -1.0], [5, 0.0], [6, 2.0], [7, 30.0], [7, 2.0]]], [0.0, 0.0, 0.0, 0.0, 2.0, 31.7, 33.7]], ['basin 25', [0.9, [[3, 0.0], [1, -1.0], [0, -1.0], [4, 2.0]]], [0.0, 0.0, 0.0, 2.0]], ['basin 26', [0.85, [[3, 30.0], [4, 2.0], [8, 0.0], [12, 0.0], [16, 12.5]]], [30.0, 27.5, 14.36, 7.49, 16.41]]], [['basin 0', [0.85, [[1, 0.0], [1, -1.0], [2, -1.0], [3, 0.0], [4, 12.5], [5, 30.0]]], [0.0, 0.0, 0.0, 0.0, 12.5, 40.62]], ['basin 13', [0.9, [[0, 12.5], [4, -1.0], [5, 5.0], [7, 12.5]]], [12.5, 8.2, 12.38, 22.53]], ['basin 21', [0.9, [[2, 12.5], [2, 30.0], [4, -1.0], [3, 0.0], [7, 0.0], [5, -1.0]]], [12.5, 42.5, 38.25, 34.43, 30.98, 25.1]], ['basin 28', [0.85, [[2, 30.0], [3, 2.0], [5, 2.0], [6, 30.0], [10, 2.0], [10, 5.0], [14, 5.0]]], [30.0, 27.5, 21.87, 48.59, 27.36, 32.36, 21.89]], ['basin 29', [0.9, [[4, 5.0], [1, 30.0], [1, 5.0], [3, 30.0]]], [30.0, 35.0, 58.35, 57.52]], ['two gauges same day', [0.9, [[1, 10.0], [1, 5.0], [3, 0.0]]], [10.0, 15.0, 12.15]], ['negative glitch', [0.8, [[0, 10.0], [1, -3.0]]], [10.0, 8.0]], ['week gap', [0.9, [[0, 20.0], [7, 0.0]]], [20.0, 9.57]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| basin 0 | [0.0, 0.0, 0.0, 0.0, 12.5, 42.5] | [0.0, 0.0, 0.0, 0.0, 12.5, 40.62] | Failed |
| basin 1 | [0.0, 2.0, 14.3, 14.3, 14.3, 25.37] | [0.0, 2.0, 14.12, 12.71, 11.44, 21.76] | Failed |
| basin 2 | [12.5, 44.71, 44.71, 57.45, 87.45, 117.45, 122.45] | [12.5, 42.5, 36.12, 48.86, 71.53, 90.8, 82.18] | Failed |
| basin 3 | [5.0, 6.5, 6.74, 19.24] | [5.0, 6.05, 5.97, 17.87] | Failed |
| basin 4 | [30.0, 47.79, 70.62, 95.59, 124.96, 159.51, 164.51] | [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48] | Failed |
| basin 5 | [30.0, 57.0, 65.33, 60.8, 44.32, 44.81] | [30.0, 54.3, 56.3, 47.6, 31.23, 32.99] | Failed |
| basin 6 | [30.0, 30.0, 35.0, 34.75, 34.54, 33.71] | [30.0, 25.5, 26.68, 24.27, 22.54, 24.26] | Failed |
| basin 7 | [2.0, 7.0, 8.3, 10.3] | [2.0, 6.8, 7.51, 8.76] | Failed |
SHA-256 / eef88b787e5e13cd752edda4707359e64527222f14da9ccafae03a958d07042e
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(k, obs):
api = 0.0
last = None
out = []
for day, p in sorted(obs, key=lambda r: r[0]):
if last is not None:
api *= k ** (day - last)
api += max(p, 0.0)
last = day
out.append(round(api, 2))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basin 0', [0.85, [[1, 0.0], [1, -1.0], [2, -1.0], [3, 0.0], [4, 12.5], [5, 30.0]]], [0.0, 0.0, 0.0, 0.0, 12.5, 40.62]], ['basin 1', [0.9, [[7, 2.0], [10, -1.0], [9, 12.5], [3, 0.0], [13, 12.5], [11, -1.0]]], [0.0, 2.0, 14.12, 12.71, 11.44, 21.76]], ['basin 2', [0.85, [[2, 12.5], [2, 30.0], [3, -1.0], [7, 30.0], [8, 30.0], [9, 30.0], [10, 5.0]]], [12.5, 42.5, 36.12, 48.86, 71.53, 90.8, 82.18]], ['basin 3', [0.9, [[0, 5.0], [6, 2.0], [7, 12.5], [2, 2.0]]], [5.0, 6.05, 5.97, 17.87]], ['basin 4', [0.85, [[2, 30.0], [2, 12.5], [4, 30.0], [4, 12.5], [4, 12.5], [4, 12.5], [5, 5.0]]], [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48]], ['basin 5', [0.9, [[6, 2.0], [4, 30.0], [4, 2.0], [14, 12.5], [10, 0.0], [2, 30.0]]], [30.0, 54.3, 56.3, 47.6, 31.23, 32.99]], ['basin 6', [0.85, [[1, 0.0], [4, 5.0], [2, 5.0], [6, 5.0], [0, 30.0], [10, 12.5]]], [30.0, 25.5, 26.68, 24.27, 22.54, 24.26]], ['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]]], [['basin 4', [0.85, [[2, 30.0], [2, 12.5], [4, 30.0], [4, 12.5], [4, 12.5], [4, 12.5], [5, 5.0]]], [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48]], ['basin 6', [0.85, [[1, 0.0], [4, 5.0], [2, 5.0], [6, 5.0], [0, 30.0], [10, 12.5]]], [30.0, 25.5, 26.68, 24.27, 22.54, 24.26]], ['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]], ['basin 8', [0.85, [[0, 2.0], [0, 5.0], [1, -1.0], [3, 5.0], [4, 30.0], [5, 2.0], [6, 2.0]]], [2.0, 7.0, 5.95, 9.3, 37.9, 34.22, 31.09]], ['basin 9', [0.9, [[1, -1.0], [2, 2.0], [2, 30.0], [3, 12.5], [5, 30.0], [7, 2.0], [9, 30.0]]], [0.0, 2.0, 32.0, 41.3, 63.45, 53.4, 73.25]], ['basin 10', [0.85, [[6, 2.0], [3, 30.0], [4, -1.0], [4, 5.0]]], [30.0, 25.5, 30.5, 24.04]], ['basin 11', [0.9, [[3, -1.0], [5, 2.0], [6, 30.0], [7, -1.0], [9, -1.0], [10, 0.0], [14, 12.5]]], [0.0, 2.0, 31.8, 28.62, 23.18, 20.86, 26.19]], ['basin 12', [0.85, [[2, 30.0], [4, -1.0], [5, 30.0], [6, 0.0], [6, 0.0]]], [30.0, 21.67, 48.42, 41.16, 41.16]]], [['basin 7', [0.9, [[7, 2.0], [6, 2.0], [3, 2.0], [4, 5.0]]], [2.0, 6.8, 7.51, 8.76]], ['basin 11', [0.9, [[3, -1.0], [5, 2.0], [6, 30.0], [7, -1.0], [9, -1.0], [10, 0.0], [14, 12.5]]], [0.0, 2.0, 31.8, 28.62, 23.18, 20.86, 26.19]], ['basin 14', [0.85, [[0, -1.0], [0, 30.0], [1, 5.0], [2, 0.0], [4, 5.0], [8, -1.0]]], [0.0, 30.0, 30.5, 25.93, 23.73, 12.39]], ['basin 15', [0.9, [[6, 5.0], [6, 30.0], [3, 0.0], [1, 5.0], [4, 12.5], [7, 12.5]]], [5.0, 4.05, 16.14, 18.08, 48.08, 55.77]], ['basin 16', [0.85, [[1, 30.0], [13, -1.0], [5, 30.0], [9, 30.0]]], [30.0, 45.66, 53.83, 28.1]], ['basin 17', [0.9, [[7, 5.0], [4, 12.5], [0, 0.0], [6, 30.0]]], [0.0, 12.5, 40.12, 41.11]], ['basin 18', [0.85, [[4, 12.5], [4, -1.0], [3, 2.0], [4, 12.5]]], [2.0, 14.2, 14.2, 26.7]], ['basin 19', [0.9, [[2, 2.0], [6, 2.0], [7, 2.0], [11, 2.0], [13, 0.0], [15, 0.0]]], [2.0, 3.31, 4.98, 5.27, 4.27, 3.46]]], [['basin 10', [0.85, [[6, 2.0], [3, 30.0], [4, -1.0], [4, 5.0]]], [30.0, 25.5, 30.5, 24.04]], ['basin 16', [0.85, [[1, 30.0], [13, -1.0], [5, 30.0], [9, 30.0]]], [30.0, 45.66, 53.83, 28.1]], ['basin 21', [0.9, [[2, 12.5], [2, 30.0], [4, -1.0], [3, 0.0], [7, 0.0], [5, -1.0]]], [12.5, 42.5, 38.25, 34.43, 30.98, 25.1]], ['basin 22', [0.85, [[0, 2.0], [1, -1.0], [1, -1.0], [2, 5.0], [3, 0.0], [7, 2.0], [8, 5.0]]], [2.0, 1.7, 1.7, 6.45, 5.48, 4.86, 9.13]], ['basin 23', [0.9, [[3, 30.0], [4, 30.0], [8, -1.0], [8, -1.0], [10, 0.0]]], [30.0, 57.0, 37.4, 37.4, 30.29]], ['basin 24', [0.85, [[2, 0.0], [4, -1.0], [5, -1.0], [5, 0.0], [6, 2.0], [7, 30.0], [7, 2.0]]], [0.0, 0.0, 0.0, 0.0, 2.0, 31.7, 33.7]], ['basin 25', [0.9, [[3, 0.0], [1, -1.0], [0, -1.0], [4, 2.0]]], [0.0, 0.0, 0.0, 2.0]], ['basin 26', [0.85, [[3, 30.0], [4, 2.0], [8, 0.0], [12, 0.0], [16, 12.5]]], [30.0, 27.5, 14.36, 7.49, 16.41]]], [['basin 0', [0.85, [[1, 0.0], [1, -1.0], [2, -1.0], [3, 0.0], [4, 12.5], [5, 30.0]]], [0.0, 0.0, 0.0, 0.0, 12.5, 40.62]], ['basin 13', [0.9, [[0, 12.5], [4, -1.0], [5, 5.0], [7, 12.5]]], [12.5, 8.2, 12.38, 22.53]], ['basin 21', [0.9, [[2, 12.5], [2, 30.0], [4, -1.0], [3, 0.0], [7, 0.0], [5, -1.0]]], [12.5, 42.5, 38.25, 34.43, 30.98, 25.1]], ['basin 28', [0.85, [[2, 30.0], [3, 2.0], [5, 2.0], [6, 30.0], [10, 2.0], [10, 5.0], [14, 5.0]]], [30.0, 27.5, 21.87, 48.59, 27.36, 32.36, 21.89]], ['basin 29', [0.9, [[4, 5.0], [1, 30.0], [1, 5.0], [3, 30.0]]], [30.0, 35.0, 58.35, 57.52]], ['two gauges same day', [0.9, [[1, 10.0], [1, 5.0], [3, 0.0]]], [10.0, 15.0, 12.15]], ['negative glitch', [0.8, [[0, 10.0], [1, -3.0]]], [10.0, 8.0]], ['week gap', [0.9, [[0, 20.0], [7, 0.0]]], [20.0, 9.57]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| basin 0 | [0.0, 0.0, 0.0, 0.0, 12.5, 40.62] | [0.0, 0.0, 0.0, 0.0, 12.5, 40.62] | Passed |
| basin 1 | [0.0, 2.0, 14.12, 12.71, 11.44, 21.76] | [0.0, 2.0, 14.12, 12.71, 11.44, 21.76] | Passed |
| basin 2 | [12.5, 42.5, 36.12, 48.86, 71.53, 90.8, 82.18] | [12.5, 42.5, 36.12, 48.86, 71.53, 90.8, 82.18] | Passed |
| basin 3 | [5.0, 6.05, 5.97, 17.87] | [5.0, 6.05, 5.97, 17.87] | Passed |
| basin 4 | [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48] | [30.0, 42.5, 60.71, 73.21, 85.71, 98.21, 88.48] | Passed |
| basin 5 | [30.0, 54.3, 56.3, 47.6, 31.23, 32.99] | [30.0, 54.3, 56.3, 47.6, 31.23, 32.99] | Passed |
| basin 6 | [30.0, 25.5, 26.68, 24.27, 22.54, 24.26] | [30.0, 25.5, 26.68, 24.27, 22.54, 24.26] | Passed |
| basin 7 | [2.0, 6.8, 7.51, 8.76] | [2.0, 6.8, 7.51, 8.76] | Passed |
SHA-256 / 53acac723c4d0bc80907e5b74ae6396f7f48f717cac06c6a458257738c6032a7
Verification & scope
Stipulated deterministic teaching model of an operational weather index; coefficients and thresholds are fixed by the contract and no claim of standards conformance is made. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:48:27.701069+00:00.
Case digest / 6c0e7bee12569463130f50d0ab2a0151462ac2ce2fa20b509e7ee8a18e0d865f