From aa21e56a96502de23b825a0fc6483fa0a85b8f83 Mon Sep 17 00:00:00 2001
From: "raffaele.gaetano" <raffaele.gaetano@cirad.fr>
Date: Fri, 6 Jan 2023 11:35:57 +0100
Subject: [PATCH] ENH: add compress option to SPOT67 preprocessing

---
 moringa.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/moringa.py b/moringa.py
index 7883894..25fecbe 100755
--- a/moringa.py
+++ b/moringa.py
@@ -10,16 +10,16 @@ def run_segmentation(img, threshold, cw, sw , out_seg,
     VHR.segmentation.lsgrm(img,params,out_seg,n_proc,memory,None,remove_graph,force_parallel)
     return
 
-def preprocess_spot67(in_fld, out_fld, dem_fld, geoid_file, skip_ps):
+def preprocess_spot67(in_fld, out_fld, dem_fld, geoid_file, skip_ps, compress):
     sp = VHR.vhrbase.SPOT67RasterPipeline(in_fld)
     sp.to_toa()
     sp.orthorectify(dem_fld, geoid_file)
     if not skip_ps:
-        sp.write_outputs(out_fld, update_pipe=True)
+        sp.write_outputs(out_fld, update_pipe=True, compress=compress)
         sp.pansharp()
-        sp.write_outputs(out_fld)
+        sp.write_outputs(out_fld, compress=compress)
     else:
-        sp.write_outputs(out_fld)
+        sp.write_outputs(out_fld, compress=compress)
     return
 
 def main(args):
@@ -51,6 +51,7 @@ def main(args):
     vhrprep.add_argument("dem_fld", type=str, help="Path to the folder containing DEM covering the scene in WGS84 projection.")
     vhrprep.add_argument("geoid", type=str, help="Path to the geoid file.")
     vhrprep.add_argument("--skip_ps", help="Skip pansharpening step.", action='store_true')
+    vhrprep.add_argument("--compress", help="Use lossless compresion on outputs.", action='store_true')
 
 
 
@@ -68,7 +69,7 @@ def main(args):
                          arg.n_proc, arg.mem_limit, not arg.keep_graph, arg.force_parallel)
 
     if arg.cmd == "preprocess_spot67":
-        preprocess_spot67(arg.fld, arg.out_fld, arg.dem_fld, arg.geoid, arg.skip_ps)
+        preprocess_spot67(arg.fld, arg.out_fld, arg.dem_fld, arg.geoid, arg.skip_ps, arg.compress)
 
     return 0
 
-- 
GitLab