Show text field changing every time step from programmable filter

(Igor) #1

Hello everyone!
Now I’m trying to get time in YYYY-MM-DD format for animation via programmable filter ( I still haven’t figured out how to write it to new variable, but i’m working on it).

Having a variable same length as number of timesteps, can I write contents of this variable to label (changing along with timestep)?

In raw files (netcdf) time has time like this: “01.01.1948 - 01:00:00”, but now i have to change timeaxis for Paraview.

So, main question is: is it possible to make text source from variable and change it according to timestep?

Side question is, how to make a new variable out of timesteps via programmable filter?

Setting a different title for each frame in an animation
(Cory Quammen (Kitware)) #2

Yes. Use the Python Annotation filter. Attach it to your data source with the field data representing time. If it is named “Time”, your Python Annotation filter should be set to Time[t_index] where t_index is the index of the current timestep selected in ParaView.

1 Like
(Igor) #3

That’s great!
Also, with this I don’t need programmable filter, just change date format as i want

(Igor) #4

Once more, thanks for an answer, and I’ve got following question:

Having time units like Hours since …, how to get date from timestep value?
It is possible via datetime Python module, but I haven’t found the way to do it with Python Annotation. Is it possible?

And some story with additional questions, that made me ask this:

After adding timeaxis to my file I have timesteps like


They are interpreted by Paraview as int, and this is source of my problem.

If i choose Animation View Mode Sequence, i get timestep values between 19820131 and 19820204, for example 19820173, which is bad.

If i choose Animation View Mode Snap To TimeSteps and set Camera to Orbit, while transfer from 19820131 19820204 it jumps a lot and animation is not smooth.

Now I’m trying to build pipeline for visualizing model files with minimum (ideally, no) preprocessing, so I’m trying to avoid file conversions. Maybe, the best solution would be just configurate a reader with all specifications that I want.

(Cory Quammen (Kitware)) #5

I’m afraid I don’t know what your timestep values represent, and I’m not that versed in Python date handling to offer suggestions.

I think you are saying ParaView is displaying a time value that isn’t in your dataset. It is displaying the time requested in ParaView, but the data displayed is the closest available timestep, so there is indeed a mismatch in that regard. I suppose you could round the ParaView time to the closest one in your time array with some Python function.