so I'm wondering what the best technique there is to iterate over an array, and then use those values in a matplotlib function, drawgreatcircles.
Say I have a four-column list of values :
-170.13 -16.57 161.63 -77.37
-170.13 -16.57 163.01 -77.575
127.03 -1.047 162.65 -75.075
127.03 -1.047 160.56 -77.28
127.03 -1.047 161.63 -77.37
127.03 -1.047 163.01 -77.575
And I want to iterate over each row, and use those elements in a matplotlib.basemap function, drawgreatcircle. I know my code below is written poorly, where I'm iterating for each x, for each y, etc... In other words, I'm plotting way more great circles than I need, because each x is iterated with each y, and so on.
All I'd like to do is iterate over each row, where each row is read into the drwagreatcircle function and the line is plotted? I've left out the part of my matplotlib basemap script that plots the figure: what's below is just reading in the values that go into drawgreatcircle.
rays = open('ray_temp', 'r')
paths = rays.readlines()
rays.close()
evlo = []
evla = []
stlo = []
stla = []
for i in paths:
gcarc = i.split()
evlo.append(float(gcarc[0]))
evla.append(float(gcarc[1]))
stlo.append(float(gcarc[2]))
stla.append(float(gcarc[3]))
EVLO = np.array(evlo)
EVLA = np.array(evla)
STLO = np.array(stlo)
STLA = np.array(stla)
for x in np.nditer(EVLO):
for y in np.nditer(EVLA):
for z in np.nditer(STLO):
for w in np.nditer(STLA):
map.drawgreatcircle(x,y,z,w)
plt.show()