[Paraview] Cannot Automate Vectors with Python and CSV Files

Magician f_magician at mac.com
Wed May 14 10:41:46 EDT 2014


Hi Darren,


How about:

try: paraview.simple
except: from paraview.simple import *

points_csv = CSVReader(FileName = '/Users/magician/Documents/ParaViewTest/points.csv')
TableToPoints1 = TableToPoints(
    XColumn = 'x',
    YColumn = 'y',
    ZColumn = 'z',
)
Show()
Calculator1 = Calculator(Function = 'vx*iHat+vy*jHat+vz*kHat')
Show()
Glyph1 = Glyph(
    Vectors = ['POINTS', 'Result'],
    GlyphType = 'Arrow',
    SetScaleFactor = 1.0,
)
Show()
Render()


I tried on ParaView 4.1.0 of OSX.


Magician


On May 14, 2014, at 20:18, paraview-request at paraview.org wrote:

> Date: Tue, 13 May 2014 18:46:53 +0000
> From: Darren Pereira <darren.pereira at mail.utoronto.ca>
> To: "paraview at paraview.org" <paraview at paraview.org>
> Subject: [Paraview] Cannot Automate Vectors with Python and CSV Files
> Message-ID: <1400006813590.42340 at mail.utoronto.ca>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hey there,
> 
> 
> I'm working on displaying velocity vectors but have reached a major roadblock. I have a set of CSV files with columns x, y, z, vx, vy, and vz - the positions and velocity components of the velocity vectors I want to show. By manually loading in the CSV files, applying the TableToPoints filter, applying the Calculator filter, and then applying the Glyph filter, I can display these vectors.
> 
> 
> The problem comes when I try to write a Python script to the exact same thing. This problem has been reported as a bug with Paraview (http://vtk.org/Bug/bug_relationship_graph.php?bug_id=14184&graph=dependency), where Python cannot select "Row Data". I'm really having difficulty finding a way around it. Is there a way to use my CSV files to display my velocity vectors in a similar fashion, but with Python? What I've done manually is so far the only way I know how to display vectors, but it's not Python compatible. Any help would be greatly appreciated!
> 
> 
> Thanks,
> 
> Darren



More information about the ParaView mailing list