FA-70951 / Weather index computation / Open access
Livestock temperature-humidity index: humidity coefficient scale · case 01
Humid barns report nearly the same THI as dry ones.
ROOT CAUSE
RH is divided by 100 although the 0.0055 coefficient already expects percent.
VERIFIED REPAIR
Use 0.55 - 0.0055*RH with RH in percent.
Unsuccessful approach: Using 0.055 makes the humidity factor negative and overshoots.
Case contract
Input barn temperature degC and RH percent. THI = (1.8T+32) - (0.55 - 0.0055RH)(1.8T - 26); THI is rounded to 0.1 first and the stress level is taken from the rounded value: <72 none, <79 mild, <89 moderate, <99 severe, else emergency.
Why this case matters
Dairy heat-stress alerts and cooling automation key off THI bands.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(t_c, rh):
thi = (1.8 * t_c + 32) - (0.55 - 0.0055 * rh / 100) * (1.8 * t_c - 26)
thi = round(thi, 1)
if thi < 72:
level = "none"
elif thi < 79:
level = "mild"
elif thi < 89:
level = "moderate"
elif thi < 99:
level = "severe"
else:
level = "emergency"
return [thi, level]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['15 C barn at 20% RH', [15, 20], [58.6, 'none']], ['15 C barn at 40% RH', [15, 40], [58.7, 'none']], ['15 C barn at 55% RH', [15, 55], [58.8, 'none']], ['15 C barn at 70% RH', [15, 70], [58.8, 'none']], ['15 C barn at 85% RH', [15, 85], [58.9, 'none']], ['15 C barn at 100% RH', [15, 100], [59.0, 'none']], ['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 40% RH', [21, 40], [65.9, 'none']]], [['15 C barn at 70% RH', [15, 70], [58.8, 'none']], ['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 40% RH', [21, 40], [65.9, 'none']], ['21 C barn at 55% RH', [21, 55], [66.9, 'none']], ['21 C barn at 70% RH', [21, 70], [67.9, 'none']], ['21 C barn at 85% RH', [21, 85], [68.8, 'none']], ['21 C barn at 100% RH', [21, 100], [69.8, 'none']], ['22 C barn at 20% RH', [22, 20], [65.6, 'none']]], [['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 100% RH', [21, 100], [69.8, 'none']], ['22 C barn at 55% RH', [22, 55], [68.2, 'none']], ['22 C barn at 70% RH', [22, 70], [69.4, 'none']], ['22 C barn at 85% RH', [22, 85], [70.5, 'none']], ['22 C barn at 100% RH', [22, 100], [71.6, 'none']], ['24 C barn at 20% RH', [24, 20], [67.6, 'none']], ['24 C barn at 40% RH', [24, 40], [69.5, 'none']]], [['21 C barn at 70% RH', [21, 70], [67.9, 'none']], ['22 C barn at 85% RH', [22, 85], [70.5, 'none']], ['24 C barn at 70% RH', [24, 70], [72.4, 'mild']], ['24 C barn at 85% RH', [24, 85], [73.8, 'mild']], ['24 C barn at 100% RH', [24, 100], [75.2, 'mild']], ['25 C barn at 20% RH', [25, 20], [68.6, 'none']], ['25 C barn at 40% RH', [25, 40], [70.7, 'none']], ['25 C barn at 55% RH', [25, 55], [72.3, 'mild']]], [['22 C barn at 20% RH', [22, 20], [65.6, 'none']], ['24 C barn at 70% RH', [24, 70], [72.4, 'mild']], ['25 C barn at 85% RH', [25, 85], [75.4, 'mild']], ['25 C barn at 100% RH', [25, 100], [77.0, 'mild']], ['26 C barn at 20% RH', [26, 20], [69.6, 'none']], ['26 C barn at 40% RH', [26, 40], [71.9, 'none']], ['26 C barn at 55% RH', [26, 55], [73.7, 'mild']], ['26 C barn at 70% RH', [26, 70], [75.4, 'mild']]]]
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 |
|---|---|---|---|
| 15 C barn at 20% RH | [58.5, 'none'] | [58.6, 'none'] | Failed |
| 15 C barn at 40% RH | [58.5, 'none'] | [58.7, 'none'] | Failed |
| 15 C barn at 55% RH | [58.5, 'none'] | [58.8, 'none'] | Failed |
| 15 C barn at 70% RH | [58.5, 'none'] | [58.8, 'none'] | Failed |
| 15 C barn at 85% RH | [58.5, 'none'] | [58.9, 'none'] | Failed |
| 15 C barn at 100% RH | [58.5, 'none'] | [59.0, 'none'] | Failed |
| 21 C barn at 20% RH | [63.3, 'none'] | [64.6, 'none'] | Failed |
| 21 C barn at 40% RH | [63.3, 'none'] | [65.9, 'none'] | Failed |
SHA-256 / 3bdeebeab132710a89e17e5dd1e7a54202d56b3ca271151826b58929646acd9a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(t_c, rh):
thi = (1.8 * t_c + 32) - (0.55 - 0.055 * rh) * (1.8 * t_c - 26)
thi = round(thi, 1)
if thi < 72:
level = "none"
elif thi < 79:
level = "mild"
elif thi < 89:
level = "moderate"
elif thi < 99:
level = "severe"
else:
level = "emergency"
return [thi, level]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['15 C barn at 20% RH', [15, 20], [58.6, 'none']], ['15 C barn at 40% RH', [15, 40], [58.7, 'none']], ['15 C barn at 55% RH', [15, 55], [58.8, 'none']], ['15 C barn at 70% RH', [15, 70], [58.8, 'none']], ['15 C barn at 85% RH', [15, 85], [58.9, 'none']], ['15 C barn at 100% RH', [15, 100], [59.0, 'none']], ['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 40% RH', [21, 40], [65.9, 'none']]], [['15 C barn at 70% RH', [15, 70], [58.8, 'none']], ['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 40% RH', [21, 40], [65.9, 'none']], ['21 C barn at 55% RH', [21, 55], [66.9, 'none']], ['21 C barn at 70% RH', [21, 70], [67.9, 'none']], ['21 C barn at 85% RH', [21, 85], [68.8, 'none']], ['21 C barn at 100% RH', [21, 100], [69.8, 'none']], ['22 C barn at 20% RH', [22, 20], [65.6, 'none']]], [['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 100% RH', [21, 100], [69.8, 'none']], ['22 C barn at 55% RH', [22, 55], [68.2, 'none']], ['22 C barn at 70% RH', [22, 70], [69.4, 'none']], ['22 C barn at 85% RH', [22, 85], [70.5, 'none']], ['22 C barn at 100% RH', [22, 100], [71.6, 'none']], ['24 C barn at 20% RH', [24, 20], [67.6, 'none']], ['24 C barn at 40% RH', [24, 40], [69.5, 'none']]], [['21 C barn at 70% RH', [21, 70], [67.9, 'none']], ['22 C barn at 85% RH', [22, 85], [70.5, 'none']], ['24 C barn at 70% RH', [24, 70], [72.4, 'mild']], ['24 C barn at 85% RH', [24, 85], [73.8, 'mild']], ['24 C barn at 100% RH', [24, 100], [75.2, 'mild']], ['25 C barn at 20% RH', [25, 20], [68.6, 'none']], ['25 C barn at 40% RH', [25, 40], [70.7, 'none']], ['25 C barn at 55% RH', [25, 55], [72.3, 'mild']]], [['22 C barn at 20% RH', [22, 20], [65.6, 'none']], ['24 C barn at 70% RH', [24, 70], [72.4, 'mild']], ['25 C barn at 85% RH', [25, 85], [75.4, 'mild']], ['25 C barn at 100% RH', [25, 100], [77.0, 'mild']], ['26 C barn at 20% RH', [26, 20], [69.6, 'none']], ['26 C barn at 40% RH', [26, 40], [71.9, 'none']], ['26 C barn at 55% RH', [26, 55], [73.7, 'mild']], ['26 C barn at 70% RH', [26, 70], [75.4, 'mild']]]]
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 |
|---|---|---|---|
| 15 C barn at 20% RH | [59.5, 'none'] | [58.6, 'none'] | Failed |
| 15 C barn at 40% RH | [60.6, 'none'] | [58.7, 'none'] | Failed |
| 15 C barn at 55% RH | [61.5, 'none'] | [58.8, 'none'] | Failed |
| 15 C barn at 70% RH | [62.3, 'none'] | [58.8, 'none'] | Failed |
| 15 C barn at 85% RH | [63.1, 'none'] | [58.9, 'none'] | Failed |
| 15 C barn at 100% RH | [64.0, 'none'] | [59.0, 'none'] | Failed |
| 21 C barn at 20% RH | [76.3, 'mild'] | [64.6, 'none'] | Failed |
| 21 C barn at 40% RH | [89.3, 'severe'] | [65.9, 'none'] | Failed |
SHA-256 / eda2601a5d11a58821c156eb9905cc8228c6961d08d088f7c28d65057bbe8bd2
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(t_c, rh):
thi = (1.8 * t_c + 32) - (0.55 - 0.0055 * rh) * (1.8 * t_c - 26)
thi = round(thi, 1)
if thi < 72:
level = "none"
elif thi < 79:
level = "mild"
elif thi < 89:
level = "moderate"
elif thi < 99:
level = "severe"
else:
level = "emergency"
return [thi, level]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['15 C barn at 20% RH', [15, 20], [58.6, 'none']], ['15 C barn at 40% RH', [15, 40], [58.7, 'none']], ['15 C barn at 55% RH', [15, 55], [58.8, 'none']], ['15 C barn at 70% RH', [15, 70], [58.8, 'none']], ['15 C barn at 85% RH', [15, 85], [58.9, 'none']], ['15 C barn at 100% RH', [15, 100], [59.0, 'none']], ['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 40% RH', [21, 40], [65.9, 'none']]], [['15 C barn at 70% RH', [15, 70], [58.8, 'none']], ['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 40% RH', [21, 40], [65.9, 'none']], ['21 C barn at 55% RH', [21, 55], [66.9, 'none']], ['21 C barn at 70% RH', [21, 70], [67.9, 'none']], ['21 C barn at 85% RH', [21, 85], [68.8, 'none']], ['21 C barn at 100% RH', [21, 100], [69.8, 'none']], ['22 C barn at 20% RH', [22, 20], [65.6, 'none']]], [['21 C barn at 20% RH', [21, 20], [64.6, 'none']], ['21 C barn at 100% RH', [21, 100], [69.8, 'none']], ['22 C barn at 55% RH', [22, 55], [68.2, 'none']], ['22 C barn at 70% RH', [22, 70], [69.4, 'none']], ['22 C barn at 85% RH', [22, 85], [70.5, 'none']], ['22 C barn at 100% RH', [22, 100], [71.6, 'none']], ['24 C barn at 20% RH', [24, 20], [67.6, 'none']], ['24 C barn at 40% RH', [24, 40], [69.5, 'none']]], [['21 C barn at 70% RH', [21, 70], [67.9, 'none']], ['22 C barn at 85% RH', [22, 85], [70.5, 'none']], ['24 C barn at 70% RH', [24, 70], [72.4, 'mild']], ['24 C barn at 85% RH', [24, 85], [73.8, 'mild']], ['24 C barn at 100% RH', [24, 100], [75.2, 'mild']], ['25 C barn at 20% RH', [25, 20], [68.6, 'none']], ['25 C barn at 40% RH', [25, 40], [70.7, 'none']], ['25 C barn at 55% RH', [25, 55], [72.3, 'mild']]], [['22 C barn at 20% RH', [22, 20], [65.6, 'none']], ['24 C barn at 70% RH', [24, 70], [72.4, 'mild']], ['25 C barn at 85% RH', [25, 85], [75.4, 'mild']], ['25 C barn at 100% RH', [25, 100], [77.0, 'mild']], ['26 C barn at 20% RH', [26, 20], [69.6, 'none']], ['26 C barn at 40% RH', [26, 40], [71.9, 'none']], ['26 C barn at 55% RH', [26, 55], [73.7, 'mild']], ['26 C barn at 70% RH', [26, 70], [75.4, 'mild']]]]
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 |
|---|---|---|---|
| 15 C barn at 20% RH | [58.6, 'none'] | [58.6, 'none'] | Passed |
| 15 C barn at 40% RH | [58.7, 'none'] | [58.7, 'none'] | Passed |
| 15 C barn at 55% RH | [58.8, 'none'] | [58.8, 'none'] | Passed |
| 15 C barn at 70% RH | [58.8, 'none'] | [58.8, 'none'] | Passed |
| 15 C barn at 85% RH | [58.9, 'none'] | [58.9, 'none'] | Passed |
| 15 C barn at 100% RH | [59.0, 'none'] | [59.0, 'none'] | Passed |
| 21 C barn at 20% RH | [64.6, 'none'] | [64.6, 'none'] | Passed |
| 21 C barn at 40% RH | [65.9, 'none'] | [65.9, 'none'] | Passed |
SHA-256 / f108ed4c9b85f765c641b77a919ae132169deefb3acb56419ffb4d5f96093024
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:25.401018+00:00.
Case digest / 5668f3646fd0d437c94cc9e2c1350595f176d46890d4ac5f11ddcc77a32c2c1e