[Paraview] Reading several Tecplot files at a time

Richard GRENON richard.grenon at onera.fr
Mon Jul 19 03:49:42 EDT 2010


Thank you Berk for this useful script.

I had just to modify this line:

r.FileNames = "<full path>/myfile%d.tp" % tp

In fact, it must end with "% i" which is the index of the loop, not with 
"% tp".
And finally a remark: before building the Tecplot files names, it must 
be kept in mind that the index of the loop starts from 0, not from 1.

I first tried this script with only three files (myfile0.tp, myfile1.tp, 
myfile2.tp). I get many Warning messages from the Proxy manager, but it 
works. The geometry is not visible after running the script, although it 
contains the Show command and the "eye" in the pipeline is not greyed, 
but it becomes visible when I select the "Reset" button in the Toolbar.
All I have to do now is simply to rename my 300 files that actually 
don't have following numbers inside their name.

Thanks again.

Richard.

Berk Geveci wrote:
> 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
>>
>>     
>
>
>
>   

-- 
 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



More information about the ParaView mailing list