diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-11-18 12:38:07 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-11-18 12:38:07 +0000 |
commit | 76688695b80ebf18e4a8a541a1d2595204bee02b (patch) | |
tree | 2b7904103b31c30bd6d578dd0ba2ffb7e6944ed3 /parsers/survex.py | |
parent | 688a1795e7a56f60ec83c6f3866295f38ade42fe (diff) | |
download | troggle-76688695b80ebf18e4a8a541a1d2595204bee02b.tar.gz troggle-76688695b80ebf18e4a8a541a1d2595204bee02b.tar.bz2 troggle-76688695b80ebf18e4a8a541a1d2595204bee02b.zip |
srtm altitude parsing
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index ba90a84..9c5950c 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -617,7 +617,7 @@ class LoadingSurvex: SO we have to recognise the '*fix' too """ # *fix|36|reference|36359.40|82216.08|2000.00\n - rx_fixline = re.compile(r"(?i)^\s*[*]fix\s+([\w\d_\.\-]+)\s+(?:reference)?\s*([\d\.]*)\s+([\d\.]*)\s+([\d\.]*).*$") + rx_fixline = re.compile(r"(?i)^\s*[*]fix\s+([\w\d_\.\-]+)\s+(?:reference)?\s*([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s*;(.*)$") line = line.replace("\n","") #fixline = self.rx_fixline.match(line) @@ -644,7 +644,7 @@ class LoadingSurvex: #_, _, alt, *rest = (fixdata + [None]*5)[:5] name, _, _, alt, comment = (list(fixdata) + [None]*5)[:5] fixid = str(survexblock.id)+ ":"+ name - self.fixes[fixid] = (survexblock, name) + self.fixes[fixid] = (survexblock, name, alt, comment) message = f"{name}, {fixdata=}, last:{fixline.groups()[-1]}" print(self.insp + message) except Exception as e: @@ -2417,24 +2417,23 @@ def FindAndLoadSurvex(): for f in svx_load.fixes: # why are we seeing no *fixes from fixedpts/gps18.svx etc. ? They are parsed ! - survexblock, altitude, comment = svx_load.fixes[f] + survexblock, name, altitude, comment = svx_load.fixes[f] s = survexblock - spath = "" - sprevious = None - while s.parent != sprevious: - spath += str(s.parent) + ":" + spath - sprevious = s - if not s.parent: - break - s = s.parent - + spath = s.parent.survexfile + # sprevious = None + # while s.parent != sprevious: + # spath += str(s.parent) + ":" + spath + # sprevious = s + # if not s.parent: + # break + # s = s.parent + ff = survexblock.survexfile if comment: - print(f"COMMENT {survexblock} {altitude} {comment}") + # print(f"FIX {survexblock} {altitude} {comment}") if re.match("(?i)[^s]*srtm[\s\S]*", comment.lower()): - print(f"{f} - {spath}::{survexblock} - {comment}") - else: - if str(f).startswith("1623"): - print(f"{f} - {spath}::{survexblock} - {altitude=}") + print(f"SRTM {ff}.svx::{survexblock} - {spath}.svx - '{comment}'") + if re.match("(?i)[^s]*radost[\s\S]*", comment.lower()): + print(f"RDST {ff}.svx::{survexblock} - {spath}.svx - '{comment}'") svx_load = None |