Hi all!

I have a tree with branches with data of z-coordinates. The first list (marked with 1) is what it looks like now and the second list (marked with 2) is what I want it to look like. The final list will consist of approx 500 branches with varying length of each branch.

The data is sorted by z-coordinates from smallest to largest within each branch and one branch each for values with the same x- and y-coordinates.

What I want to do is it to check if the next value in the list is bigger than 2 of the previous and if it is then just keep the first value. So in the example, 9.2 is 0.9 units bigger than 8.3 so then it should just keep 8.3. It can be maximum three values that is within the range of 2 units and then I want it to keep the middle value.

So in reality what it will check is if the window consists of two parts, I want to keep the lower point. The window can consist of maximum three parts and then I want to keep the middle one.

I expect that I need to use a Python script but I have not made it work as it seems too complicated.

Does anyone know how to solve this?

Thanks in advance!