diff options
Diffstat (limited to 'parsers')
-rw-r--r-- | parsers/survex.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index 88c226c..02f7df1 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -23,7 +23,8 @@ survexblockroot = None ROOTBLOCK = "rootblock" debugprint = False # Turns on debug printout for just one *include file -debugprinttrigger = "caves-1623/40/old/EisSVH" +debugprinttrigger = "!" +# debugprinttrigger = "caves-1623/40/old/EisSVH" class SurvexLeg(): """No longer a models.Model subclass, so no longer a database table @@ -58,7 +59,7 @@ class LoadingSurvex(): rx_person = re.compile(r"(?i) and | / |, | & | \+ |^both$|^none$") rx_qm = re.compile(r'(?i)^\s*QM(\d)\s+?([a-dA-DxX])\s+([\w\-]+)\.(\d+)\s+(([\w\-]+)\.(\d+)|\-)\s+(.+)$') # remember there is also QM_PATTERN used in views_other and set in settings.py - rx_tapelng = re.compile(r'(?i)(tape|length)$') + rx_tapelng = re.compile(r'(?i).*(tape|length).*$') rx_cave = re.compile(r'(?i)caves-(\d\d\d\d)/([-\d\w]+|\d\d\d\d-?\w+-\d+)') rx_comment = re.compile(r'([^;]*?)\s*(?:;\s*(.*))?\n?$') @@ -168,6 +169,16 @@ class LoadingSurvex(): tapeunits = self.rx_tapelng.match(line) # tape|length if not tapeunits: return + message = "! *UNITS '{}' ({}) {}".format(line, survexblock, survexblock.survexfile.path) + print((self.insp+message)) + models.DataIssue.objects.create(parser='survex', message=message) + convert = re.match("(?i).*([\.\d]+).*",line) + if convert: + factor = convert.groups()[0] + message = "! *UNITS numerical conversion - not converted <{}x> '{}' ({}) {}".format(factor, line, survexblock, survexblock.survexfile.path) + print((self.insp+message)) + models.DataIssue.objects.create(parser='survex', message=message) + feet = re.match("(?i)feet$",line) metres = re.match("(?i)(METRIC|METRES|METERS)",line) if feet: |