[Paraview] How does one rescale CSVReader data via pvpython?

Favre Jean jfavre at cscs.ch
Thu Sep 15 05:05:50 EDT 2011


Greg,

I would not use Fetch to do what you need. Here is something that should work:

# reuse your wake_out proxy

di = wake_out.GetDataInformation()
rowInfo = di.GetRowDataInformation()

# get largest magnitude value from column 2

rowInfo.GetArrayInformation(1).GetComponentRange(0)[1]

#You then use a programmable filter with the following copy op.
#one deepcopy to get your initial array, and then you scale it the way you want
# you may discard the old array later


import vtk

input = self.GetInput()

newcol0 = vtk.vtkDoubleArray()

newcol0.DeepCopy(input.GetColumn(0))

for i in range(newcol0.GetNumberOfTuples()):

newcol0.SetValue(i, 2.0 * newcol0.GetValue(i)) # rescale by a factor of 2


output = self.GetOutputDataObject(0)

output.AddColumn(newcol0)

print output.GetNumberOfColumns()

-----------------
Jean M. Favre
Swiss National Supercomputing Center




More information about the ParaView mailing list