2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-20 23:15:22 +00:00

x/y distances between explicit data and survey points

This commit is contained in:
2023-10-11 01:03:28 +03:00
parent 973f9bedd5
commit d6a3006444
6 changed files with 105 additions and 60 deletions

View File

@@ -34,7 +34,7 @@ class MapLocations(object):
We don't need these map locations any more ?!
They would only be used in addition to entrances going onto a map display"""
p = [
fp = [
("laser.0_7", "BNase", "Reference", "Bräuning Nase laser point"),
("226-96", "BZkn", "Reference", "Bräuning Zinken trig point"),
("vd1", "VD1", "Reference", "VD1 survey point"),
@@ -48,13 +48,15 @@ class MapLocations(object):
("laser.0_5", "LSR5", "Reference", "Laser Point 0/5"),
("225-96", "BAlm", "Reference", "Bräuning Alm trig point"),
] # 12 fixed points
p = []
def points(self):
prior = len(self.p)
for ent in Entrance.objects.all():
for st, ent_type in {ent.exact_station: "exact", ent.other_station: "other", ent.tag_station: "tag"}.items():
if st != "":
self.p.append((st, str(ent), ent.needs_surface_work(), str(ent)))
self.p.append((st, str(ent), ent.needs_surface_work(), ent))
store_data_issues()
found = len(self.p) - prior
message = f" - {found} Entrance tags found - not yet validated against survex .pos file."
@@ -70,9 +72,10 @@ def validate_entrance_stations(ent=None):
"""
bads = 0
good = 0
url="/caves" # fallback
def tag_lower_case(station):
nonlocal url
so = SurvexStation.objects.filter(name=station.lower())
if so.count() == 1:
message = f"X - Entrance {ent} station '{station}' should be '{station.lower()}'"
@@ -104,29 +107,31 @@ def validate_entrance_stations(ent=None):
continue
try:
so = SurvexStation.objects.filter(name=st)
if so.count() == 1:
good +=1
# print(f"OK - Entrance {ent} '{ent_type}' station '{st}'")
continue
if so.count() != 0:
message =f"{so.count()} found for Entrance {ent} '{ent_type}' station '{st}' {so}"
else:
message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'"
if st == ent.best_station():
message = message + " - AND THIS IS THE 'BEST' ONE"
else:
message = message + " - not the 'best'"
stash_data_issue(parser="positions", message=message, url=url)
print(message)
bads +=1
tag_lower_case(st)
continue
except:
message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'. EXCEPTION."
stash_data_issue(parser="positions", message=message, url=url)
print(message)
bads +=1
continue
if so.count() == 1:
good +=1
# print(f"OK - Entrance {ent} '{ent_type}' station '{st}'")
continue
if so.count() != 0:
message =f"{so.count()} found for Entrance {ent} '{ent_type}' station '{st}' {so}"
else:
message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'"
if st == ent.best_station():
message = message + " - AND THIS IS THE 'BEST' ONE"
else:
message = message + " - not the 'best'"
stash_data_issue(parser="positions", message=message, url=url)
print(message)
bads +=1
tag_lower_case(st)
continue
if ent:
return validate_ent(ent)
@@ -255,8 +260,10 @@ def LoadPositions():
mappoints = {}
for pt in MapLocations().points():
svxid, number, point_type, label = pt
mappoints[svxid] = True
svxid, number, point_type, ent = pt
#((st, str(ent), ent.needs_surface_work(), ent))
mappoints[svxid] = ent
if svxid =="1":
print(f"BOGUS {pt}") # this is now checked for when importing the entrance tags in parsers/caves.py
@@ -294,6 +301,7 @@ def LoadPositions():
ss.x = float(x)
ss.y = float(y)
ss.z = float(z)
ss.entrance = mappoints[sid]
ss.save()
found += 1
except: