# Problems with GetRange()

**URL:** https://discourse.paraview.org/t/problems-with-getrange/8120
**Category:** ParaView Support
**Tags:** python
**Created:** [October 4, 2021, 8:31am UTC](https://discourse.paraview.org/t/problems-with-getrange/8120 "2021-10-04T08:31:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![benediktB](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/9f8e36/32.png) [@benediktB](https://discourse.paraview.org/u/benediktB)
#### Post date: [October 4, 2021, 8:31am UTC](https://discourse.paraview.org/t/problems-with-getrange/8120/1 "2021-10-04T08:31:07Z")

</div>

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:

```auto
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:

```auto
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.

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.paraview.org/user_avatar/discourse.paraview.org/danlipsa/32/1563_2.png) [@danlipsa](https://discourse.paraview.org/u/danlipsa)
#### Post date: [October 4, 2021, 1:14pm UTC](https://discourse.paraview.org/t/problems-with-getrange/8120/2 "2021-10-04T13:14:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![benediktB](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/9f8e36/32.png) [@benediktB](https://discourse.paraview.org/u/benediktB)
#### Post date: [October 4, 2021, 1:46pm UTC](https://discourse.paraview.org/t/problems-with-getrange/8120/3 "2021-10-04T13:46:32Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.paraview.org/user_avatar/discourse.paraview.org/danlipsa/32/1563_2.png) [@danlipsa](https://discourse.paraview.org/u/danlipsa)
#### Post date: [October 4, 2021, 2:02pm UTC](https://discourse.paraview.org/t/problems-with-getrange/8120/4 "2021-10-04T14:02:51Z")

</div>

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
