diff --git a/pyglance/glance/compare.py b/pyglance/glance/compare.py index 91cfaac534322e8f38a3287f2616b9f5b2d79db0..7567dec27b08ace0703fb5d679ceb6e1bc960123 100644 --- a/pyglance/glance/compare.py +++ b/pyglance/glance/compare.py @@ -1189,7 +1189,10 @@ glance inspectStats A.hdf try : lal = list(io.open(fn)()) lal.sort() - print fn + ': ' + ('\n ' + ' '*len(fn)).join(lal) + if options.parsable_output: + print "".join(map(lambda x: fn+"\t"+x+"\n", lal)) + else: + print fn + ': ' + ('\n ' + ' '*len(fn)).join(lal) except KeyError : LOG.warn('Unable to open / process file selection: ' + fn) problems += 1 diff --git a/pyglance/glance/config_organizer.py b/pyglance/glance/config_organizer.py index 482117c567ad0af943a114fbe7dadb808ccb099e..9780e3e4c1c5626b4ac85cdd107acb56a686d172 100644 --- a/pyglance/glance/config_organizer.py +++ b/pyglance/glance/config_organizer.py @@ -476,6 +476,9 @@ def set_up_command_line_options (parser) : parser.add_option('-f', '--fork', dest=DO_MAKE_FORKS_KEY, action="store_true", default=False, help="start multiple processes to create images in parallel") + parser.add_option('--parsable', dest=PARSABLE_OUTPUT_KEY, + action="store_true", default=False, help="format output to be programmatically parsed. 'info' only") + def convert_options_to_dict (options) : """ convert the command line options structure created in compare.py into a dictionary of values @@ -535,4 +538,4 @@ if __name__=='__main__': LOG.info("Currently no tests are configured for this module.") - sys.exit(0) \ No newline at end of file + sys.exit(0) diff --git a/pyglance/glance/constants.py b/pyglance/glance/constants.py index abdc8cb39652c72a893f4efa66c237b992f66d2f..0e2ad0591a46ce88e1cd8387345b680334805db4 100644 --- a/pyglance/glance/constants.py +++ b/pyglance/glance/constants.py @@ -24,6 +24,7 @@ DO_IMAGES_ONLY_ON_FAIL_KEY = 'only_plot_on_fail' USE_NO_LON_OR_LAT_VARS_KEY = 'noLonLatVars' SHORT_CIRCUIT_DIFFS_KEY = 'short_circuit_diffs' USE_CUSTOM_PROJ_KEY = 'use_custom_projection' +PARSABLE_OUTPUT_KEY = 'parsable_output' # constants related to storing information from the run