near neighbour calc almost working - need to sort out writing to csv