Merge 'search_string' and 'directory' command line options into a single 'files' option.

Fri, 22 Sep 2017 10:13:17 +0300

author
Victor Nicolae <victor.nicolae@inoe.ro>
date
Fri, 22 Sep 2017 10:13:17 +0300
changeset 74
2df1e214e235
parent 73
6c06efef397c
child 75
33826498a125

Merge 'search_string' and 'directory' command line options into a single 'files' option.

atmospheric_lidar/scripts/licel2scc.py file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/scripts/licel2scc.py	Sat Sep 09 11:25:42 2017 +0300
+++ b/atmospheric_lidar/scripts/licel2scc.py	Fri Sep 22 10:13:17 2017 +0300
@@ -74,9 +74,8 @@
     # Define the command line argument
     parser = argparse.ArgumentParser(description="A program to convert Licel binary files to the SCC NetCDF format.")
     parser.add_argument("parameter_file", help="The path to a parameter file linking licel and SCC channels.")
-    parser.add_argument("directory", nargs='?', help="Directory containing licel files (default '.')", default='.')
-    parser.add_argument("search_string", nargs='?', help="Search string for files in directory (default '*.*')",
-                        default="*.*")
+    parser.add_argument("files", nargs='?', help="Location of licel files. Use relative path and filename wildcards. (default './*.*')",
+                        default="./*.*")
     parser.add_argument("-i", '--id_as_name',
                         help="Use transient digitizer ids as channel names, instead of descriptive names",
                         action="store_true")
@@ -112,12 +111,11 @@
         sys.exit(0)
 
     # Get a list of files to convert
-    search_str = os.path.join(args.directory, args.search_string)
-    files = glob.glob(search_str)
+    files = glob.glob(args.files)
 
     if files:
         # Read the files
-        logger.info("Reading {0} files from {1}".format(len(files), args.directory))
+        logger.info("Reading {0} files from {1}".format(len(files), os.path.abspath(os.path.dirname(args.files))))
         CustomLidarMeasurement = create_custom_class(args.parameter_file, args.id_as_name, args.temperature,
                                                      args.pressure)
         measurement = CustomLidarMeasurement(files)

mercurial