changeset 24:6df2f6dcc809

fixed interval creation bug, made result better for clipping
author Henry Thompson <ht@markup.co.uk>
date Sat, 29 May 2021 21:29:08 +0100
parents 1670a33e3e6d
children 0bbeb01a7681
files safe.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/safe.py	Sat May 29 11:07:34 2021 +0100
+++ b/safe.py	Sat May 29 21:29:08 2021 +0100
@@ -48,6 +48,8 @@
     for k,yy in tc.items():
       tyy=[yy]
       ii=[]
+      if k==(108.5, -45.5):
+        pass
       while True:
         clean=True
         for j,yy in enumerate(tyy):
@@ -57,7 +59,7 @@
             clean=False
             for i in range(len(yy)-1):
               if yy[i]+1!=yy[i+1]:
-                ii+=(yy[0],yy[i])
+                ii.append((yy[0],yy[i]))
                 tyy=[yy[i+1:]]+tyy[j+1:]
             break
         if clean:
@@ -111,9 +113,13 @@
   print(c)
   if hits:
     print(' %s nearby landing columns'%len(hits))
+    done={}
     for k in sorted(hits.keys(),key=lambda k:k[1]):
-      aa,ll=hits[k]
-      print("%s@%0.1f: %s %s"%(k[0],k[1],sorted(list(aa)),sorted(list(ll))))
+      if k[0] not in done:
+        done[k[0]]=1
+        aa,ll=hits[k]
+        laa=sorted(list(aa))
+        print("(%s %s %s)@%0.1f: %s %s"%(k[0][0],laa[0][0],k[0][1],k[1],laa,sorted(list(ll))))
   else:
     print(' No nearby landing zones')