Changed method of appending model number to geometry and output files when running more than a single model.

这个提交包含在:
Craig Warren
2017-03-16 12:35:52 +00:00
父节点 a4c67f1ee3
当前提交 ed006d459a

查看文件

@@ -65,12 +65,11 @@ class Snapshot(object):
self.time = time
self.basefilename = filename
def prepare_vtk_imagedata(self, modelrun, numbermodelruns, G):
def prepare_vtk_imagedata(self, appendmodelnumber, G):
"""Prepares a VTK ImageData (.vti) file for a snapshot.
Args:
modelrun (int): Current model run number.
numbermodelruns (int): Total number of model runs.
appendmodelnumber (str): Text to append to filename.
G (class): Grid class instance - holds essential parameters describing the model.
"""
@@ -80,11 +79,7 @@ class Snapshot(object):
self.vtk_nz = self.zf - self.zs
# Create directory and construct filename from user-supplied name and model run number
if numbermodelruns == 1:
snapshotdir = os.path.join(G.inputdirectory, os.path.splitext(G.inputfilename)[0] + '_snaps')
else:
snapshotdir = os.path.join(G.inputdirectory, os.path.splitext(G.inputfilename)[0] + '_snaps' + str(modelrun))
snapshotdir = os.path.join(G.inputdirectory, os.path.splitext(G.inputfilename)[0] + '_snaps' + appendmodelnumber)
if not os.path.exists(snapshotdir):
os.mkdir(snapshotdir)
self.filename = os.path.abspath(os.path.join(snapshotdir, self.basefilename + '.vti'))