Ran linter.

This commit is contained in:
Felix Delattre 2026-06-11 16:33:14 +02:00
parent 49ad6bcaab
commit d29754e4a5
6 changed files with 186 additions and 84 deletions

View file

@ -121,12 +121,16 @@ def repair(site_dir: Path) -> None:
refl_path.unlink(missing_ok=True)
n_removed += 1
print(f"[repair] {name}: removed {n_removed} minority-shape file-sets (kept {ref_shape[0]}×{ref_shape[1]})")
print(
f"[repair] {name}: removed {n_removed} minority-shape file-sets (kept {ref_shape[0]}×{ref_shape[1]})"
)
# --- 3. Remove stale GCC files from prepared/s2 ---------------------------
gcc_removed = sum(1 for f in s2_dir.glob("*_GCC.tif") if f.unlink() or True)
if gcc_removed:
print(f"[repair] {name}: removed {gcc_removed} stale GCC files from prepared/s2")
print(
f"[repair] {name}: removed {gcc_removed} stale GCC files from prepared/s2"
)
# --- 4. Wipe stale S3 composites ------------------------------------------
for d in (s3_out, gcc_s3_out):
@ -136,15 +140,21 @@ def repair(site_dir: Path) -> None:
# --- 5. Regenerate S3 composites with the correct reference ---------------
if not s3_raw.exists() or not any(s3_raw.glob("S3*.tif")):
print(f"[repair] {name}: WARNING — no raw S3 data in {s3_raw}; skipping S3 regeneration.")
print(
f"[repair] {name}: WARNING — no raw S3 data in {s3_raw}; skipping S3 regeneration."
)
return
s2_refl_path = next(iter(sorted(s2_dir.glob("*_REFL.tif"))), None)
if s2_refl_path is None:
print(f"[repair] {name}: WARNING — no REFL files left; cannot regenerate S3 composites.")
print(
f"[repair] {name}: WARNING — no REFL files left; cannot regenerate S3 composites."
)
return
print(f"[repair] {name}: regenerating S3 composites (reference: {s2_refl_path.name})...")
print(
f"[repair] {name}: regenerating S3 composites (reference: {s2_refl_path.name})..."
)
step3 = _load_step3()
s3_out.mkdir(parents=True, exist_ok=True)
step3._prepare_s3(s3_raw, s2_refl_path, s3_out)