I have a sequence of legacy VTK files, e.g.: file_0.vtk
, file_1.vtk
, file_2.vtk
, which I can open in ParaView as a time series (described here) as file_..vtk
, and the sequence of files can be viewed and animated using the time controls. I'm currently using ParaView 4.4.0.
The legacy VTK files look like this, where the timestep value is stored in the header (second line):
# vtk DataFile Version 3.0
vtk output: file at time 0.0
ASCII
...
However, in ParaView the timestep values have assumed the same as the index, i.e. index 0 is time 0.0, index 1 is time 1.0, and index 2 is time 2.0. And adding an AnnotateTime filter also shows these timesteps for the timestep indexes.
However, my files use variable timesteps, as described in the header of each file. (I don't think that the legacy VTK format has a way to specify these values). I've looked around ParaView's application to see if there is a way to import or modify these values, but I cannot find it.
Using the built-in Python Shell, here is my sad attempt to create the object with LegacyVTKReader:
files = ['file_0.vtk', 'file_1.vtk', 'file_2.vtk']
times = [0.0, 0.022608, 0.73781]
# First attempt
r = LegacyVTKReader(FileNames=files, TimestepValues=times)
print(r.TimestepValues) # [0.0, 1.0, 2.0]
# Second attempt to try and fix it
r.TimestepValues = times
print(r.TimestepValues) # [0.0, 0.022608, 0.73781]
Show(r)
Which shows the correctly in the objects "Information" dialog, until I add an AnnotateTimeFilter, which resets 0 to 0, 1 to 1, and 2 to 2.
Is there any way, using point-click or Python, to update the timestep values for each index of a legacy VTK object in ParaView?