Ug. What an annoying problem to have.
First of all, I think the easiest solution to your problem is to simply change
the animation mode from "Snap to TimeSteps" to either "Sequence" or "Real
Time". The default "Snap to TimeSteps" is going to visit all unique time steps,
and ParaView incorrectly thinks your two data sets have different values in
equivalent time steps. But the other two modes ignore the independent time
steps, and your two readers will both interpret them correctly.
I wish I thought of that solution before figuring out how to filter the time in
your data, but I didn't and instead came up with a solution to use the
programable filter. Anyway, if you still want to go through the trouble of
changing the time values, here is the solution.
By default, the programmable filter copies the input data to the output, which
is good since that is what you want. You can just leave the main script (which
is really the RequestData script) blank. Instead you need to change the
RequestInformation script and the RequestUpdateExtent script (both part of the
"advanced" properties).
First, the RequestInformation script needs to redefine the time step values.
Here is a version of the script that resets the time to be integer values
(which should not have precision problems).
executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)
numTimeSteps = outInfo.Length(executive.TIME_STEPS())
outInfo.Remove(executive.TIME_STEPS())
for time in xrange(0, numTimeSteps):
outInfo.Append(executive.TIME_STEPS(), time)
Next, you need to have the RequestUpdateExtent script translate the time step
requested by ParaView to the time step that the reader is really expecting.
Here is a script that will do that.
executive = self.GetExecutive()
inInfo = executive.GetInputInformation(0).GetInformationObject(0)
outInfo = executive.GetOutputInformation().GetInformationObject(0)
inTimeSteps = inInfo.Get(executive.TIME_STEPS())
outTimeSteps = outInfo.Get(executive.TIME_STEPS())
requestedTimeStep = outInfo.Get(executive.UPDATE_TIME_STEP())
requestedTimeIndex = 0
while requestedTimeIndex < len(outTimeSteps)-1:
if requestedTimeStep < outTimeSteps[requestedTimeIndex+1]:
break
requestedTimeIndex += 1
inInfo.Set(executive.UPDATE_TIME_STEP(), inTimeSteps[requestedTimeIndex])
That should be it. You can try to change the RequestInformation script to so
set time values of one reader to the ones used by the other, or you can just
apply this filter to both. As long as the time indices match up, it should work.
-Ken
From: ParaView
<[email protected]<mailto:[email protected]>> on behalf
of Eric Lynch <[email protected]<mailto:[email protected]>>
Date: Tuesday, October 6, 2015 at 9:44 PM
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Subject: [EXTERNAL] [Paraview] Changing time step values
After reading a dataset into ParaView, is it possible to change the time step
values? I'm reading in data in two different formats. I've got the same time
steps in both readers (they correspond to the same iteration of the same
simulation), but due to differences in precision, ParaView thinks they're
different times. For example, one reader parses time as a float and has a time
step of 0.10000000149011 while the other parses time as a double and shows
0.100000000000000. Is there a way for me to change one of these after reading
so ParaView thinks they're the same?
Thanks,
Eric
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview