fixing bad splay detection

This commit is contained in:
Philip Sargent 2023-03-12 00:35:37 +00:00
parent 870b290726
commit b88b142332
6 changed files with 30 additions and 29 deletions

View File

@ -350,6 +350,10 @@ def svx(request, survex_file):
svxblocks = [] svxblocks = []
try: try:
svxblocksall = svxfile.survexblock_set.all() svxblocksall = svxfile.survexblock_set.all()
svxlength = 0.0
for b in svxblocksall:
svxlength += b.legslength
print(svxlength,b)
except AttributeError: # some survexfiles just *include files and have no blocks themselves except AttributeError: # some survexfiles just *include files and have no blocks themselves
svxblocksall = [] svxblocksall = []
else: else:
@ -366,6 +370,7 @@ def svx(request, survex_file):
"warning": warning, "warning": warning,
"has_3d": (Path(survexdatasetpath) / Path(survex_file + ".3d")).is_file(), "has_3d": (Path(survexdatasetpath) / Path(survex_file + ".3d")).is_file(),
"title": survex_file, "title": survex_file,
"svxlength": svxlength,
"svxblocks": svxblocks, "svxblocks": svxblocks,
"svxincludes": svxincludes, "svxincludes": svxincludes,
"difflist": difflist, "difflist": difflist,

View File

@ -497,9 +497,10 @@ class LoadingSurvex:
def LoadSurvexAlias(self, survexblock, line): def LoadSurvexAlias(self, survexblock, line):
# *alias station - .. # *alias station - ..
splayalias = re.match("(?i)station\s*\-\s*\.\.\s*$", line) splayalias = re.match("(?i)\s*station\s*\-\s*\.\.\s*$", line)
if splayalias: if splayalias:
self.flagsstar["splayalias"] = True self.flagsstar["splayalias"] = True
print(line)
else: else:
message = f"! Bad *ALIAS: '{line}' ({survexblock}) {survexblock.survexfile.path}" message = f"! Bad *ALIAS: '{line}' ({survexblock}) {survexblock.survexfile.path}"
print(self.insp + message) print(self.insp + message)
@ -697,6 +698,12 @@ class LoadingSurvex:
# skip all splay legs # skip all splay legs
try: try:
if "splayalias" in self.flagsstar:
if ls[datastar["from"]] == "-" or ls[datastar["to"]] == "-":
if debugprint:
print("Aliased splay in ", survexblock.survexfile.path)
return
if ls[datastar["from"]] == ".." or ls[datastar["from"]] == ".": if ls[datastar["from"]] == ".." or ls[datastar["from"]] == ".":
if debugprint: if debugprint:
print("Splay in ", survexblock.survexfile.path) print("Splay in ", survexblock.survexfile.path)
@ -705,15 +712,14 @@ class LoadingSurvex:
if debugprint: if debugprint:
print("Splay in ", survexblock.survexfile.path) print("Splay in ", survexblock.survexfile.path)
return return
if self.flagsstar["splayalias"]:
if ls[datastar["from"]] == "-": if ls[datastar["to"]] == "-":
if debugprint: message = f" ! Suspected splay, not declared, in line {ls} in {survexblock.survexfile.path}"
print("Aliased splay in ", survexblock.survexfile.path) print(self.insp + message)
return stash_data_issue(
if ls[datastar["to"]] == "-": parser="survexleg", message=message, url=None, sb=(survexblock.survexfile.path)
if debugprint: )
print("Aliased splay in ", survexblock.survexfile.path) return
return
except: except:
message = f" ! datastar parsing from/to incorrect in line {ls} in {survexblock.survexfile.path}" message = f" ! datastar parsing from/to incorrect in line {ls} in {survexblock.survexfile.path}"
print(self.insp + message) print(self.insp + message)

View File

@ -3,7 +3,7 @@
{% if svxothers %}<u>Survex files</u> on this date:<br> {% if svxothers %}<u>Survex files</u> on this date:<br>
<span style="font-size: 70%; "> <span style="font-size: 70%; ">
{% for item in svxothers %} {% for item in svxothers %}
&nbsp;&nbsp;&nbsp;&nbsp;<a href="/survexfile/{{item.path}}">{{item.path|safe}}</a><br/> &nbsp;&nbsp;&nbsp;&nbsp;<a href="/survexfile/{{item.path}}">{{item.path|safe}}</a> <br/>
{% empty %} {% empty %}
<em>None found for this date.</em><br> <em>None found for this date.</em><br>
{% endfor %} {% endfor %}

View File

@ -1,10 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Person {{personexpedition.person}} for {{personexpedition.expedition}}{% endblock %} {% block title %}Person {{personexpedition.person}} for {{personexpedition.expedition}}{% endblock %}
<!-- I am removing 'role' as a thing that troggle cares about.
This will remove the Class Role (but keep PersonRole)
and 1 foreign key role
If anyone really cares, they can always look in the original survex file
-->
{% block content %} {% block content %}
<h1> <h1>
@ -13,7 +8,7 @@ If anyone really cares, they can always look in the original survex file
</h1> </h1>
<p>{{message}}</p> <p>{{message}}</p>
<p>{{personexpedition.surveyedleglength|stringformat:".1f"}} m surveyed this year.</p> <p>{{personexpedition.surveyedleglength|floatformat:1}} m surveyed this year.</p>
<p><b>Other years:&nbsp;</b> <p><b>Other years:&nbsp;</b>
{% for otherpersonexpedition in personexpedition.person.personexpedition_set.all %} {% for otherpersonexpedition in personexpedition.person.personexpedition_set.all %}
@ -31,8 +26,6 @@ If anyone really cares, they can always look in the original survex file
<h3>Table of all trips and surveys aligned by date</h3> <h3>Table of all trips and surveys aligned by date</h3>
<div> <div>
<table class="survexcontibutions"> <table class="survexcontibutions">
<!--
<tr><th>Date</th><th colspan="2">Trips</th><th colspan="3">Surveys</th></tr> Remove 'role' -->
<tr><th>Date</th><th colspan="2">Trips</th><th colspan="2">Surveys</th></tr> <tr><th>Date</th><th colspan="2">Trips</th><th colspan="2">Surveys</th></tr>
{% for persondate in personchronology %} {% for persondate in personchronology %}
<tr> <tr>
@ -47,14 +40,9 @@ If anyone really cares, they can always look in the original survex file
{% if persondate.2 %} {% if persondate.2 %}
<td class="survexblock"><a href="{% url "svx" persondate.2.survexfile.path %}">{{persondate.2.name}}</a></td> <td class="survexblock"><a href="{% url "svx" persondate.2.survexfile.path %}">{{persondate.2.name}}</a></td>
{%comment%}
<td class="roles" style="padding-right: 3px; text-align:right">
{% for survexpersonrole in persondate.2.survexpersonrole_set.all %}
{{survexpersonrole.nrole}}
{% endfor %}
</td>{%endcomment%}
<td style="text-align:right"> <td style="text-align:right">
{{persondate.2.legslength|stringformat:".1f"}} m {{persondate.2.legslength|floatformat:1}} m
</td> </td>
{% else %} {% else %}
<td colspan="3"> </td> <td colspan="3"> </td>

View File

@ -12,17 +12,18 @@ Total length: {{addupsurvexlength|stringformat:".1f"}} km adding up the total fo
<p>These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys. <p>These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys.
<p> <p>
This is work in progress (Feb.2023). This is work in progress (March 2023): the last column is floatng point numbers, the 3rd column appears to be strings..
<p>This includes ARGE and other surveys currently. It will be changed to only include lengths surveyed by valid Expo-attendees. <p>This includes ARGE and other surveys currently. It will be changed to only include lengths surveyed by valid Expo-attendees.
<table> <table>
<tr><th>Year</th><th>Survex<br>Survey<br>Blocks</th><th>Survex<br>Survey Legs</th><th>Total length<br>(m)</th></tr> <tr><th>Year</th><th>Survex<br>Survey<br>Blocks</th><th>Survex<br>Survey Legs</th><th>Total length<br>(m)</th><th>Total length<br>(m)</th></tr>
{% for legs in legsbyexpo %} {% for legs in legsbyexpo %}
<tr> <tr>
<td style="text-align:center"><a href="{{ legs.0.get_absolute_url }}">{{legs.0}}</a></td> <td style="text-align:center"><a href="{{ legs.0.get_absolute_url }}">{{legs.0}}</a></td>
<td style="text-align:center">{{legs.0.survexblock_set.all|length}}</td> <td style="text-align:center">{{legs.0.survexblock_set.all|length}}</td>
<td style="text-align:center">{{legs.1.nsurvexlegs|rjust:"10"}} </td> <td style="text-align:center">{{legs.1.nsurvexlegs|rjust:"10"}} </td>
<td style="text-align:right">{{legs.1.survexleglength}}</td> <td style="text-align:right">{{legs.1.survexleglength}}</td>
<td style="text-align:right">{{legs.1.survexleglength|floatformat:0}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -80,6 +80,7 @@ LOGMESSAGES
--> -->
{% endif %} {% endif %}
</div> </div>
survey length: {{svxlength|floatformat:2}} metres
<span style="font-family: monospace; font-size: 130%; "> <span style="font-family: monospace; font-size: 130%; ">
{% for sb in svxblocks %} {% for sb in svxblocks %}
{% empty %} {% empty %}