Rejeter proprement les tuiles 100 % nodata en détection d'anomalies

This commit is contained in:
Antoine Jacquin
2026-09-18 21:07:32 +02:00
parent 4c8fa68f71
commit 4cdbf5a0e4

View File

@ -1550,7 +1550,11 @@ def generate_anomaly_mask(dem_file, basename, vis_dir, resolution, shared=None,
# With n_sigma=2.0 → 80th percentile: keep only the top 20% of signal.
# This adapts to each tile's terrain instead of a fixed z-score cutoff.
threshold_pct = max(50, min(95, 100 - n_sigma * 10))
threshold_val = np.percentile(combined[~nan_mask], threshold_pct)
combined_valid = combined[~nan_mask]
if combined_valid.size == 0:
logger.warning(" ✗ Détection anomalies : tuile 100 % nodata")
return None
threshold_val = np.percentile(combined_valid, threshold_pct)
combined = np.clip(combined - threshold_val, 0, None)
# Rescale survivors to 0–1