diff options
author | Philip Sargent <philip@Muscogee.localdomain> | 2020-04-28 01:18:57 +0100 |
---|---|---|
committer | Philip Sargent <philip@Muscogee.localdomain> | 2020-04-28 01:18:57 +0100 |
commit | 4be8c8129183888c8a0d62536ee6009a99dc53fb (patch) | |
tree | 6ae5de060a1b5b81c0aa8706f6682664b71391c6 /parsers/survex.py | |
parent | a8460065a41a76ea2ea59ce09daff8e5bff51aea (diff) | |
download | troggle-4be8c8129183888c8a0d62536ee6009a99dc53fb.tar.gz troggle-4be8c8129183888c8a0d62536ee6009a99dc53fb.tar.bz2 troggle-4be8c8129183888c8a0d62536ee6009a99dc53fb.zip |
reducing clutter in output
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index 3d78c59..5702bae 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -149,7 +149,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): survexblock.survexscansfolder = survexscansfolders[0] #survexblock.refscandir = "%s/%s%%23%s" % (mref.group(1), mref.group(1), mref.group(2)) survexblock.save() - print('Wallet *ref - %s' % refscan) + print(' - Wallet *ref - %s' % refscan) continue # This whole section should be moved if we can have *QM become a proper survex command @@ -160,7 +160,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): # ;QM1 a hobnob_hallway_2.42 - junction of keyhole passage qmline = comment and regex_qm.match(comment) if qmline: - print(qmline.groups()) + # print(qmline.groups()) #(u'1', u'B', u'miraclemaze', u'1.17', u'-', None, u'\tcontinuation of rift') qm_no = qmline.group(1) qm_grade = qmline.group(2) @@ -170,31 +170,32 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): qm_resolve_station = qmline.group(7) qm_notes = qmline.group(8) - print('Cave - %s' % survexfile.cave) - print('QM no %d' % int(qm_no)) - print('QM grade %s' % qm_grade) - print('QM section %s' % qm_from_section) - print('QM station %s' % qm_from_station) - print('QM res section %s' % qm_resolve_section) - print('QM res station %s' % qm_resolve_station) - print('QM notes %s' % qm_notes) + # print('Cave - %s' % survexfile.cave) + # print('QM no %d' % int(qm_no)) + # print('QM grade %s' % qm_grade) + # print('QM section %s' % qm_from_section) + # print('QM station %s' % qm_from_station) + # print('QM res section %s' % qm_resolve_section) + # print('QM res station %s' % qm_resolve_station) + # print('QM notes %s' % qm_notes) # If the QM isn't resolved (has a resolving station) thn load it if not qm_resolve_section or qm_resolve_section is not '-' or qm_resolve_section is not 'None': from_section = models.SurvexBlock.objects.filter(name=qm_from_section) # If we can find a section (survex note chunck, named) if len(from_section) > 0: - print(from_section[0]) + # print(from_section[0]) from_station = models.SurvexStation.objects.filter(block=from_section[0], name=qm_from_station) # If we can find a from station then we have the nearest station and can import it if len(from_station) > 0: - print(from_station[0]) + # print(from_station[0]) qm = models.QM.objects.create(number=qm_no, nearest_station=from_station[0], grade=qm_grade.upper(), location_description=qm_notes) else: - print('QM found but resolved') + # print(' - QM found but resolved') + pass #print('Cave -sline ' + str(cave)) if not sline: @@ -208,7 +209,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): # print(survexblock) LoadSurvexLineLeg(survexblock, stardata, sline, comment, survexfile.cave) # print(' - From: ') - #print(stardata) + # print(stardata) pass elif stardata["type"] == "passage": LoadSurvexLinePassage(survexblock, stardata, sline, comment) @@ -247,7 +248,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): path_match = re.search(r"caves-(\d\d\d\d)/(\d+|\d\d\d\d-?\w+-\d+)/", newsvxpath) if path_match: pos_cave = '%s-%s' % (path_match.group(1), path_match.group(2)) - print(pos_cave) + # print(pos_cave) cave = models.getCaveByReference(pos_cave) if cave: survexfile.cave = cave @@ -350,7 +351,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): def LoadAllSurvexBlocks(): - print('Loading All Survex Blocks...') + print(' - Flushing All Survex Blocks...') models.SurvexBlock.objects.all().delete() models.SurvexFile.objects.all().delete() @@ -362,6 +363,7 @@ def LoadAllSurvexBlocks(): models.SurvexStation.objects.all().delete() print(" - Data flushed") + print(' - Loading All Survex Blocks...') survexfile = models.SurvexFile(path=settings.SURVEX_TOPNAME, cave=None) survexfile.save() @@ -377,14 +379,19 @@ def LoadAllSurvexBlocks(): fin.close() survexblockroot.text = "".join(textlines) survexblockroot.save() + print(' - Loaded All Survex Blocks.') poslineregex = re.compile(r"^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$") def LoadPos(): - - print('Loading Pos....') + """Run cavern to produce a complete .3d file, then run 3dtopos to produce a table of + all survey point positions. Then lookup each position by name to see if we have it in the database + and if we do, then save the x/y/z coordinates. + If we don't have it in the database, print an error message and discard it. + """ + print(' - Generating a list of Pos and then loading them....') call([settings.CAVERN, "--output=%s%s.3d" % (settings.SURVEX_DATA, settings.SURVEX_TOPNAME), "%s%s.svx" % (settings.SURVEX_DATA, settings.SURVEX_TOPNAME)]) call([settings.THREEDTOPOS, '%s%s.3d' % (settings.SURVEX_DATA, settings.SURVEX_TOPNAME)], cwd = settings.SURVEX_DATA) @@ -398,7 +405,7 @@ def LoadPos(): ss = models.SurvexStation.objects.lookup(name) ss.x = float(x) ss.y = float(y) - ss.z = float(z) + ss.z = float(z) ss.save() except: - print "%s not parsed in survex %s.pos" % (name, settings.SURVEX_TOPNAME)
\ No newline at end of file + print "%s in %s.pos not found in lookup of SurvexStation.objects" % (name, settings.SURVEX_TOPNAME)
\ No newline at end of file |