From 2dd8662fc8232b12b496f25ed0d91c659bfe6cf5 Mon Sep 17 00:00:00 2001 From: Eric Bryant Date: Wed, 9 Jan 2019 19:37:52 -0500 Subject: [PATCH] Sort nearmisspoints.log by region --- siteupdate/python-teresco/siteupdate.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/siteupdate/python-teresco/siteupdate.py b/siteupdate/python-teresco/siteupdate.py index 85f4ab54..8141d161 100755 --- a/siteupdate/python-teresco/siteupdate.py +++ b/siteupdate/python-teresco/siteupdate.py @@ -2242,13 +2242,14 @@ def run(self): # read in fp file nmpfplist = [] nmpfpfile = open(args.highwaydatapath+'/nmpfps.log','r') -nmpfilelines = nmpfpfile.readlines() -for line in nmpfilelines: +nmpfpfilelines = nmpfpfile.readlines() +for line in nmpfpfilelines: if len(line.rstrip('\n ')) > 0: nmpfplist.append(line.rstrip('\n ')) nmpfpfile.close() -nmpfile = open(args.logfilepath+'/nearmisspoints.log','w') +nmploglines = [] +nmplog = open(args.logfilepath+'/nearmisspoints.log','w') nmpnmp = open(args.logfilepath+'/tm-master.nmp','w') for w in all_waypoints.point_list(): if w.near_miss_points is not None: @@ -2287,15 +2288,21 @@ def run(self): extra_field += "LI" if extra_field != "": extra_field = " " + extra_field - nmpfile.write(nmpline.rstrip() + '\n') + nmploglines.append(nmpline.rstrip()) - # write actual lines to nmp file, indicating FP and/or LI + # write actual lines to .nmp file, indicating FP and/or LI # for marked FPs or looks intentional items for nmpnmpline in nmpnmplines: nmpnmp.write(nmpnmpline + extra_field + "\n") -nmpfile.close() nmpnmp.close() +# sort and write actual lines to nearmisspoints.log +nmploglines.sort() +for n in nmploglines: + nmplog.write(n + '\n') +nmploglines = None +nmplog.close() + # report any unmatched nmpfps.log entries nmpfpsunmatchedfile = open(args.logfilepath+'/nmpfpsunmatched.log','w') for line in nmpfplist: