[Paraview] Using pvpython to load states with filenames
Bill Sherman
shermanw at indiana.edu
Tue May 20 14:18:19 EDT 2014
Greetings all,
A question on how one can use ParaView state files in a scripting mode,
where the file directory is different. To be specific, I'm creating a
state file using the ParaView GUI client (version 4.0.1), and I then save
the state, and then in pvpython I can load the state and write out an
animation. This works fine as long as I'm on the same machine, or at
least have the same directory name containing the data files.
My goal, however, is to now run those animation scripts on a Cray, where
my directory structure is different.
So first a disclaimer -- I figured out how to do this by doing a
mass-substitution
in vim, setting all the filenames to begin with "./" instead of the full
path, and then running pvpython in the directory with the data. This
works.
But, I'd prefer a cleaner/more-elegant means of doing this, and so I come
to this well of information.
First question: is there a way to prevent "pvpython" from loading data
files when then state is read? Otherwise I get a slew of errors when
it discovers that the files don't exist. Somehow the ParaView GUI Client
must do this, because it will provide a popup asking for a new directory
in which to find the missing files.
Second question: ignoring the error messages, I still can't manage to
change the file names and have pvpython use the new names -- so question
is: what am I doing wrong?
Here's the basics of what I've tried:
>>> from paraview.simple import *
>>> servermanager.LoadState("testC.pvsm")
>>> olddir = "/directory-in-state-file"
>>> newdir = "/cray-directory-with-data"
>>> reader = FindSource("jhdata_*")
>>> for num in range(0, len(reader.FileNames)):
... reader.FileNames[num] = reader.FileNames[num].replace(olddir, newdir)
I can then print all the filenames, and they appear to have been changed.
But I can't seem to get the servermanager to recognize this. I tried:
>>> reader.FileNameChanged()
>>> UpdatePipelineInformation()
this returns the error:
---------
ERROR: In
/N/soft/cle4/paraview/ParaView-v4.0.1-source/VTK/IO/Parallel/vtkPDataSetReader.cxx,
line 880
vtkPDataSetReader (0x1fa4d70): Initialize: Could not open file
olddir/jhdata_001.vtk
ERROR: In
/N/soft/cle4/paraview/ParaView-v4.0.1-source/VTK/Common/ExecutionModel/vtkExecutive.cxx,
line 754
vtkPVCompositeDataPipeline (0x1f579f0): Algorithm
vtkFileSeriesReader(0x1fbc7b0) returned failure for request:
vtkInformation (0x13c0890)
Debug: Off
Modified Time: 147820
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
FORWARD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1
----------
I then also tried
>>> reader.UpdatePipeline()
with the same results. If I then tried to call "WriteImage()" or
"WriteAnimation",
it complains and then seg-faults.
Once this is all settled, of course I'll transition to "pvbatch" to
queue things up, which I anticipate should work with what I learn
from interacting with "pvpython".
Thanks!
Bill
--
Bill Sherman
Sr. Technology Advisor
Advanced Visualization Lab
Pervasive Technology Inst
Indiana University
shermanw at indiana.edu
More information about the ParaView
mailing list