Commit 2a06d3aa authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

ENH: Add possibility to integrate Sen2Cor options.

parent c18ee24e
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment