On Jul 27, 4:12 pm, Peter Otten <[email protected]> wrote: > Martin wrote: > > The statement works now, but it doesn't give the same results as my > > original logic, strangely!? > > > in my logic: > > > data = np.zeros((numrows, numcols), dtype = np.uint8, order ='C') > > > for i in range(numrows): > > for j in range(numcols): > > if band3[i,j] == 255 or band3[i,j] >= band6[i,j] * factor: > > data[i,j] = 0 > > else: > > data[i,j] = 1 > > > to do the same with what you suggested... > > > data = np.ones((numrows, numcols), dtype = np.uint8, order ='C') > > data[(band3 == 255) | (band6 >= band3 * factor)] = 0 > > Did you swap band3 and band6? If that's the case, it is an error you should > be able to find yourself. > > Please be a bit more careful. > > Also, it is good practice to write a few test cases where you have > precalculated the result. How would you otherwise know which version is > correct? Writing a third one to break the tie? > > Peter
apologies... it was the way I typed it up, I wasn't copying and pasting from my text editor! Thanks Peter. -- http://mail.python.org/mailman/listinfo/python-list
