Call l2bin with Python
Posted: Thu Nov 11, 2021 2:23 pm America/New_York
Hello,
Apologies if this question appears twice - it's not clear if the initial submission went through.
I have some questions re. the mechanics of calling SeaDAS functions from Python code. I am currently working with l2bin, so I'll tailor my questions to that:
Q1: I have written a Python wrapper function for l2bin that I call from other Python code which allows me to call l2bin and pass it arguments. What is the proper way to call SeaDAS functions from Python code? I currently do the following:
cmdInL2 = 'ifile='+inL2File
cmdOutL3 = 'ofile='+outL3File
cmdRes = 'resolution=Q'
cmdProd = 'l3bprod=chlor_a'
cmd = ['l2bin', cmdInL2, cmdOutL3, cmdRes, cmdProd]
subprocess.run(cmd)
Is there a more straightforward way than using the subprocess module?
Q2: Can I specify all of the l2bin arguments (e.g. input file(s), resolution, products) in a single parameter file (e.g. par.txt) that I pass to l2bin in this call: "l2bin par=par.txt"? Can the parameter file even contain the output file? How are l2bin arguments defined that aren't specified by the user through the command line or a user parameter file (e.g. are there default values or a sensor-specific parameter file that also gets called to cover any arguments not defined by the user)?
Thanks!
Mike
Apologies if this question appears twice - it's not clear if the initial submission went through.
I have some questions re. the mechanics of calling SeaDAS functions from Python code. I am currently working with l2bin, so I'll tailor my questions to that:
Q1: I have written a Python wrapper function for l2bin that I call from other Python code which allows me to call l2bin and pass it arguments. What is the proper way to call SeaDAS functions from Python code? I currently do the following:
cmdInL2 = 'ifile='+inL2File
cmdOutL3 = 'ofile='+outL3File
cmdRes = 'resolution=Q'
cmdProd = 'l3bprod=chlor_a'
cmd = ['l2bin', cmdInL2, cmdOutL3, cmdRes, cmdProd]
subprocess.run(cmd)
Is there a more straightforward way than using the subprocess module?
Q2: Can I specify all of the l2bin arguments (e.g. input file(s), resolution, products) in a single parameter file (e.g. par.txt) that I pass to l2bin in this call: "l2bin par=par.txt"? Can the parameter file even contain the output file? How are l2bin arguments defined that aren't specified by the user through the command line or a user parameter file (e.g. are there default values or a sensor-specific parameter file that also gets called to cover any arguments not defined by the user)?
Thanks!
Mike