[Paraview] Problems with CSV files and pythonŠ need help

Joshua Murphy Joshua.Murphy at lasp.colorado.edu
Wed Apr 11 12:44:34 EDT 2012


Hello,

I am trying to extract data from a CSV file via python, and I am having trouble.

I ran Trace to get the calls for how to go about opening the file… I can open the file manually, and look at the file information via the GUI, but I cannot seem to automate it via python..

The Trace routine gave me the following from a successful opening of the CSV file:
-----------------------------

try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

actdata2_csv = CSVReader( DetectNumericColumns=1, MergeConsecutiveDelimiters=0, FieldDelimiterCharacters=',', FileName=['/Users/jjm390/LFM-Data/Zmhd2007-09-20T00/act-data2.csv'], UseStringDelimiter=1, HaveHeaders=1 )

AnimationScene4 = GetAnimationScene()
SpreadSheetView2 = CreateRenderView()
SpreadSheetView2.ColumnToSort = None
SpreadSheetView2.SelectionOnly = 0
SpreadSheetView2.BlockSize = 1024L
SpreadSheetView2.SelectedComponent = -1
SpreadSheetView2.InvertOrder = 0
SpreadSheetView2.ViewTime = 0.0

DataRepresentation2 = Show(actdata2_csv)
DataRepresentation2.CompositeDataSetIndex = 0
DataRepresentation2.FieldAssociation = 'Row Data'
DataRepresentation2.Visibility = 1

AnimationScene4.ViewModules = SpreadSheetView2

Render()

-----------------------------
But when I try to run this as a script, I get the following error:


Traceback (most recent call last):

File "<string>", line 16, in <module>

File "/usr/local/ParaView 3.12.0.app/Contents/Python/paraview/simple.py", line 209, in Show

raise RuntimeError, "Could not create a representation object for proxy %s" % proxy.GetXMLLabel()

RuntimeError: Could not create a representation object for proxy CSV Reader



Can someone tell me what I am doing wrong?  All I want to do is open the CSV file and use the data (locations) within to extract data from another data set (grid)…

Basically, if I can get into the table via python and query different cells, I will be all set… If the trace doesn't work, can someone please explain how to open a CSV file and load the data properly from within Python?

Thanks,
Josh

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


More information about the ParaView mailing list