Hi, I’m writing a reader in Python based on this documentation util.vtkAlgorithm Module — ParaView/Python 5.9.1 documentation How can I load multiple files and assign them a timestep as Paraview does automatically when loading multiple VTK files with a similar filename such as 0000, 0001, etc.?
When I load multiple files using a wildcard, say *.ovf , Paraview only reads the first file from the list. In the documentation, time steps are implemented but this is only done by reading the input’s file time column. In my case I need to assign a “time” based on the filenames. I also found this https://www.paraview.org/Wiki/Animating_legacy_VTK_file_series but I’m not sure how to implement that using the @smproperty decorators .
Is there a way to obtain/access the list of files loaded by Paraview when selecting multiple files so to assign them a time step?
Also, is vtkFileSeriesReader involved when reading multiple files with similar names?
I’m no expert but I believe that in general readers that accept multiple files actually read them in as an explicit list. The wildcard/family selection mechanism is only implemented in the file dialog, but the wildcard is expanded to an explicit list before being passed to the reader.
The XDMF format has a way to define time for each file. If a format does not (or if the times are not defined) then I think each file is given an arbitrary time of 1s,2s,3s, etc. If a format does not support time, then you can create a wrapper meta-file where you define times for each file.
And yes I believe that in general readers are written for an individual file, and the vtkFileSeriesReader is used as a manager to hold all the file names and pass them to the reader as requested.
Thanks, this is very helpful. Do you know where exactly the data changes when updating the time step in Paraview? Is this done in the RequestData method?
The “util.vtkAlgorithm Module” link you originally posted has a few good examples of how to implement RequestData.
I personally followed the PythonCSVReader example pretty closely for updating the timestep and pulling the raw data, except I used an internal dictionary to map timesteps to the associated files (I appended the mappings in the AddFileName method, which is not part of the PythonCSVReader example, and also not shown in the posted code above - I clipped out some of the more complicated/usage-specific stuff).
I see, I ended up doing the same, although it’s a bit hard to map time step floating numbers in a dictionary or list, so for now I’m only using integers. Do you know if there is a way to get the time step index directly from Paraview’s interface?