mengxaingshuo commited on
Commit
50d7f1c
·
1 Parent(s): edaeab6

fix: ignore synthetic depth for 2-D Ocean products

Browse files
Files changed (1) hide show
  1. codex_harness.py +14 -0
codex_harness.py CHANGED
@@ -148,6 +148,20 @@ class CodexHarness:
148
  if short not in allowed or not hasattr(marine_mcp, short):
149
  raise ValueError("unsupported Marine tool: " + str(name))
150
  args = dict(arguments or {})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  result = getattr(marine_mcp, short)(**args)
152
  return CodexHarness._jsonable(result)
153
 
 
148
  if short not in allowed or not hasattr(marine_mcp, short):
149
  raise ValueError("unsupported Marine tool: " + str(name))
150
  args = dict(arguments or {})
151
+ # OpenCode models sometimes emit depth=0 for every Ocean request.
152
+ # ERA5, ERA5 accumulated fields, OISST and OC-CCI are 2-D products;
153
+ # forwarding that synthetic depth makes the school API reject a valid
154
+ # request with "has no depth dimension". Preserve non-zero explicit
155
+ # depths so an actually invalid user request still gets the server's
156
+ # honest validation error.
157
+ if short in {"marine_export", "marine_subset"}:
158
+ source = str(args.get("source") or "").strip().lower()
159
+ if source in {"era5", "era5_accum", "oisst", "occci", "oc-cci"}:
160
+ try:
161
+ if float(args.get("depth")) == 0.0:
162
+ args.pop("depth", None)
163
+ except (TypeError, ValueError):
164
+ pass
165
  result = getattr(marine_mcp, short)(**args)
166
  return CodexHarness._jsonable(result)
167