I have a boolean array in python and I want to do a calculation on the cells where the value is 'true'. Currently I am using a nested for loop to go trough all the cells to find the cells with the true values. However, running the program takes a lot of time. I was wondering wether there is a faster way to do this?
for i in range (0,latstep):
for j in range (0,lonstep):
if coastline[i,j] == True:
...
Thanks for your help!
coastline?coastline[i,j]is invalid