fimeval 0.1.46__tar.gz → 0.1.48__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.1
2
2
  Name: fimeval
3
- Version: 0.1.46
3
+ Version: 0.1.48
4
4
  Summary: A Framework for Automatic Evaluation of Flood Inundation Mapping Predictions Evaluation
5
5
  License: GPLv3
6
6
  Author: Surface Dynamics Modeling Lab
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "fimeval"
3
- version = "0.1.46"
3
+ version = "0.1.48"
4
4
  description = "A Framework for Automatic Evaluation of Flood Inundation Mapping Predictions Evaluation"
5
5
  authors = [
6
6
  "Surface Dynamics Modeling Lab",
@@ -352,7 +352,7 @@ def EvaluationWithBuildingFootprint(
352
352
  method_path, "BoundaryforEvaluation", "FIMEvaluatedExtent.shp"
353
353
  )
354
354
  else:
355
- boundary = detect_shapefile(folder)
355
+ boundary = detect_shapefile(os.path.join(main_dir, folder))
356
356
 
357
357
  building_footprintMS = building_footprint
358
358
  if building_footprintMS is None:
@@ -333,7 +333,16 @@ def evaluateFIM(
333
333
  print(f"Evaluation metrics saved to {csv_file}")
334
334
  return results
335
335
 
336
-
336
+ #Safely deleting the folder
337
+ def safe_delete_folder(folder_path):
338
+ try:
339
+ shutil.rmtree(folder_path)
340
+ except PermissionError:
341
+ print(f"Permission denied: Could not delete {folder_path}")
342
+ except FileNotFoundError:
343
+ print(f"Folder not found: {folder_path}")
344
+ except Exception as e:
345
+ print(f"Error deleting {folder_path}: {e}")
337
346
 
338
347
  def EvaluateFIM(main_dir, method_name, output_dir, PWB_dir=None, shapefile_dir=None, target_crs=None, target_resolution=None):
339
348
  main_dir = Path(main_dir)
@@ -384,12 +393,12 @@ def EvaluateFIM(main_dir, method_name, output_dir, PWB_dir=None, shapefile_dir=N
384
393
  if TIFFfiles_main_dir:
385
394
  MakeFIMsUniform(main_dir, target_crs=target_crs, target_resolution=target_resolution)
386
395
 
387
- #processing folder
396
+ # processing folder
388
397
  processing_folder = main_dir / "processing"
389
398
  TIFFfiles = list(processing_folder.glob("*.tif"))
390
399
 
391
400
  process_TIFF(TIFFfiles, main_dir)
392
- shutil.rmtree(processing_folder)
401
+ safe_delete_folder(processing_folder)
393
402
  else:
394
403
  for folder in main_dir.iterdir():
395
404
  if folder.is_dir():
@@ -397,13 +406,12 @@ def EvaluateFIM(main_dir, method_name, output_dir, PWB_dir=None, shapefile_dir=N
397
406
 
398
407
  if tif_files:
399
408
  MakeFIMsUniform(folder, target_crs=target_crs, target_resolution=target_resolution)
400
- #processing folder
409
+
401
410
  processing_folder = folder / "processing"
402
411
  TIFFfiles = list(processing_folder.glob("*.tif"))
403
412
 
404
413
  process_TIFF(TIFFfiles, folder)
405
- shutil.rmtree(processing_folder)
414
+ safe_delete_folder(processing_folder)
406
415
  else:
407
- print(
408
- f"Skipping {folder.name} as it doesn't contain any tif files."
409
- )
416
+ print(f"Skipping {folder.name} as it doesn't contain any tif files.")
417
+
File without changes
File without changes
File without changes