CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   ParaView (http://www.cfd-online.com/Forums/paraview/)
-   -   Exporting time series to CSV (http://www.cfd-online.com/Forums/paraview/124342-exporting-time-series-csv.html)

mpeti October 2, 2013 12:42

Exporting time series to CSV
 
Dear All,

I am trying to create a script to export a flow rate time series to a CSV file. I create a time series of flow rate values by using the PlotSelectionOverTime filter on an IntegrateVariables output. When I use the "Save Data" in the GUI to create a CSV file with the results it works fine. I would like to automate the process thereby I recorded a script using the "Trace" GUI feature.

The problem is that the export of the CSV file does not show up in the trace script (using Paraview 4.0.1)!

The main problem I face when trying to do the export manually (using the CreateWriter function) is that I need an input that contains the time series values and I don't really know how to access it... It would be nice if the temporal samples related to the PlotSelectionOverTime filter could be exported directly.

In general is there a way to access the array values of a filter specific to a temporal instance? As a last resort it should be possible to step through the frames manually and create separate files for each instance.

Thanks a lot!

wyldckat October 6, 2013 12:53

Greetings Peter,

Sorry, I don't have time this weekend to try this myself, but have a look at this post for ideas: http://www.cfd-online.com/Forums/ope...tml#post446333 post #6

Best regards,
Bruno

mpeti October 7, 2013 05:05

Solution using programmable filter
 
Thanks for the reply!



The solution I have found for my problem was to use a programmable filter to create a vtkTable out out the vtkMultiBlockDataset that is the output of the plotSelectionOverTime filter (with the appropriate selection of the block and column indices):

progFilter=ProgrammableFilter()
progFilter.OutputDataSetType='vtkTable'
progFilter.PythonPath = ''
progFilter.RequestInformationScript = ''
#progFilter.RequestUpdateExtentScript= ''
progFilter.Script = "\
dataTable=self.GetInput().GetBlock(0).GetColumn(0) \n\
output=self.GetTableOutput()\n\
output.AddColumn(dataTable)\n\
"


I believe it is worth mentioning that it is possible to put the debugger breakpoints (pdb.set_trace()) in the progFilter.Script string and this way to figure out what exactly the input of the filter is like.


All times are GMT -4. The time now is 01:25.