Spaces:
Running
Running
fix: EF5 lowercases gauge id in ts filename — read ts.<id.lower()>.<model>.csv so ungauged 'V…' points produce output (V22 hindcast + V23 nowcast were 0-row)
Browse files- hf_data/pipeline.py +5 -9
- hf_data/runner.py +4 -1
hf_data/pipeline.py
CHANGED
|
@@ -744,17 +744,13 @@ def _run_gauge_body(g, model, ef5_model, wb_model, t_start, t_end, use_mock,
|
|
| 744 |
try:
|
| 745 |
with open(os.path.join(out_dir, "ef5_run.log"),
|
| 746 |
encoding="utf-8", errors="replace") as fh:
|
| 747 |
-
|
| 748 |
-
#
|
| 749 |
-
# the bottom — surface both, plus what EF5 actually wrote
|
| 750 |
-
head = log_txt[:1500]
|
| 751 |
-
tail = log_txt[-1500:]
|
| 752 |
produced = sorted(os.path.basename(p) for p in
|
| 753 |
glob.glob(os.path.join(out_dir, "ts.*.csv")))
|
| 754 |
-
yield ("status", f"⚠️ EF5 rc={ev['returncode']}, "
|
| 755 |
-
f"
|
| 756 |
-
f"wrote {produced or '[no ts.*.csv]'}\n"
|
| 757 |
-
f"--- log head ---\n{head}\n--- log tail ---\n{tail}")
|
| 758 |
except Exception:
|
| 759 |
pass
|
| 760 |
yield (ev["kind"], ev)
|
|
|
|
| 744 |
try:
|
| 745 |
with open(os.path.join(out_dir, "ef5_run.log"),
|
| 746 |
encoding="utf-8", errors="replace") as fh:
|
| 747 |
+
tail = fh.read()[-2000:]
|
| 748 |
+
# list what EF5 actually wrote — a name/case mismatch shows here
|
|
|
|
|
|
|
|
|
|
| 749 |
produced = sorted(os.path.basename(p) for p in
|
| 750 |
glob.glob(os.path.join(out_dir, "ts.*.csv")))
|
| 751 |
+
yield ("status", f"⚠️ EF5 rc={ev['returncode']}, {len(new_rows)} new "
|
| 752 |
+
f"rows; expected {os.path.basename(handle.ts_path)}; "
|
| 753 |
+
f"wrote {produced or '[no ts.*.csv]'} — log tail:\n{tail}")
|
|
|
|
| 754 |
except Exception:
|
| 755 |
pass
|
| 756 |
yield (ev["kind"], ev)
|
hf_data/runner.py
CHANGED
|
@@ -140,7 +140,10 @@ def run_ef5(control_path: str, output_dir: str, gauge_id: str, model: str = "cre
|
|
| 140 |
if os.name != "nt": # line-buffer stdout so crashes keep the trail
|
| 141 |
cmd = ["stdbuf", "-oL", "-eL"] + cmd
|
| 142 |
proc = subprocess.Popen(cmd, stdout=log, stderr=subprocess.STDOUT, text=True)
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
| 144 |
return RunHandle(output_dir=output_dir, ts_path=ts, model=model, proc=proc)
|
| 145 |
|
| 146 |
|
|
|
|
| 140 |
if os.name != "nt": # line-buffer stdout so crashes keep the trail
|
| 141 |
cmd = ["stdbuf", "-oL", "-eL"] + cmd
|
| 142 |
proc = subprocess.Popen(cmd, stdout=log, stderr=subprocess.STDOUT, text=True)
|
| 143 |
+
# EF5 lowercases the gauge id in the timeseries filename. All-digit USGS ids
|
| 144 |
+
# are unaffected, but a virtual point's "V…" id is written as "v…", so the
|
| 145 |
+
# expected path must lowercase too or the rows are never read (0-row runs).
|
| 146 |
+
ts = os.path.join(output_dir, f"ts.{gauge_id.lower()}.{model}.csv")
|
| 147 |
return RunHandle(output_dir=output_dir, ts_path=ts, model=model, proc=proc)
|
| 148 |
|
| 149 |
|