Problems with GetRange()

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.

Calculator creates PointData by default, try changing the AttributeType for the Calculator to CellData.

Thanks a lot, that worked for the calculator!

However, I have another questions:

Out of curiosity, I set the AttributeType to Point Data and changed the GetRange() command to y_vel_range = calc.PointData.GetArray('y_velocity').GetRange(). This gave me the error again. Why is that?

Once you set the AttributeType for the Calculator this means both the input and output would be of that type (cell or point). I assume your input is celldata so you’ll have to use that.
If you want to convert to point data, there is a filter that does that (cell data to point data).

Dan