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

@ -61,9 +61,7 @@ def _import_efast():
return efast_module
except ImportError as exc:
raise ImportError(
"efast not found. Install with: uv sync"
) from exc
raise ImportError("efast not found. Install with: uv sync") from exc
# ---------------------------------------------------------------------------
@ -174,7 +172,9 @@ def fuse_site(sitename: str, year: int) -> dict[str, Any]:
s2_dir = DATA_DIR / "sentinel_data" / str(year) / sitename / "prepared" / "s2"
s3_dir = DATA_DIR / "sentinel_data" / str(year) / sitename / "prepared" / "s3"
gcc_s3_dir = DATA_DIR / "sentinel_data" / str(year) / sitename / "prepared" / "gcc_s3"
gcc_s3_dir = (
DATA_DIR / "sentinel_data" / str(year) / sitename / "prepared" / "gcc_s3"
)
base = DATA_DIR / "fusion" / str(year) / sitename
if not s2_dir.is_dir() or not any(s2_dir.glob("*_REFL.tif")):
@ -228,11 +228,15 @@ def fuse_site(sitename: str, year: int) -> dict[str, Any]:
print(f"[{sitename}] ItB: fusing GCC over {len(fusion_dates)} dates...")
for date in fusion_dates:
efast.fusion(date, gcc_s3_dir, s2_dir, itb_fusion, product="GCC", **_fusion_kwargs)
efast.fusion(
date, gcc_s3_dir, s2_dir, itb_fusion, product="GCC", **_fusion_kwargs
)
# --- BtI: fuse reflectance (3-band, matching S2 B02/B03/B04), then derive GCC ---
# S3 composites have 4 bands; strip band 4 (Oa17/NIR) so shapes match S2 REFL.
s3_rgb_dir = DATA_DIR / "sentinel_data" / str(year) / sitename / "prepared" / "s3_rgb"
s3_rgb_dir = (
DATA_DIR / "sentinel_data" / str(year) / sitename / "prepared" / "s3_rgb"
)
s3_rgb_dir.mkdir(parents=True, exist_ok=True)
for p in sorted(s3_dir.glob("composite_*.tif")):
out = s3_rgb_dir / p.name
@ -250,7 +254,9 @@ def fuse_site(sitename: str, year: int) -> dict[str, Any]:
print(f"[{sitename}] BtI: fusing REFL over {len(fusion_dates)} dates...")
for date in fusion_dates:
efast.fusion(date, s3_rgb_dir, s2_dir, bti_fusion, product="REFL", **_fusion_kwargs)
efast.fusion(
date, s3_rgb_dir, s2_dir, bti_fusion, product="REFL", **_fusion_kwargs
)
print(f"[{sitename}] BtI: deriving GCC from fused REFL...")
compute_gcc_from_refl(bti_fusion, bti_gcc)
@ -318,7 +324,9 @@ def main(argv: list[str] | None = None) -> int:
for i, sitename in enumerate(sites, 1):
fusion_dir = DATA_DIR / "fusion" / str(year) / sitename
if args.skip_blended and fusion_dir.exists():
print(f"[Fusion] ({i}/{len(sites)}) {sitename} — skipping (fusion directory exists)")
print(
f"[Fusion] ({i}/{len(sites)}) {sitename} — skipping (fusion directory exists)"
)
continue
print(f"[Fusion] ({i}/{len(sites)}) {sitename}")
summary = fuse_site(sitename, year)