foo
This commit is contained in:
parent
e3af4bf2f4
commit
bfd5d73dff
6 changed files with 760 additions and 61 deletions
|
|
@ -7,8 +7,9 @@ from pathlib import Path
|
|||
|
||||
from gap_validation.batch_spatial import (
|
||||
PRIMARY_SEASON,
|
||||
_best_bti_from_metrics,
|
||||
_best_from_metrics,
|
||||
_parse_scenario,
|
||||
_resolve_workflows,
|
||||
_site_positions,
|
||||
)
|
||||
from gap_validation.temporal_pc import run_temporal_pc
|
||||
|
|
@ -19,9 +20,16 @@ def main() -> None:
|
|||
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(
|
||||
"--workflow",
|
||||
choices=["bti", "itb", "both"],
|
||||
default="both",
|
||||
help="Fusion workflow(s) to validate (default: both best BtI and best ItB).",
|
||||
)
|
||||
ap.add_argument("--gap-days", type=int, action="append")
|
||||
args = ap.parse_args()
|
||||
positions = _site_positions(args.sites_geojson)
|
||||
workflows = _resolve_workflows(args.workflow)
|
||||
|
||||
for site, season in sorted(PRIMARY_SEASON.items()):
|
||||
pos = positions.get(site)
|
||||
|
|
@ -29,27 +37,28 @@ def main() -> None:
|
|||
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)
|
||||
for workflow in workflows:
|
||||
scenario_key = _best_from_metrics(metrics_path, workflow)
|
||||
if not scenario_key:
|
||||
print(f"[skip] {site} {season}: no metrics.json / {workflow} scenarios")
|
||||
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__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue