# invalid array name

**URL:** https://discourse.vtk.org/t/invalid-array-name/2605
**Category:** Support
**Created:** [February 13, 2020, 9:44am UTC](https://discourse.vtk.org/t/invalid-array-name/2605 "2020-02-13T09:44:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hao\_hu](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hao_hu/32/1382_2.png) [@hao\_hu](https://discourse.vtk.org/u/hao_hu)
#### Post date: [February 13, 2020, 9:44am UTC](https://discourse.vtk.org/t/invalid-array-name/2605/1 "2020-02-13T09:44:20Z")

</div>

I write  
`calculator = vtk.vtkArrayCalculator() calculator.SetInputConnection(cellToPoint.GetOutputPort()) calculator.SetAttributeType(vtk.vtkDataObject.POINT ) print(calculator.GetNumberOfScalarArrays()) calculator.AddScalarArrayName("VelocityX",0)`  
and I think it’s no problem,but the command windows get me a error message `invalid array name "VelocityX"`,I do not konw where is wrong ,who can help me.Thanks.By the way,the `cellToPoint.GetOutputPort()` output type is vtkPolyData

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 17, 2020, 11:15am UTC](https://discourse.vtk.org/t/invalid-array-name/2605/2 "2020-02-17T11:15:51Z")

</div>

Hi, Hao,

You have to set the name of the scalar array when you create it:

```auto
   vtkSmartPointer<vtkFloatArray> values = vtkSmartPointer<vtkFloatArray>::New();
   values->SetName("VelocityX");

```

kind regards,

Paulo

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 17, 2020, 11:19am UTC](https://discourse.vtk.org/t/invalid-array-name/2605/3 "2020-02-17T11:19:31Z")

</div>

Also, depending on how your code structure is designed, your `calculator` object is going out of scope, thereby destroying your “Velocity0” scalar field before the VTK framework has a chance to use it.
