[Paraview] Load series of VTK files
Ian Krukow
i.krukow at tu-braunschweig.de
Mon Mar 9 06:41:17 EDT 2015
Thank you for your suggestions! Still: No matter which one I choose, I
would have to edit every new set of files, before I can load it into
ParaView.
I have now set up a (very small) pvypthon module vtuseries.py, which
looks like this:
import os,glob
import paraview.simple as pv
def load(directory):
"""Load VTU file series from given directory
"""
pattern = os.path.join(directory, '*.vtu')
files = glob.glob(pattern)
reader = pv.XMLUnstructuredGridReader( FileName=files )
Putting this module on the path of the ParaView Python Shell gives me
the opportunity to run
import vtuseries
vtuseries.load(directory)
from the Python Shell, which creates a reader with all the vtu files in
the given directory. Maybe this is not even easier than the other
suggestions, but it is closer to what I had been looking for originally.
I thought there might be a better way to run python code depending on a
given parameter (the input directory) in the ParaView GUI, but I have
not found it.
One last question to the developers: Is there a special reason, that it
is not possible to select several VTK files from the Open dialog, which
are then opened as a sequence?
Kind regards
Ian
Am 06.03.2015 um 16:58 schrieb Marco Nawijn:
> On Fri, Mar 6, 2015 at 3:06 PM, <dkxls23 at gmail.com
> <mailto:dkxls23 at gmail.com>> wrote:
>
> Well, if you don't want to rename the data files then you could use
> a PVD wrapper file:
> http://www.paraview.org/Wiki/ParaView/Data_formats
>
> Never created one myself, but you could write out one from paraview
> and modify it.
>
> But maybe somebody else has a better idea altogether...
>
> -Armin
>
>
>
>
> On Fri Mar 6 15:13:17 2015 GMT+0200, Ian Krukow wrote:
> > Yes, that would work. I could write me a script for renaming the
> files.
> > But I would rather avoid that, as I get the result files from a
> project
> > partner with the simulation time in the filename. So, they are named
> > something like
> > file_t=0.0012.vtu
> > file_t=0.0024.vtu
> > ...
> > As soon as t passes 1, ParaView sees a new series. In addition, the
> > first timestep has a different filename, because it is a steady-state
> > solution. I could remove the dots in the time values and rename the
> > steady-state solution, but I would have to do it every time I get
> a new
> > file series. Therefore, I have been looking for another solution.
> >
> > Kind regards
> > Ian
> >
> >
> >
> > Am 06.03.2015 um 11:56 schrieb dkxls23 at gmail.com
> <mailto:dkxls23 at gmail.com>:
> > > Have you tried to name the files like this:
> > > fileName.0000.vtu
> > > fileName.0001.vtu
> > > fileName.0002.vtu
> > > ...
> > >
> > > ParaView should recognize them as a time series.
> > >
> > > That typically worked for me (cannot test it though at the moment).
> > >
> > > -Armin
> > >
> > >
> > >
> > >
> > > On Fri Mar 6 12:36:01 2015 GMT+0200, Ian Krukow wrote:
> > >> Hi all,
> > >>
> > >> I want to load a series of VTU files, which are all stored in one
> > >> directory, but not numbered in a way that ParaView recognises
> them as
> > >> one series. In a python script, I can do it like this:
> > >>
> > >> import glob
> > >> import paraview.simple as pv
> > >> pattern = 'directory/*.vtu'
> > >> files = glob.glob(pattern)
> > >> reader = pv.XMLUnstructuredGridReader( FileName=files )
> > >>
> > >> The directory may be an input parameter to the script.
> > >> How can I transfer this into the GUI with the directory as a
> parameter?
> > >>
> > >> I have looked at python macros, but obviously it is not
> possible to
> > >> define any parameters there.
> > >> Is it possible to run a script from the python shell with a
> parameter?
> > >> I also took a look at the Programmable Source. It should be a
> possible
> > >> solution, but I have not found much explanation of what to do.
> > >>
> > >> Any ideas are welcome.
> > >> Kind regards
> > >> Ian
> > >> _______________________________________________
> > >> Powered by www.kitware.com <http://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
> > >>
> > >> Search the list archives at:
> http://markmail.org/search/?q=ParaView
> > >>
> > >> Follow this link to subscribe/unsubscribe:
> > >> http://public.kitware.com/mailman/listinfo/paraview
> > >>
> > >
> >
>
> --
> Sent from my Jolla
> _______________________________________________
> Powered by www.kitware.com <http://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
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
> What about creating symbolic links (or shortcuts) to the
> real files. In this way you preserve the original filenames.
>
> PVD wrapper files also worked fine for me in the past.
> I have not used them recently however.
>
> Marco
More information about the ParaView
mailing list