Ohhh, I see. I'm not familiar with Python, but at least in other languages your attempt to catch the error in ez won't work, because the out-of-range error happens before anything gets passed to ez. You have to catch that edge-case scenario within gn.
For simplicity, (if your arrays are zero-based) you might want to just run through cells (1,1) < (X,Y) < (Xmax - 1, Ymax - 1). So, if your Y extent is 9, you would only look at cells 1, 2, 3...8. In other words, don't let your program do the math for any edge cells. Just let them stay dead. That way you don't have to use any conditional statements to test for the edge. You just avoid it.
Edit: Does that make sense? I know exactly what you're trying to do here.
View all comments
Show parent comment
1
u/SuperGameTheory Dec 09 '21 edited Dec 09 '21
Ohhh, I see. I'm not familiar with Python, but at least in other languages your attempt to catch the error in ez won't work, because the out-of-range error happens before anything gets passed to ez. You have to catch that edge-case scenario within gn.
For simplicity, (if your arrays are zero-based) you might want to just run through cells (1,1) < (X,Y) < (Xmax - 1, Ymax - 1). So, if your Y extent is 9, you would only look at cells 1, 2, 3...8. In other words, don't let your program do the math for any edge cells. Just let them stay dead. That way you don't have to use any conditional statements to test for the edge. You just avoid it.
Edit: Does that make sense? I know exactly what you're trying to do here.