From 2a06d3aa5cdbea7b0b35d930a20ab85a9044e52e Mon Sep 17 00:00:00 2001 From: "raffaele.gaetano" <raffaele.gaetano@cirad.fr> Date: Wed, 9 Jun 2021 11:31:52 +0200 Subject: [PATCH] ENH: Add possibility to integrate Sen2Cor options. --- runSen2Cor.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runSen2Cor.py b/runSen2Cor.py index 50f3443..67b02bb 100644 --- a/runSen2Cor.py +++ b/runSen2Cor.py @@ -5,8 +5,8 @@ import getopt import shutil from mtdUtils import queuedProcess -def runSen2Cor(fld, s2c_fld, nproc = 1): - basecmd = [s2c_fld + os.sep + 'bin' + os.sep + 'L2A_Process'] +def runSen2Cor(fld, s2c_fld, nproc = 1, options = []): + basecmd = [s2c_fld + os.sep + 'bin' + os.sep + 'L2A_Process'] + options lst = glob.glob(fld + os.sep + '*MSIL1C*.SAFE') cmdlist = [' '.join(basecmd + [l] + ['>', l.replace('.SAFE','.log')]) for l in lst] @@ -25,7 +25,7 @@ def runSen2Cor(fld, s2c_fld, nproc = 1): if __name__ == '__main__': if len(sys.argv) < 3: sys.exit( - 'Usage: python runSen2Cor.py [-n <number of parallel processes> def. 1] <Sen2Cor install folder> <folder containing S2 MSIL1C>\n' + 'Usage: python runSen2Cor.py [-n <number of parallel processes> def. 1] [-o <Sen2Cor options in a quote>] <Sen2Cor install folder> <folder containing S2 MSIL1C>\n' 'Ex. python runSen2Cor.py -n 12 /home/ocsol_data/_tools/Sen2Cor-02.05.05-Linux64 /home/ocsol_data/Montcuq/S2') else: try: @@ -33,9 +33,12 @@ if __name__ == '__main__': except getopt.GetoptError as err: print(str(err)) + options = [] nproc = 1 for opt, val in opts: if opt == '-n': nproc = int(val) + if opt == '-o': + options = val.split(' ') - runSen2Cor(args[1], args[0], nproc) + runSen2Cor(args[1], args[0], nproc, options) -- GitLab