Dear community,
I use pvbatch-scripts to create images of my simulation results. I use the paraview version 5.7.0_mesa.
I want to get the range of an array I create with filters from the original arrays.
Here is an example:
def open_data(filename):
data = pv.XDMFReader(FileNames=[filename])
data.CellArrayStatus = ['velocity']
return data
def get_y_velocity_range( file ) :
data = open_data( file )
calc = pv.Calculator( registrationName='x_calculator', Input=data )
calc.ResultArrayName = 'y_velocity'
calc.Function = 'velocity_Y'
y_vel_range = calc.CellData.GetArray('y_velocity').GetRange()
print( y_vel_range )
pv.Delete( data )
del data
return calc
Whatever filter I use (in this example the Calculator
), when I don’t use the GetRange()-function on an original array (in this example velocity
), I get the following error message:
Traceback (most recent call last):
File "../../range_example.py", line 43, in <module>
Main()
File "../../range_example.py", line 39, in Main
get_y_velocity_range( f )
File "../../range_example.py", line 21, in get_y_velocity_range
y_vel_range = data.CellData.GetArray('y_velocity').GetRange()
AttributeError: 'NoneType' object has no attribute 'GetRange'
What am I doing wrong? From the message it seems to me, that the array ‘y_velocity’ does not exist. But I can display the results of calc
in a RenderView, so this array has to exist.