# vtkWarpVector seems to be stripping off my arrays?

**URL:** https://discourse.vtk.org/t/vtkwarpvector-seems-to-be-stripping-off-my-arrays/13685
**Category:** Support
**Created:** [April 10, 2024, 12:29pm UTC](https://discourse.vtk.org/t/vtkwarpvector-seems-to-be-stripping-off-my-arrays/13685 "2024-04-10T12:29:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)
#### Post date: [April 10, 2024, 12:29pm UTC](https://discourse.vtk.org/t/vtkwarpvector-seems-to-be-stripping-off-my-arrays/13685/1 "2024-04-10T12:29:49Z")

</div>

I have a thermomechanical FEM dataset that includes “deformation” vectors. The data comes to me in a giant collection NumPy arrays. The data may have cell connectivity, wherever it is created - but I never see it, and have to create my own:

```python
# Read in location, skin the surface:
pd = vtkPolyData()
pts = vtkPoints()
for loc in locations:
    pts.InsertNextPoint(loc)
pd.SetPoints(pts)
d2 = vtkDelaunay2D()
d2.SetInputData(pd)
d2.Update()

# Read temperature and deformation data:
displacement = numpy_to_vtk(displacement_data)
displacement.SetName("Displacement")
d2.GetOutputDataObject(0).GetPointData().AddArray(displacement)
d2.GetOutputDataObject(0).GetPointData().SetActiveVectors("Displacement")

temperature = numpy_to_vtk(temperature_data)
temperature.SetName("Temperature")
d2.GetOutputDataObject(0).GetPointData().AddArray(temperature)
d2.GetOutputDataObject(0).GetPointData().SetActiveScalars("Temperature")

```

Ok, that’s roughly how I set it up, if I stop in a debugger, the arrays are there (after all, I just added them). Once I run them through vtkWarpVector … they’re gone. I can get this done in ParaView … but I need a script …

```python
wv = vtkWarpVector()
wv.SetInputConnection(d2.GetOutputPort())
wv.Update()
print(wv.GetOutputDataObject(0).GetPointData())
# ^^ arrays are gone :(

```

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [April 10, 2024, 1:20pm UTC](https://discourse.vtk.org/t/vtkwarpvector-seems-to-be-stripping-off-my-arrays/13685/2 "2024-04-10T13:20:44Z")

</div>

`vtkWarpVector` is not stripping the arrays. You are adding them to the output of a filter, and if that filter re-executes, it will recreate the output data object, effectively “stripping” your arrays out.

Make a shallow copy of `d2`’s output instead and work with that.

```python
d3 = vtkPolyData()
d3.ShallowCopy(d2.GetOutputDataObject(0))

```

then add your arrays to `d3` and pass that as the input to `vtkWarpVector`.

```python
wv.SetInputData(d3)

```

---

<div class="post-metadata">

### Author: ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)
#### Post date: [April 10, 2024, 1:58pm UTC](https://discourse.vtk.org/t/vtkwarpvector-seems-to-be-stripping-off-my-arrays/13685/3 "2024-04-10T13:58:34Z")

</div>

Ok - I feel silly! Thanks!

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [April 10, 2024, 2:23pm UTC](https://discourse.vtk.org/t/vtkwarpvector-seems-to-be-stripping-off-my-arrays/13685/4 "2024-04-10T14:23:53Z")

</div>

You are welcome. It’s something that isn’t obvious with the pipeline execution model.
