From 1e35deac8fc248cb9a2a25e383604fd433480720 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Tue, 24 Sep 2019 15:21:42 -0500 Subject: update zdab-reprocess to be able to handle more filenames --- utils/zdab-reprocess | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'utils/zdab-reprocess') diff --git a/utils/zdab-reprocess b/utils/zdab-reprocess index 53c7a0d..172e110 100755 --- a/utils/zdab-reprocess +++ b/utils/zdab-reprocess @@ -352,7 +352,8 @@ if __name__ == '__main__': parser.add_argument("--suffix", default="reprocessed", help="suffix appended to output filename") args = parser.parse_args() - filename_re = "SNOCR_(\d+)_\d+_p\d+.xzdab" + filename_re = "(SNOCR_|SNO)(\d+)_(\w+).(x?zdab)" + p = re.compile(filename_re) template = MyTemplate(SNOMAN_TEMPLATE) @@ -365,15 +366,17 @@ if __name__ == '__main__': print("Unable to parse filename '%s'" % tail) sys.exit(1) + prefix, run, tail, ext = match.groups() + try: - run = int(match.group(1)) + run = int(run) except Exception as e: print("Unable to convert run number to int: %s" % str(e)) sys.exit(1) root, ext = splitext(tail) - output = "%s_%s.xzdab" % (root,args.suffix) + output = "%s_%s.%s" % (root,args.suffix,ext) if args.dir: output = os.path.join(args.dir,output) -- cgit