我试图通过“pvpython 脚本”从 exodus 数据集中提取单行浓度曲线。
我试图实施的程序取自这里(第 2 篇文章):
http://www.cfd-online.com/Forums/paraview/96308-extracting-paraview-data-into-python-arrays.html
下面粘贴的代码是我尝试使此过程适应我的问题:
import paraview
from paraview.simple import *
from paraview import servermanager
servermanager.Connect()
#paraview.simple._DisableFirstRenderCameraReset()
out_split_1_e = ExodusIIReader( FileName=['/home/kribby/Documents/projects/Inputs_and_Data/determine_kappa2/cont_OX/6/kappa0a1/out_split.1.e'] )
#~
SliceFile = Slice(out_split_1_e)
SliceData = paraview.servermanager.Fetch(SliceFile)
print SliceData
numCells = SliceData.GetNumberOfCells()
data=[]
for x in range(numCells):
data.append(SliceData.GetCellData().GetArray('p').GetValue(x))
print data
运行此代码时,我收到以下错误(TERMINAL PASTE):
> Number Of Components: 0
> Number Of Tuples: 0
> Number Of Children: 4
> Child 0: NULL
> Child 1: NULL
> Child 2: NULL
> Child 3: NULL
>Traceback (most recent call last):
> File "testarray.py", line 13, in <module>
> numCells = SliceData.GetNumberOfCells()
>AttributeError: GetNumberOfCells
我似乎无法解决这个问题。任何人都可以解释一下吗?
非常感谢您提前。