Writing VTK file using Python

To write VTK file using Python, download pytvtk. You can read the examples folder to get to know how to use it.

For example to write a structured points of scalar data stored in variable named Coef, we write:


vtk=VtkData(StructuredPoints([Nx,Ny,Nz]),\
PointData(Scalars(ravel(Coef,order='F'),'my scalar')))
vtk.tofile('myfile')

this will save to a file name myfile.vtk



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: