Using David’s example and a very helpful conversation with Sean I was able to 
successfully use a Python track in animation and show the actual simulation 
time.

 

I’m not an experienced Python user (as you’ll see in the example below), but I 
got some simple code to work.  Below is an example of the code I ended up with 
in the Python animation track.  

 

  def start_cue: pass

 

  def tick(self):

    # set up the mapping from time step to date/time information

    #

    dateTimes = []

    dateTimes.append( '4/1/2013 15:00' )

    dateTimes.append( '4/1/2013 15:01' )

    dateTimes.append( '4/1/2013 15:02' )

    dateTimes.append( '4/1/2013 15:03' )

 

    maxIndex = len(dateTimes)

 

    index = int( self.GetClockTime() )

    if index >= maxIndex :

      index = maxIndex - 1

 

    textSource = paraview.simple.FindSource("TheText")

    textSource.Text = dateTimes[index]

 

  def end_cue(self): pass

 

 

Thanks!

 

Phil

 

From: David E DeMarle [mailto:[email protected]] 
Sent: Wednesday, October 08, 2014 5:53 PM
To: Phil Amburn
Cc: [email protected]; [email protected]
Subject: Re: [Paraview] [EXTERNAL] displaying simulation time rather than time 
step

 

I think that Sean is on the right track and suggest that a Python Animation cue 
is the way to go.

 

Attached is a state file to demonstrate. Load the state file in ParaView, open 
Views->Animation View and double click on the existing Python track to see the 
script that gets the pipeline time and feeds it into a text source for display. 
I've left the parts about reading the file and mapping the Animation time into 
the corresponding simulation time as an exercise to the reader.

 

Note: many time varying file formats produce the data time for you so this 
translation is unnecessary and the Annotate Time filter will do what you want 
it to.

 

 

 




David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

 

On Wed, Oct 8, 2014 at 7:53 PM, Phil Amburn <[email protected]> wrote:

Hi Sean,

 

Can we talk?  I’m not smart enough to understand your suggestion (hate it when 
that happens).  

 

If I get something worked out, even a hack, I’ll post the solution back to this 
list.

 

Thanks!

Phil

 

From: ParaView [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Wednesday, October 08, 2014 3:41 PM
To: [email protected]


Subject: Re: [Paraview] [EXTERNAL] displaying simulation time rather than time 
step

 

Hey Phil,
You *might* be able to hack it with a combination of a Programmable Filter and 
a Python Annotation Filter.  Use the Programmable Filter to add a FieldData 
value to each time step that is a string with the appropriate date.  Then use 
the Python Annotation Filter to display the date as an annotation.

The first part is the hard one.  The Programmable Filter could either (1) read 
the file once to get all the dates, or (2) compute the dates using the starting 
date, the time step value, and Python's datetime module.

Thanks,
Sean

  _____  

From: ParaView [[email protected]] on behalf of Scott, W Alan 
[[email protected]]
Sent: Wednesday, October 08, 2014 5:17 PM
To: Phil Amburn; [email protected]
Subject: Re: [Paraview] [EXTERNAL] displaying simulation time rather than time 
step

Phil,

I have no idea how to put out what you are asking for, but it is a really good 
idea.  If you don’t get an answer, be sure to write up a bug report/ feature 
request.

 

Alan

 

From: ParaView [mailto:[email protected]] On Behalf Of Phil Amburn
Sent: Wednesday, October 08, 2014 3:26 PM
To: [email protected]
Subject: [EXTERNAL] [Paraview] displaying simulation time rather than time step

 

I would like to do something similar to the Annotate Time filter, but rather 
than displaying the time step number, I need to display simulation date and 
time.

 

I have a text file with the actual simulation date and time associated with 
each time step.  Here are the first few lines of that file

 

Time step   Time step output, Actual time

0               0.00,           4/1/2013 15:00

1               65.83,          4/1/2013 15:01

2               125.88,         4/1/2013 15:02

3               201.00,         4/1/2013 15:03

4               268.65,         4/1/2013 15:04

5               328.83,         4/1/2013 15:05

6               366.46,         4/1/2013 15:06

 

…

 

So, rather than Time: 0 at the bottom of the 3D window, I’d like to have 
4/1/2013 15:00

 

Any thoughts / recommendations on how to accomplish this task will be greatly 
appreciated.

 

Thanks,

Phil


_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

 

_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to