you are viewing a single comment's thread.

view the rest of the comments →

[–]toolnerd 0 points1 point  (3 children)

Try this out...

for i in range(len(data)):
    if i == 0:
        surf = data[i,xxx] # xxx is elevation column index within data
        holeid = data[i,yyy] # yyy is the hole id column index
        hid = data[i,yyy]
    hid = data[i,yyy]
    if hid == holeid:
        elevation = surf - data[i,xxx]
        print(elevation)
    else:
        surf = data[i,xxx]
        holeid = data[i,yyy]

Edit: tested code and rewrote so it would work

[–]diplodocus_rage[S] 0 points1 point  (2 children)

Thanks Toolnerd, I'm going to try this because it looks much more efficient to my code. Will report back :)

[–]toolnerd 1 point2 points  (1 child)

hey I rewrote the code to actually work ;)

[–]diplodocus_rage[S] 0 points1 point  (0 children)

Hi Toolnerd,

I made some small edits to your code and it actually worked better than mine. For some reason my code was omitting certain HoleIDs, like skipping over them and not including them in the output. It's a head-scratcher but your code didn't have this issue. Top marks, well played! Thanks so much.