56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
"""Run full-season gap-degraded NSE_PC for all thesis sites (best BtI scenario)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
from gap_validation.batch_spatial import (
|
|
PRIMARY_SEASON,
|
|
_best_bti_from_metrics,
|
|
_parse_scenario,
|
|
_site_positions,
|
|
)
|
|
from gap_validation.temporal_pc import run_temporal_pc
|
|
|
|
|
|
def main() -> None:
|
|
ap = argparse.ArgumentParser(description="Batch temporal gap NSE_PC (six sites).")
|
|
ap.add_argument("--data-dir", type=Path, default=Path("data"))
|
|
ap.add_argument("--sites-geojson", type=Path, default=Path("data/sites.geojson"))
|
|
ap.add_argument("--skip-fusion", action="store_true")
|
|
ap.add_argument("--gap-days", type=int, action="append")
|
|
args = ap.parse_args()
|
|
positions = _site_positions(args.sites_geojson)
|
|
|
|
for site, season in sorted(PRIMARY_SEASON.items()):
|
|
pos = positions.get(site)
|
|
if not pos:
|
|
print(f"[skip] No coordinates for {site}")
|
|
continue
|
|
metrics_path = args.data_dir / site / str(season) / "metrics.json"
|
|
scenario_key = _best_bti_from_metrics(metrics_path)
|
|
if not scenario_key:
|
|
print(f"[skip] {site} {season}: no metrics.json")
|
|
continue
|
|
strategy, sigma, mode = _parse_scenario(scenario_key)
|
|
sigma_kw = 30 if sigma == 30 else None
|
|
print(f"=== {site} {season} temporal {scenario_key} ===")
|
|
out = run_temporal_pc(
|
|
site,
|
|
season,
|
|
pos,
|
|
strategy,
|
|
sigma_kw,
|
|
mode,
|
|
skip_manifest=False,
|
|
skip_fusion=args.skip_fusion,
|
|
gap_days_filter=args.gap_days,
|
|
transition_filter=None,
|
|
s2_calendar_strategy=strategy,
|
|
)
|
|
print(out)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|