diff --git a/lidar_pipeline/dtm.py b/lidar_pipeline/dtm.py index eb8f4be..be7e613 100644 --- a/lidar_pipeline/dtm.py +++ b/lidar_pipeline/dtm.py @@ -803,7 +803,12 @@ def create_dtm_fast(las_file, basename, dtm_dir, resolution, force=False, if bare_earth and source_laz is not None: min_grid = _min_return_grid(source_laz, width, height, (min_x, min_y, max_x, max_y)) - lower = ~np.isnan(min_grid) & (min_grid < dtm) + # Cellules sans sol mesuré (NaN) : le retour le plus bas devient + # la mesure — sinon la comparaison NaN est fausse et la cellule + # retombe sur l'interpolation en fin de passe. + has_min = ~np.isnan(min_grid) + lower = has_min & (min_grid < dtm) + lower |= has_min & np.isnan(dtm) dtm = np.where(lower, min_grid, dtm) logger.info(f" Sol nu : {int(lower.sum()):,} cellules raménées au retour le plus bas")