[Paraview] Reading several Tecplot files at a time

Berk Geveci berk.geveci at kitware.com
Fri Jul 16 11:46:54 EDT 2010


This is an interesting challenge. Currently, there is no way of having a reader
load multiple files as multiple blocks. You can do time series but not blocks.
The following would have achieved that:

>>> reader = TecplotReader(FileNames=['myfile001.tp','myfile002.tp'])

There is a (slightly hackish) way of achieving what you want. Try the
following script:

from paraview import servermanager as sm
readers = []
for i in range(300):
    r = sm.sources.TecplotReader()
    r.FileNames = "<full path>/myfile%d.tp" % tp
    readers.append(r)
g = GroupDatasets()
g.Input = readers
Show(g)

Ignore the resulting errors. What I did here is to use the low level
ParaView Python API to create 300 readers but not show them in
the GUI. I then used the group filter to create multi-block from all
of them. This will probably be somewhat slow to execute and also
you won't be able to save a working state out of this.

Make sure to adjust the line that sets the filename. My code
would create filenames like myfile1.tp, myfile10.tp. You'll need
some extra logic to add the leading zeros in indices.

-berk

On Fri, Jul 16, 2010 at 7:12 AM, Richard GRENON <richard.grenon at onera.fr> wrote:
> Hello, all.
>
> I have a multi-block geometry described by many Tecplot files, one Tecplot
> file for each block (myfile001.tp, myfile002.tp...). Of course, I can copy
> the mono-block files into one Tecplot multi-block file before running
> Paraview, but the data may be huge (more than 300 file for 2 Gb) and I need
> enough disk space for the copy. So I would like to load all these mono-block
> files in Paraview with one interaction and get the the full geometry into
> one Multi-Block dataset.
>
> Using the GUI to open the files, if I select in the browser the generic name
> "myfiles...tp" in the line beginning with the + sign, only the first file
> 'myfile001.tp' is loaded, and if I select the + sign to see all files, I can
> select only one file at a time.
>
> I tried also the embedded Python shell. The "TecplotReader" is available and
> expects several files because it must be used with the "FileNames" keyword
> ending with an "s". Loading one file works:
>
>>>> reader = TecplotReader(FileNames='myfile001.tp')
>>>> Show(reader)
>>>> Render()
>
> Trying with two file names fails:
>>>> reader = TecplotReader(FileNames='myfile001.tp','myfile002.tp')
>
> File "<console>", line 1
>
> SyntaxError: non-keyword arg after keyword arg (<console>, line 1)
>
>
> Finally, trying a generic name gives no error:
>>>> reader = TecplotReader(FileNames='myfile*.tp')
>>>> Show(reader)
>>>> Render()
>
> But there is nothing in the 3D window, and the object inspector shows NA for
> number of cells, points...
>
> I browsed the PV 3.8.0 sources but I could not find anything related to
> "TecplotReader" in the available py files. I can find only the c++ file for
> this reader, but this does not help me. Does anyone know what is the Python
> TecplotReader syntax to load multiple files?
>
> Best regards.
>
> --
> Richard GRENON
> ONERA
> Departement d'Aerodynamique Appliquee - DAAP/ACI
> 8 rue des Vertugadins
> 92190 MEUDON - FRANCE
> phone : +33 1 46 73 42 17
> fax   : +33 1 46 73 41 46
> mailto:Richard.Grenon at onera.fr
> http://www.onera.fr
>
> _______________________________________________
> 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://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list