From 0465cb36bf0c576db091df76c7e619facc4e6139 Mon Sep 17 00:00:00 2001
From: Raffaele Gaetano <raffaele.gaetano@cirad.fr>
Date: Wed, 24 Nov 2021 17:07:17 +0100
Subject: [PATCH] WIP: cannot remove files under Windows during processing.

---
 LandscapeStratificationMetric.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/LandscapeStratificationMetric.py b/LandscapeStratificationMetric.py
index 91f1b02..51cea51 100644
--- a/LandscapeStratificationMetric.py
+++ b/LandscapeStratificationMetric.py
@@ -492,8 +492,8 @@ class LandscapeStratification(QgsProcessingAlgorithm):
         processing.run('otb:ManageNoData', ND_app_parameters, context=context, feedback=feedback)
         setNoDataValue(LS_Strat, ndv)
 
-        os.remove(LS_Strat_pre)
-        os.remove(LS_Strat_norm)
+        #os.remove(LS_Strat_pre)
+        #os.remove(LS_Strat_norm)
 
         GRM_output_pre = os.path.join(tmp_folder,prefix+"LandStrat_map_pre.tif")
         GRM_app_parameters = {'in':LS_Strat, 'threshold':float(threshold), 'criterion':'bs', 'out':GRM_output_pre}
@@ -508,7 +508,7 @@ class LandscapeStratification(QgsProcessingAlgorithm):
                           'outcontext': os.path.join(output_folder, "outcontext.txt")}
         processing.run("otb:BandMathX", BMX_parameters, context=context, feedback=feedback)
         os.remove(os.path.join(output_folder, "outcontext.txt"))
-        os.remove(GRM_output_pre)
+        #os.remove(GRM_output_pre)
         setNoDataValue(GRM_output, 0)
 
         GRM_vec_output = os.path.join(output_folder,prefix+"LandscapeStratification.shp")
-- 
GitLab