[Paraview] Python Programmable Filter Timesteps

Bane Sullivan banesulli at gmail.com
Sun Feb 18 20:35:27 EST 2018


Is it possible to add time steps in a Programmable Filter? For example, I
have read a single static csv file with the normal delimited text reader
and I want to iterate over each row of that file at different time steps.

My RequestInformation script:
    executive = self.GetExecutive()
    outInfo = executive.GetOutputInformation(0)
    #- Get number of rows in table and use that for num time steps
    pdi = self.GetInput()
    nrows = int(pdi.GetColumn(0).GetNumberOfTuples())
# Calculate list of time steps
xtime = range(0,nrows)
    outInfo.Remove(executive.TIME_STEPS())
    for i in range(len(xtime)):
        outInfo.Append(executive.TIME_STEPS(), xtime[i])
    # Remove and set time range info
    outInfo.Remove(executive.TIME_RANGE())
    outInfo.Append(executive.TIME_RANGE(), xtime[0])
    outInfo.Append(executive.TIME_RANGE(), xtime[-1])

Then my Request Data script:
pdi = self.GetInput()
pdo = self.GetOutput()
# grab coordinates for each part of boring machine at time idx as row
executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)
idx = outInfo.Get(executive.UPDATE_TIME_STEP())
print("Current time step: “, idx)
# NOW I SHOULD BE ABLE TO USE IDX TO ITERATE OVER EACH ROW OF THE INPUT
VTKTABLE



The time steps printed in Request Data do not reflect the time steps set in
Request Information. However if I add this little snippet to the Request
Data call it prints out the expected time steps:
print(self.GetExecutive().GetOutputInformation(0).Get(vtk.vtkStreamingDemandDrivenPipeline.TIME_STEPS()))

Is there something I am missing, or can timesteps only be set this way in a
Programmable Source?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview/attachments/20180218/682fe7ad/attachment.html>


More information about the ParaView mailing list