Fix bugs and improve pipeline flexibility

- Fix gpu_cleanup import missing in visualizations.py (NameError in workers)
- Fix t_pdf referenced before assignment when PDF is skipped
- Skip classification+DTM when DTM exists regardless of --force
- --force now only regenerates WebP/PDF, not classification/DTM
- --force-classification forces reclassification when needed
- Add laspy repair fallback for corrupt LAZ files (EVLR errors)
- Keep DTM TIF by default for reuse (--no-keep-tif to delete)
- Increase space between image and bottom cartouche (0.12→0.19)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jacquin Antoine
2026-05-14 00:08:25 +02:00
parent 5b74322077
commit eac482874d
7 changed files with 74 additions and 25 deletions

View File

@ -275,9 +275,11 @@ class LidarArchaeoPipeline:
logger.info(f"FICHIER : {basename}")
logger.info("=" * 60)
# Skip ground classification + DTM if DTM already exists (unless --force)
# Skip ground classification + DTM if DTM already exists
# --force only affects visualizations/PDF, not classification/DTM
# Use --force-classification to force reclassification
dtm_path = self.dtm_dir / f"{basename}_dtm.tif"
if dtm_path.exists() and not self.force:
if dtm_path.exists():
logger.info("[1/5] Classification du sol — sautée (DTM existant)")
logger.info("[2/5] Génération DTM — sautée (DTM existant)")
dtm_file = dtm_path
@ -297,7 +299,7 @@ class LidarArchaeoPipeline:
# Step 2: Generate DTM
logger.info("[2/5] Génération DTM...")
t2 = time.time()
dtm_file = create_dtm_fast(las_file, basename, self.dtm_dir, self.resolution, force=self.force)
dtm_file = create_dtm_fast(las_file, basename, self.dtm_dir, self.resolution)
t_dtm = time.time() - t2
if not dtm_file:
logger.error(f" ✗ Échec DTM ({t_dtm:.1f}s)")
@ -309,6 +311,7 @@ class LidarArchaeoPipeline:
self.generate_all_visualizations(dtm_file, basename)
# Step 4: PDF report
t_pdf = 0
file_vis_dir = self.vis_dir / basename
pdf_file = self.pdf_dir / f"{basename}_rapport.pdf"
if pdf_file.exists() and not self.force:
@ -320,10 +323,8 @@ class LidarArchaeoPipeline:
t_pdf = time.time() - t4
logger.info(f" ✓ Rapport PDF terminé ({t_pdf:.1f}s)")
# Step 5: Clean up DTM TIF unless --keep-tif
if not self.keep_tif:
for dtm_file in sorted(self.dtm_dir.glob(f"{basename}_dtm.tif")):
dtm_file.unlink(missing_ok=True)
# Step 5: Keep DTM TIF for reuse (regenerating WebPs skips classification)
# Use --no-keep-tif to delete DTM files after processing
t_total = time.time() - t_start
logger.info(f"{basename} terminé en {t_total:.1f}s")