50 lines
1.4 KiB
Bash
50 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Run from repository root.
|
|
# First run downloads two sheets only. Increase --limit after confirming overlays look sane.
|
|
|
|
python -m bgtopo_poc.cli inventory \
|
|
--config configs/blue_detector.yaml \
|
|
--out data/manifest.csv \
|
|
--limit 2
|
|
|
|
python -m bgtopo_poc.cli download \
|
|
--manifest data/manifest.csv \
|
|
--out-dir data/raw \
|
|
--out-manifest data/manifest_downloaded.csv \
|
|
--limit 2
|
|
|
|
python - <<'PY'
|
|
import pandas as pd
|
|
from pathlib import Path
|
|
m = pd.read_csv('data/manifest_downloaded.csv')
|
|
for _, r in m.iterrows():
|
|
sid = r['sheet_id']
|
|
Path('data/interim/candidates').mkdir(parents=True, exist_ok=True)
|
|
print(f"Scanning {sid}")
|
|
PY
|
|
|
|
while IFS=, read -r sheet_id map_url tif_url map_path tif_path; do
|
|
if [[ "$sheet_id" == "sheet_id" ]]; then continue; fi
|
|
python -m bgtopo_poc.cli detect \
|
|
--config configs/blue_detector.yaml \
|
|
--sheet-id "$sheet_id" \
|
|
--map "$map_path" \
|
|
--tif "$tif_path" \
|
|
--out-dir data/interim/candidates
|
|
|
|
python -m bgtopo_poc.cli overlay \
|
|
--tif "$tif_path" \
|
|
--candidates "data/interim/candidates/${sheet_id}_candidates.csv" \
|
|
--out "reports/overlays/${sheet_id}_overlay.png"
|
|
|
|
done < data/manifest_downloaded.csv
|
|
|
|
python -m bgtopo_poc.cli report \
|
|
--candidates data/interim/candidates/*_candidates.csv \
|
|
--overlays reports/overlays/*_overlay.png \
|
|
--out reports/poc_report.html
|
|
|
|
echo "Open reports/poc_report.html"
|