# Remove dataset points via programmable filter

**URL:** https://discourse.paraview.org/t/remove-dataset-points-via-programmable-filter/8639
**Category:** ParaView Support
**Created:** [December 16, 2021, 4:14pm UTC](https://discourse.paraview.org/t/remove-dataset-points-via-programmable-filter/8639 "2021-12-16T16:14:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Captain\_Convergence](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@Captain\_Convergence](https://discourse.paraview.org/u/Captain_Convergence)
#### Post date: [December 16, 2021, 4:14pm UTC](https://discourse.paraview.org/t/remove-dataset-points-via-programmable-filter/8639/1 "2021-12-16T16:14:02Z")

</div>

Dear all,

I am trying to remove points from a dataset based on geometrical conditions. In order to do so I have to get the coordinates of the dataset, select which ones fulfill my conditions and then generate **a new dataset with different number of pointData**. I tried an approach like this one:

```auto
import vtk
from vtkmodules.vtkCommonDataModel import vtkDataSet
import vtk.numpy_interface.dataset_adapter as dsa
import numpy as np

x_old = inputs[0].GetPointData().GetArray('x')
z_old = inputs[0].GetPointData().GetArray('z')

x_new=[]
z_new=[]
cont=0

for i in range(len(x_old)) :
	if x_old[i]>0.12 :   
		x_new.append(x_old[i]) 	
		z_new.append(z_old[i])
		cont=cont+1

output.PointData.append(x_new, 'x_new')
output.PointData.append(z_new, 'z_new')

```

However I think that I am having errors because the length of **x\_new** is not the same as the initial one ( **x\_old** ). How could I generate a new dataset with some of the previous data points with their respective arrays? Thank you in advance!

---

<div class="post-metadata">

### Author: ![Captain\_Convergence](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@Captain\_Convergence](https://discourse.paraview.org/u/Captain_Convergence)
#### Post date: [December 17, 2021, 4:44pm UTC](https://discourse.paraview.org/t/remove-dataset-points-via-programmable-filter/8639/2 "2021-12-17T16:44:31Z")

</div>

Is there any example of generating unstructured data from a set of coordinates in python? I couldn’t find an example like this.
