#!/usr/bin/env python3 """Task 5: compare EC_0.25_SD vs EC_0.25 native (../HW ope1b) EHDE skill. Reads the two final_verify JSONs (identical structure, identical scoring code, identical 416 valid-init test set) and answers the operational question: does downscaling the free 1.5 deg download reproduce the skill of the native 0.25 deg reforecast, or must 0.25 deg be downloaded? Writes ehd_sd_vs_native.html and prints the national table. """ from __future__ import annotations import json, os, sys SD = "outputs_sd/final_verify_sd.json" NATIVE = "/home/tanpv/Progs/claude/HW/outputs/AI_Results/final_verify_ope1b.json" OUT = "ehd_sd_vs_native.html" WEEKS = ["W1", "W2", "W3", "W4", "W5", "W6"] METRICS = ["POD", "POFD", "FAR", "FBI", "CSI", "SEDI", "EDI"] TARGET = {"POD": (">", 0.6), "POFD": ("<", 0.2), "FAR": ("<", 0.2), "CSI": (">", 0.4), "FBI": ("~", 0.75)} def load(p): return json.load(open(p)) if os.path.exists(p) else None def cell(v): return "%.3f" % v if isinstance(v, (int, float)) else "—" def main(): sd = load(SD); nat = load(NATIVE) if sd is None: sys.exit(f"missing {SD} (run submit_sd_verify.slurm first)") if nat is None: sys.exit(f"missing {NATIVE}") # ---- console national table ---- print(f"\n{'':>6}", "".join(f"{m:>22}" for m in ["POD", "FAR", "FBI", "CSI", "SEDI"])) print("national: native (0.25 goc) vs SD (0.25 downscale tu 1.5)") for w in WEEKS: n = nat["national"][w]; s = sd["national"][w] row = " ".join(f"{m}:{n.get(m,float('nan')):.3f}/{s.get(m,float('nan')):.3f}" for m in ["POD", "FAR", "FBI", "CSI", "SEDI"]) print(f"{w:>6} {row}") # ---- HTML ---- def mrow(w): n = nat["national"][w]; s = sd["national"][w] tds = [f"
Cùng hệ Ope1b, cùng bộ test 416 init của 4 năm kiểm định, cùng code chấm điểm (final_verify.py). Khác biệt DUY NHẤT: đầu vào EC ở 0.25° gốc hay downscale từ 1.5°. Mỗi ô: gốc | SD | Δ(SD−gốc). n_init SD={sd.get('n_init','?')}.
Kết luận tải-0.25-hay-1.5 điền sau khi đọc bảng: nếu Δ nhỏ trên toàn W1–W6 thì 1.5°+downscale là đủ; nếu SD kém hẳn (đặc biệt W1) thì cần tải 0.25° gốc.
""" open(OUT, "w").write(html) print(f"\n[report] -> {OUT}") if __name__ == "__main__": main()