I have a line in x,y,z format. I would like to duplicate the line in parallel with increasing y values.
For example I have:
x,y,z
320300,6225380,-8.8
320310,6225380,-8.8
320320,6225380,-8.8
There are about 2000 entries.
I would like to create an array of points, such that this line is duplicated with x and z remaining the same but with increasing values of y so I could say, duplicate the line and increase y by 10, starting at 6225380 and ending at 6332640: then tag the x,y,z points onto the file and export as *.csv
example simplified result below:
x,y,z
320300,6225380,-8.8
323310,6225380,-8.8
320320,6225380,-8.8
320300,6225400,-8.8
323310,6225400,-8.8
320320,6225400,-8.8
320300,6225410,-8.8
323310,6225410,-8.8
320320,6225410,-8.8
I have tried the following:
import numpy as np
import pandas as pd
csv_path='PHid4_pts_6225380.csv'
df=pd.read_csv(csv_path)
sp=10
x1=df['x']
y1=np.arange(6225380,6232640,sp)
z1=df['z']
x_mesh, y_mesh =np.meshgrid(x1,y1)
coords = []
for a, b, c in zip(x_mesh, y_mesh, z1):
for a1, b1, c1 in zip(a, b, c):
# for a2, b2, c2 in zip(a1, b1, c1):
coords.append((a1, b1, c1,))
It seems to be working ok until I get to the 'coords=[]' part where I am trying to re use an iterator i picked up elsewhere.
Any help would be much appreciated Thanks, Kaya