pyvista / pyvista-support

[moved] Please head over to the Discussions tab of the PyVista repository
https://github.com/pyvista/pyvista/discussions
59 stars 4 forks source link

Time series data support in pyvista #294

Open amine-aboufirass opened 3 years ago

amine-aboufirass commented 3 years ago

Dear All,

Does pyvista provide .pvd file support to organize time series data? I am referring to files like the answer to the following question in stackexchange:

https://stackoverflow.com/questions/33771609/how-to-set-custom-timestep-values-for-a-series-of-legacy-vtk-files-in-paraview

I see in the docs that an example is provided to plot time series. However this does not make use of built in vtk file formats. Rather it updates the scalars within a python loop. This is not really what I'm looking for.

Thanks for your consideration.

banesullivan commented 3 years ago

Duplicate of https://github.com/pyvista/pyvista/issues/414

Requires https://github.com/pyvista/pyvista/issues/412


PyVista steps away from VTK's pipeline model so it doesn't directly support time series rendering of file series. Though this can be easy to hook up on the user side. You'll just have to use pure VTK for the file IO and wrap the output mesh with PyVista then manually call UpdateTimestep on the VTK reader which will propagate to what's plotted in PyVista.

Howver this assumes you don't use any PyVista filters. If wanting to filter, you'll need to use pure VTK there too

ffrancesco94 commented 3 years ago

Hi, Sorry to revive this old thread. I was just wondering why I can't use PyVista filters if I just wrap the output of the reader in a mesh. For example (I use a VTK Ensight reader, but it should apply to any timestepped format I guess):

for step in timestep_list:
    reader.SetTimeValue(time)
    reader.Modified()
    reader.Update()
    pv.wrap(reader.GetOutput())
    # Do my stuff

Is there any particular reason why this wouldn't work?

Thanks, Francesco

banesullivan commented 3 years ago

This will not work because PyVista does not preserve VTK's pipeline model. We chain filters together and do not preserve the pipeline but only the inputs/outputs of the filters. So if you Update the reader, there is no way to propagate that through the PyVista processing chain.

However, this will work if you only care about the reader's output and do not run any filters.

HTH, sorry for the slow response

ffrancesco94 commented 3 years ago

Hi, thank you for your reply. I understand what you meant, but if you look at my code, I'm wrapping each output of the updated reader, so it should use that, or am I misunderstanding completely..?

eudoxos commented 3 years ago

I don't have complete picture of the architecture of pyvista — that said: I am exporting 3d to static HTML (without backend), which contains script like this:

var render_items = [{"docid":"dfddcd9c-4a54-450b-95d7-2993210d303a","root_ids":["1458"],"roots":{"1458":"045f183b-a4aa-4c61-bd39-b42c54cf7207"}}];
                  root.Bokeh.embed.embed_items(docs_json, render_items);

plus JSONs with what is acutally being plotted.

Would it be doable (and somehow fitting the rest of pyvista) to export a slider, which would cause the change the docid (or others) so that the plot would be updated with data for that particual time point?

I understand this would recreate all VTKjs obejcts from scratch every time, but it would be very flexible and resilient regarding topology changes and such.