[Paraview] Bug 6495: XDMF Reader Fails from Python

Eric E. Monson emonson at cs.duke.edu
Tue Mar 4 10:22:23 EST 2008


Hey Kent,

You should probably follow Jean's advice if he knows more about the  
reader status in CVS. I know I have some problems with it, like it  
crashes Python when trying to load a state file with an XdmfReader in  
it. (I checked the same state setup with the same Test1.xmf dataset  
saved as a vtkXMLUnstructuredGrid and it worked fine.)

In the meantime (at least with the CVS version):

1. Regarding your DataInformation question, I only knew to do  
di.DataInformation.GetNumberOfCells() because I was playing around in  
ipython, which is an interpreter which has tab-completion on commands.  
I find it *really* useful when I don't know what I'm doing (--too much  
of the time--) because I can do things like type "di.<tab>" and it  
shows me that GetNumberOfCells isn't one of the options, but if I type  
"di.DataInformation.<tab>" it shows me a bunch of options, including  
the # of cell info.

2. I was able to get your script to work by explicitly adding:  
cut.ContourValues = [0.0]

Talk to you later,
-Eric


On Mar 3, 2008, at 5:12 PM, Kent Eschenberg wrote:

> Thank you very much for the test. I get different results but I'm  
> using 3.2.1, not CVS, on Linux, not OS X:
>
> ===
> vtkXdmfReader : [ ...........]
> Number of Cells = 0
> Number of Data Sets = 0
> Number of Point Data Arrays = 0
> Traceback (most recent call last):
>  File "eric.py", line 17, in ?
>    print "Number of Tuples in first array = %d" %  
> pda1.GetNumberOfTuples()
> AttributeError: 'NoneType' object has no attribute 'GetNumberOfTuples'
> ===
>
> Since your "di" is the result of "GetDataInformation" are you sure  
> the request to, say, get the number of cells should be  
> "di.DataInformation.GetNumberOfCells()" instead of just  
> "di.GetNumberOfCells()" ?
>
> I wouldn't mind upgrading to CVS but I'm not sure is worth it since  
> making a simple cut still doesn't work.
>
> Kent
>
> Eric E. Monson wrote:
>> Hey Kent,
>> In python can you read the Test1.xmf okay, or is that showing the  
>> wrong info, too?
>> Running your cut rendering doesn't work for me, either, but I can  
>> at least see the correct info about Test1.xmf in the  
>> DataInformation. (ParaView CVS on OS X 10.5.2 serial).
>> Running:
>> =======
>> from paraview import servermanager
>> servermanager.Connect()
>> reader = servermanager.sources.XdmfReader()
>> reader.FileName = 'Test1.xmf'
>> reader.UpdatePipeline()
>> di = reader.GetDataInformation()
>> print "Number of Cells = %d" % di.DataInformation.GetNumberOfCells()
>> print "Number of Data Sets = %d" %  
>> di.DataInformation.GetNumberOfDataSets()
>> pd = di.DataInformation.GetPointDataInformation()
>> print "Number of Point Data Arrays = %d" % pd.GetNumberOfArrays()
>> pda1 = pd.GetArrayInformation(0)
>> print "Number of Tuples in first array = %d" %  
>> pda1.GetNumberOfTuples()
>> ======
>> Gives me this output:
>> =======
>> python PVXdmfReaderTest1.py
>> vtkXdmfReader : [ ...........]
>> Number of Cells = 18
>> Number of Data Sets 1
>> Number of Point Data Arrays = 2
>> Number of Tuples in first array = 16
>> -Eric
>> ------------------------------------------------------
>> Eric E Monson
>> Duke Visualization Technology Group
>> On Mar 3, 2008, at 2:50 PM, Kent Eschenberg wrote:
>>> ParaView displays example data Test1.xmf file fine but the same  
>>> steps yield a blank image in Python. See attached Python script.
>>>
>>> I only tried these cases:
>>> - serial pvpython and MPI pvbatch
>>> - Test1.xmf and my own XDMF file with structured grids
>>> - making a cut normal to Z
>>> - 3.2.1 on CentOS 5
>>>
>>> The same Python script works fine if using bluntfin.vts instead of  
>>> the XDMF reader.
>>>
>>> My XDMF file has 1 domain and 2 structured grids. After updating  
>>> the pipeline the reader's list of domain and grid names is  
>>> correct. However the servermanager's DataInformation class reports  
>>> no cells, no points and no point array info.  
>>> GetCompositeDataInformation reports that the number of groups is 0  
>>> while it should be 2.
>>>
>>> This is a major problem as I need to look at some very large  
>>> datasets in batch for analysis and scaling tests.
>>>
>>> All suggestions welcome!
>>>
>>> Kent
>>> Pittsburgh Supercomputing Center
>>> from paraview import servermanager
>>> servermanager.Connect()
>>> implFuncModule = servermanager._createModule( "implicit_functions" )
>>> view = servermanager.CreateRenderView()
>>>
>>> reader = servermanager.sources.XdmfReader()
>>> reader.FileName = "Test1.xmf"
>>>
>>> cutF = implFuncModule.Plane()
>>> cutF.Normal = ( 0.0, 0.0, 1.0 )
>>> cutF.Origin = ( 0.5, 0.5, -0.1 )
>>> cut = servermanager.filters.Cut( Input=reader, CutFunction=cutF )
>>>
>>> cutR = servermanager.CreateRepresentation( cut, view )
>>> cutR.ColorArrayName = ""
>>> cutR.Representation = 1
>>> cutR.Color = ( 1.0, 1.0, 1.0 )
>>>
>>> view.StillRender()
>>> view.ResetCamera()
>>> view.StillRender()
>>> view.WriteImage( "Test1.png", "vtkPNGWriter" )



More information about the ParaView mailing list