[Paraview] Saving as csv data
Li, Teng
tengli2 at illinois.edu
Mon Oct 9 16:09:05 EDT 2017
Hi Utkarsh,
Thanks!
I have successfully use the "Cell Data To Point Data" filter and save a csv file with all the components I expected to see.
Actually, I would like to process the three stress component data in the original VTK file. So I choose to save them as the CSV data. However, I have totally 118 time steps, thus 118 VTK files. If I save all of them and process each in the Matlab and finally show back in Paraview, that will be a huge amount of work. So I use python shell to access the data and process them. After some searching, I find some valuable codes:
1.
>>> a =GetActiveSource() # First highlight the stress vtk file in pipeline.
>>> a
<paraview.servermanager.LegacyVTKReader object at 0x0000006D080174E0>
>>> a.UpdatePipeline()
>>> rawData = servermanager.Fetch(a)
>>> data_cell = rawData.CELL_DATA_FIELD
>>> data_cell
>>> data_cell = rawData.GetCellData
>>> data_cell
<built-in method GetCellData of vtkCommonDataModelPython.vtkUnstructuredGrid object at 0x0000006D08060648>
>>> print data_cell
<built-in method GetCellData of vtkCommonDataModelPython.vtkUnstructuredGrid object at 0x0000006D08060648>
As we can see, this code only gives some simple information, not the actual stress data I need to process. I am wondering how I can access the actual data so I can finish all the calculation in Paraview. And since Paraview can read file series, so I can process the data once and change all of them in all the files.
So my question is how I can get access to the stress data in the vtk file using python shell.
Best,
Teng
Teng Li
Master Candidate in Structures
Department of Civil and Environmental Engineering
University of Illinois at Urbana-Champaign
205 North Mathews Ave, Urbana, IL. 61801
Phone:(217)8196210, Email: tengli2 at illinois.edu
________________________________________
From: Utkarsh Ayachit [utkarsh.ayachit at kitware.com]
Sent: Monday, October 09, 2017 1:06 PM
To: Li, Teng
Cc: paraview at paraview.org
Subject: Re: [Paraview] Saving as csv data
Teng,
In your attached VTK file, stress is a cell data i.e. associated with
each of the cells rather than the points. When you export data as CSV
you can only save points along with point data or cells data and not
both. If you want to save out stress associated with each of the
points, you can apply the "Cell Data To Point Data" filter first and
then save the result out.
Utkarsh
On Mon, Oct 9, 2017 at 1:16 PM, Li, Teng <tengli2 at illinois.edu> wrote:
> Hi all,
>
> I have a question about saving vtk data in a csv file. Please find the
> following link for the vtk file:
>
> https://drive.google.com/file/d/0B-Dmy2O1v21NbGlfTm9odlZpa2M/view?usp=sharinghttps://drive.google.com/file/d/0B-Dmy2O1v21NbGlfTm9odlZpa2M/view?usp=sharing
>
> I expected to see 7 components in the csv file I saved: x, y, z, stress_x,
> stress_y, stress_z, stress_magnitude. However, in the csv file I saved,
> there are only three columns of data. Please find the csv file I saved:
>
> https://drive.google.com/file/d/0B-Dmy2O1v21NeWZnejVqbHEzME0/view?usp=sharinghttps://drive.google.com/file/d/0B-Dmy2O1v21NeWZnejVqbHEzME0/view?usp=sharing
>
> I saved the vtk file by first highlighting the vtk file in the pipeline, and
> then click save data. Then I used the default settings. Is there anything
> wrong in my saving process?
>
> Thanks!
>
> Best,
> Teng
>
> Teng Li
>
> Master Candidate in Structures
>
> Department of Civil and Environmental Engineering
>
> University of Illinois at Urbana-Champaign
>
> 205 North Mathews Ave, Urbana, IL. 61801
>
> Phone:(217)8196210, Email: tengli2 at illinois.edu
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
More information about the ParaView
mailing list