text
stringlengths
0
1.47k
sys.exit(f"No clue {args.clue}")
cl = b["clues"][args.clue]
if cl["status"] not in ("read", "computed"):
sys.exit(f"Clue {args.clue} is \"{cl['status']}\" (inferred/observed): it can't exclude, only `evidence --against {cname}:0.34`. "
f"Hard rule 9: exclusion and confirmation use the same standard.")
if not args.computed or not Path(args.computed).exists():
sys.exit("Exclusion must attach a computed file (--computed, e.g. geo.py frame output or a terrain.py comparison image), and the file must actually exist")
c = b["candidates"][cname]
if c["level"] in EXTENDED_LEVELS:
if not args.covers:
sys.exit(
f"{cname} is a {LEVEL_LABEL[c['level']]}-level candidate (has extent): exclusion needs --covers stating where the evidence actually covers "
f"('lat,lon' or 'lat,lon:lat,lon'). Hard rule 9: exclusion scope must be ≤ evidence scope — "
f"looking at one point and excluding the whole thing is one point standing in for the whole area. If you only checked one stretch, use instead: "
f"board.py evidence --clue {args.clue} --against {cname}:0.34 --file {args.computed}")
pts = _parse_covers(args.covers)
if not pts:
sys.exit("--covers must parse to coordinates: 'lat,lon' (single point) or 'lat,lon:lat,lon' (span)")
r = _covers_ratio(c, pts)
if r is not None and r[0] < COVERS_MIN:
cov_m = _cov_span_m(pts[0], pts[-1]) if len(pts) >= 2 else 0.0
sys.exit(
f"--covers covers only about {r[0]:.0%} of {cname} (evidence {cov_m:.0f} m / candidate extent diagonal {r[1]:.0f} m): "
f"not enough to exclude the whole thing. Add comparison images for the remaining stretches before excluding, or down-weight first: "
f"board.py evidence --clue {args.clue} --against {cname}:0.34 --file {args.computed}")
c["status"] = "excluded"
c["excluded_by"] = {"clue": args.clue, "computed": args.computed, "why": args.why or "",
"covers": args.covers or ""}
cl["used"] = True
_log(b, f"exclude {cname} by {args.clue} ({args.computed})")
_save(p, b)
print(f"Excluded {cname}. Excluded candidates stay in the ledger; check looks back at them.")
def cmd_scan_bbox(args, p: Path) -> None:
b = _load(p)
cname = _find(b, args.name)
b["candidates"][cname]["scan_bbox"] = [float(v) for v in args.bbox.split(",")]
_log(b, f"scan-bbox {cname} {args.bbox}")
_save(p, b)
print("ok")
def cmd_urban(args, p: Path) -> None:
b = _load(p)
cname = _find(b, args.name)
cmd = [UV, "run", str(HERE / "gazetteer.py"), "urban", cname]
if args.within:
cmd += ["--within", args.within]
if args.proxy:
cmd += ["--proxy", args.proxy]
r = _run(cmd)
if r.returncode != 0:
sys.exit(f"gazetteer urban failed: {r.stderr.strip()[-600:]}")
d = json.loads(r.stdout[r.stdout.index("{"):])
if d.get("urban_bbox"):
b["candidates"][cname]["scan_bbox"] = d["urban_bbox"]
b["candidates"][cname]["urban_source"] = d.get("source")
_log(b, f"urban {cname} {d['urban_bbox']} ({d.get('source')})")
_save(p, b)
print(f"{cname} built-up area {d['urban_bbox']}, about {d.get('urban_bbox_km2')} km² (source {d.get('source')})"
+ (f"; {d['note']}" if d.get("note") else ""))
else:
print(f"{cname}: {d.get('note', 'no built-up area data')}; set it by hand with `board.py scan-bbox`")
def cmd_falsify(args, p: Path) -> None:
b = _load(p)
cname = _find(b, args.name)
b["falsify"].setdefault(cname, []).append(args.text)
_log(b, f"falsify {cname}: {args.text}")
_save(p, b)
print("Falsification condition recorded. If it shows up, give up; don't look for reasons to explain it away.")
def cmd_rank(args, p: Path, quiet: bool = False) -> dict:
b = _load(p)
out = {}
for lv in LEVELS:
rows = _scores(b, lv, args.prior_by)
if not rows:
continue
out[lv] = rows
if quiet:
continue
print(f"\n[{LEVEL_LABEL[lv]}] {len(rows)} candidates ({sum(1 for r in rows if not r['excluded'])} not excluded)")
print(f" {'candidate':<14}{'share':>7}{'evidence':>9}{'verified':>9}{'pages':>6} {'share/page':>10} note")
for r in rows[: args.limit]:
pages, src = _cost_of(r["c"], args)
ratio = (r["share"] / pages) if pages else None
flag = "excluded" if r["excluded"] else ""
print(f" {r['name']:<14}{r['share']:>7.1%}{r['n_ev']:>9}{r['n_verified']:>9}{(pages if pages is not None else '?'):>6}"
f" {(f'{ratio:.4f}' if ratio is not None else '?'):>10} {flag} {src if pages is not None else ''} {r['c'].get('note', '')[:30]}")
if len(rows) > args.limit:
print(f" … {len(rows) - args.limit} more (raise --limit)")
if not out and not quiet:
print("No candidates: run `board.py add` or `board.py children` first")
return out