Make .3d files in same dir as .svx

This commit is contained in:
Philip Sargent
2022-03-06 01:29:45 +00:00
parent 7a58aac08e
commit 3ac617431f
7 changed files with 46 additions and 19 deletions

View File

@@ -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 = {}