From ed006d459a3326db0a70c2aaea00fa8c6fccee39 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 16 Mar 2017 12:35:52 +0000 Subject: [PATCH] Changed method of appending model number to geometry and output files when running more than a single model. --- gprMax/snapshots.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gprMax/snapshots.py b/gprMax/snapshots.py index 5dccb1c6..34431135 100644 --- a/gprMax/snapshots.py +++ b/gprMax/snapshots.py @@ -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'))