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

Greg Schussman schussman at slac.stanford.edu
Wed Sep 14 16:29:36 EDT 2011


Hi.

I've got a simple script to read a csv file and open a new plot window.  
One of the columns in the data file needs to be rescaled.  I've had poor 
luck googling around and looking at examples.  Does anyone have any 
suggestions?

Thanks in advance for any help.

Greg

Here is the working (except for scaling) macro so far:
-----------------------------------------------------------------------------------
try: paraview.simple
except: from paraview.simple import *

paraview.simple._DisableFirstRenderCameraReset()

XYChartView1 = CreateXYPlotView()
XYChartView1.ViewTime=0.0

animscene = GetAnimationScene()
animscene.ViewModules = [ XYChartView1 ]

filename = '/raid/schussma/work2/ace3p/paraview/macros/wakeplot/wake.out'
wake_out = CSVReader(FileName=filename,
                      FieldDelimiterCharacters = ' ',
                      HaveHeaders = 0)

################################################################################
# What is the right approach for this section?

data = servermanager.Fetch(wake_out)      # can't use wake_out directly
print "rows:", data.GetNumberOfRows()     # works
print "cols:", data.GetNumberOfColumns()  # works

# get largest magnitude value from column 2

# how?


# rescale column 1

# how?


# have PlotData use this new data instead of the original wake_out

# how?

################################################################################

pd = PlotData(wake_out)

dr = Show(pd,
           XArrayName = 'Field 0',
           AttributeType = 'Row Data',
           SeriesVisibility = ['vtkOriginalIndices', '0'])

Render()


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110914/f754784a/attachment.htm>


More information about the ParaView mailing list