[Paraview] Bug 6495: XDMF Reader Fails from Python

Kent Eschenberg eschenbe at psc.edu
Mon Mar 3 17:12:05 EST 2008


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