Skip to content
Snippets Groups Projects
Commit 293593f9 authored by Aurelien Chauvigne's avatar Aurelien Chauvigne
Browse files

add configuration file as requested argument

parent 5c7e7d9d
No related branches found
No related tags found
No related merge requests found
......@@ -87,10 +87,11 @@ For concentration conversion, parameters are needed in algo/ptrms_lib/conf/conf_
```
* For a a list of files
Usage: python3 src/converter/PtrmsConverter.py [options] <infiles>
Usage: python3 src/converter/PtrmsConverter.py [options] <conf-file> <infiles>
Args:
<infiles> : list of files to process
<conf-file> : path of the configuration file
Options:
-h, --help show this help message and exit
......@@ -98,8 +99,6 @@ Options:
Process only this product. All by default
-o OUT_DIR, --out_dir=OUT_DIR
force a specific output directory
-c CONF, --configuration-file=CONF
Full path of the configuration file
-d CACHE_DIR, --cache_dir=CACHE_DIR
Directory of the temporary files
......
......@@ -578,11 +578,12 @@ class PtrmsConverter(Converter.Converter):
"""
parser = OptionParser()
parser.usage = "python3 " + app + ".py [options] <infiles>" + os.linesep
parser.usage = "python3 " + app + ".py [options] <conf-file> <infiles>" + os.linesep
parser.usage += os.linesep
parser.usage += "with :" + os.linesep
parser.usage += (
"\t<infiles> full path to the trace gazes file(s) to convert" + os.linesep
"\t<infiles> full path to the trace gazes file(s) to convert" + os.linesep +
"\t<conf-file> full path of the configuration file" + os.linesep
)
parser.add_option(
......@@ -605,15 +606,6 @@ class PtrmsConverter(Converter.Converter):
help="Output directory",
)
parser.add_option(
"-c",
"--configuration-file",
action="store",
type="str",
dest="conf",
help="Full path of the configuration file",
)
parser.add_option(
"-d",
"--cache_dir",
......@@ -625,22 +617,23 @@ class PtrmsConverter(Converter.Converter):
)
infiles = [sys.argv[-1]]
conf = sys.argv[-2]
# check the number of command line arguments
if len(sys.argv) < 1:
if len(sys.argv) < 2:
parser.print_help()
raise ValueError("Missing command-line options")
raise ValueError("Missing command-line arguments")
return infiles, parser.parse_args()
return infiles, conf, parser.parse_args()
def main():
SRC_DIR = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", ".."
)
infiles, (options, arg) = PtrmsConverter.get_parser(__APP__, SRC_DIR)
infiles, conf, (options, arg) = PtrmsConverter.get_parser(__APP__, SRC_DIR)
prog = PtrmsConverter(options.prod_id)
prog.process(infiles, options.conf, options.cache_dir, options.outdir, levels=[1])
prog.process(infiles, conf, options.cache_dir, options.outdir, levels=[1])
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment