Skip to content

Commit

Permalink
Merge pull request #27 from joergbuchwald/fix_append
Browse files Browse the repository at this point in the history
fix append by deriving time from fn
joergbuchwald authored Feb 29, 2024
2 parents 048616a + 1a374ca commit deb33c6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions VTUinterface/vtuIO.py
Original file line number Diff line number Diff line change
@@ -1199,7 +1199,7 @@ def rename(self, newname):
xml_declaration=True,
pretty_print=True)

def append(self, filename, vtu_rename=False):
def append(self, filename, vtu_rename=False, timestep_from_filename=False):
"""
appends entries from another PVD file
@@ -1220,7 +1220,13 @@ def append(self, filename, vtu_rename=False):
self.timesteps = self.timesteps[:-1]
self.vtufilenames = self.vtufilenames[:-1]
for tag in find_xpath:
self.timesteps = np.append(self.timesteps, [float(tag.attrib['timestep'])+offset])
if timestep_from_filename is False:
self.timesteps = np.append(self.timesteps, [float(tag.attrib['timestep'])+offset])
else:
fn = tag.attrib['file']
fn_cut = fn.split("_t_")[1]
time_fromfile = float(fn_cut(".")[0]+"."+fn_cut(".")[1])
self.timesteps = np.append(self.timesteps, [time_fromfile])
newvtuname = tag.attrib['file']
if vtu_rename is True:
newvtuname = tag.attrib['file'].replace(filename_dirstripped.split(".pvd")[0],

0 comments on commit deb33c6

Please sign in to comment.