This commit is contained in:
Felix Delattre 2026-06-11 00:38:27 +02:00
parent 8683624557
commit 79ee099809
2 changed files with 7 additions and 4 deletions

View file

@ -667,9 +667,12 @@ def _s3_reflectance_scale(raw_s3_dir: Path) -> float:
"""Return multiplier that maps raw SYN L2 SDR values to 01 reflectance."""
for path in raw_s3_dir.glob("S3*.tif"):
with rasterio.open(path) as src:
mx = float(np.nanmax(src.read()))
if np.isfinite(mx) and mx > 5:
return 1.0 / S3_REFLECTANCE_SCALE
data = src.read()
if not np.any(np.isfinite(data)):
continue
mx = float(np.nanmax(data))
if np.isfinite(mx) and mx > 5:
return 1.0 / S3_REFLECTANCE_SCALE
return 1.0