diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-03-06 01:29:45 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-03-06 01:29:45 +0000 |
commit | 3ac617431f41c9bb85636c68d1aef72feb3944ff (patch) | |
tree | 094215a52b0cc85bfc7614a8fe23ce3f5beeaad3 /parsers/survex.py | |
parent | 7a58aac08eb0b19b05f84955d855d8af6bb369de (diff) | |
download | troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.tar.gz troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.tar.bz2 troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.zip |
Make .3d files in same dir as .svx
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index 70649da..fc234d0 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -1205,9 +1205,13 @@ class LoadingSurvex(): # see design docum in troggle/templates/cave.html # and views/caves.py rendercave() ''' - print(" - Regenerating stale (or chaos-monkeyed) cavern .log and .3d for '{}'\n at '{}'\n days svx old: {:.1f} cav:{:.1f} log old: {:.1f}".format(fullpath, logpath, (svx_t - log_t)/(24*3600), (cav_t - log_t)/(24*3600), (now - log_t)/(24*3600))) - #print(f' - cav_t: {cav_t/(24*3600)} - log_t: {log_t/(24*3600)} - svx_t: {svx_t/(24*3600)} - now: {now}') - subprocess.call([settings.CAVERN, "--log", "--output={}".format(settings.THREEDCACHEDIR), "{}.svx".format(fullpath)]) + print(f" - Regenerating stale (or chaos-monkeyed) cavern .log and .3d for '{fullpath}'\n at '{logpath}'\n") + print(f"days svx old: {(svx_t - log_t)/(24*3600):.1f} cav:{(cav_t - log_t)/(24*3600):.1f} log old: { (now - log_t)/(24*3600):.1f}") + + outputdir = Path(str(f'{fullpath}.svx')).parent + sp = subprocess.run([settings.CAVERN, "--log", f'--output={outputdir}', f'{fullpath}.svx']) + if sp.returncode != 0: + print(f'fullpath: {fullpath}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) self.caverncount += 1 # should also collect all the .err files too and create a DataIssue for each one which @@ -1215,7 +1219,8 @@ class LoadingSurvex(): # - has Error greater than 5% anywhere, or some other more serious error svxpath = fullpath + ".svx" - logpath = Path(settings.THREEDCACHEDIR) / str(Path(fullpath).name + ".log") + logpath = fullpath + ".log" + outputdir = Path(svxpath).parent if not os.path.isfile(logpath): runcavern() @@ -1412,15 +1417,28 @@ def LoadPositions(): svx_t = 0 d3d_t = 0 def runcavern3d(): + outputdir = Path(str(f'{topdata}.svx')).parent + # print(" - Regenerating stale cavern .log and .3d for '{}'\n days old: {:.1f} {:.1f} {:.1f}". # format(topdata, (svx_t - d3d_t)/(24*3600), (cav_t - d3d_t)/(24*3600), (now - d3d_t)/(24*3600))) - subprocess.call([settings.CAVERN, "--log", "--output={}".format(topdata), "{}.svx".format(topdata)]) - - # print(" - Regenerating {} {}.3d in {}".format(settings.SURVEXPORT, topdata, settings.SURVEX_DATA)) - subprocess.call([settings.SURVEXPORT, '--pos', '{}.3d'.format(topdata)], cwd = settings.SURVEX_DATA) + # subprocess.call([settings.CAVERN, "--log", f"--output={topdata}", f"{topdata}.svx"]) + try: + sp = subprocess.run([settings.CAVERN, "--log", f"--output={outputdir}", f"{topdata}.svx"], + capture_output=True, check=True, text=True) + if sp.returncode != 0: + print(f'topdata: {topdata}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) + + # print(" - Regenerating {} {}.3d in {}".format(settings.SURVEXPORT, topdata, settings.SURVEX_DATA)) + sp = subprocess.run([settings.SURVEXPORT, '--pos', f'{topdata}.3d'], cwd = settings.SURVEX_DATA, + capture_output=True, check=True, text=True) + if sp.returncode != 0: + print(f'topdata: {topdata}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) + except: + print(f'topdata: {topdata}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) + topdata = os.fspath(Path(settings.SURVEX_DATA) / settings.SURVEX_TOPNAME) - print((' - Generating a list of Pos from %s.svx and then loading...' % (topdata))) + print(' - Generating a list of Pos from %s.svx and then loading...' % (topdata)) found = 0 skip = {} |