|
[Sponsors] |
[General] Paraview.simple python module and loading legacy vtk file timeseries |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 17, 2017, 06:12 |
Paraview.simple python module and loading legacy vtk file timeseries
|
#1 |
New Member
Join Date: Mar 2017
Posts: 7
Rep Power: 9 |
I would like to use the Paraview.simple python module to load in a vtk time series containing many many files. I will not be able to type in the files one-by-one. Using the python trace shows a command of the form:
tEST_MPScalar_0 = LegacyVTKReader(FileNames=['D:\\TEMP\\MainProblem4\\TEST_001.vtk', 'D:\\TEMP\\MainProblem4\\TEST_002.vtk', 'D:\\TEMP\\MainProblem4\\TEST_003.vtk', 'D:\\TEMP\\MainProblem4\\TEST_004.vtk' ... 'D:\\TEMP\\MainProblem4\\TEST_500.vtk']) As you can imagine it will be difficult to enter in the file names one-by-one there are over 500. Also I am not importing any other python modules aside from `paraview.simple`. Does the `LegacyVTKReader()` object have any options that account for having a full time series? I would like to avoid having to generate the list of filenames programmatically. These vary on a case by case basis and it would be difficult to cover all the cases... |
|
July 17, 2017, 09:00 |
|
#2 | |
Member
Join Date: Apr 2015
Posts: 37
Rep Power: 11 |
Quote:
Not sure if i understand the problem correct, but the good thing when running Paraview with python scripts is that you can use all the standard syntax for python. An easy and pragmatic approach to your problem could just be to define a "while loop" and assemble the full string with all the filenames. file_count = len([f for f in os.walk(".").next()[2] if f[:5] == "TEST_"]) i=1; list=['D:\\TEMP\\MainProblem4\\TEST_001.vtk'] while i < file_count: list.insert(i, 'D:\\TEMP\\MainProblem4\\TEST_00' + str(i+1) + '.vtk') i=i+1; Hope this will solve your problem, good luck! Cheers |
||
July 17, 2017, 09:40 |
|
#3 |
New Member
Join Date: Mar 2017
Posts: 7
Rep Power: 9 |
Thanks for your response. It turns out I am using a method described by a stackexchange response using the glob module: https://stackoverflow.com/questions/...in-a-directory
It turns out the glob module was already pre-installed with paraview. I will use this for now. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] difficulties installing swak4foam | newbie29 | OpenFOAM Community Contributions | 120 | October 21, 2022 05:01 |
Parallel computing on a personal workstation | choiyun | STAR-CCM+ | 6 | April 10, 2017 10:58 |
[foam-extend.org] Module file foam-extend 3.2 CentOS cluster | KarthickRajkumar | OpenFOAM Installation | 2 | March 26, 2017 14:52 |
[OpenFOAM] Python and paraview.simple libprotobuf error | Private Mandella | ParaView | 1 | October 26, 2016 14:25 |
Linux Batch - Star-CCM+ .. running Sims in batchmode | eRzBeNgEl | STAR-CCM+ | 3 | August 29, 2011 05:43 |