[Paraview] script to save plotSelectionOverTime

Jose Javier Munoz Criollo josejmcriollo at gmail.com
Tue Jun 27 08:17:35 EDT 2017


I'm trying to write a script to save the results of 
plotSelectionOverTime. So far no success. I'm using the Trace 
functionality to keep track of the necessary steps. I use Paraview 5.2.0 
64 bit on Fedora 25.

What I have is a data set representing the temperature field in a 2D 
domain. I use the calculator and integrateVariables to estimate the 
thermal energy with respect to a reference temperature. Then I use 
plotSelectionOverTime to plot the result. In the GUI it works well, but 
the generated trace contains all functions related with the creation of 
the different windows. Removing these, I kept what I think are the 
relevant parts for the script:

> from paraview.simple import *
>
> solutionpvd = PVDReader(FileName='/my/path/solution.pvd')
>
> calculator1 = Calculator(Input=solutionpvd)
> calculator1.AttributeMode = 'Point Data'
> calculator1.ResultArrayName = 'Energy (MJ/m)'
> calculator1.Function = 'volumetric_heat_capacity*(temperature-10)/1E6'
>
> integrateVariables1 = IntegrateVariables(Input=calculator1)
>
> plotSelectionOverTime1 = PlotSelectionOverTime(Input=integrateVariables1,
> OnlyReportSelectionStatistics=1,
>                                                Selection=None)
>
> SaveData('/my/path/output_data.csv', proxy=plotSelectionOverTime1, 
> Precision=5,
>          UseScientificNotation=0,
>          WriteAllTimeSteps=0)

I execute the script like this:

> pvpython my_script.py

However, nothing is generated and no error message is printed either. If 
I save the data from integrate variables:

> from paraview.simple import *
>
> solutionpvd = PVDReader(FileName='/my/path/solution.pvd')
>
> calculator1 = Calculator(Input=solutionpvd)
> calculator1.AttributeMode = 'Point Data'
> calculator1.ResultArrayName = 'Energy (MJ/m)'
> calculator1.Function = 'volumetric_heat_capacity*(temperature-10)/1E6'
>
> integrateVariables1 = IntegrateVariables(Input=calculator1)
>
> SaveData('/my/path/output_data.csv', proxy= integrateVariables1, 
> Precision=5,
>          UseScientificNotation=0,
>          WriteAllTimeSteps=0)

I can save the data corresponding to the first time step. If I set 
WriteAllTimeSteps=1, then I produce all timesteps in different files 
which is not useful either since the number of timesteps are too many.

So, my question is, how can I save the output from plotSelectionOverTime 
OR save the data from integrateVariables for all timesteps in the same file.


Regards

Javier




More information about the ParaView mailing list