I am a bit of a newbie to python, and would like a little advice on how to more efficiently process arrays.
I work a lot with satellite data, and have opened and read two binary images into separate 2-D arrays using numarray.fromfile. What I want to do is is test each pixel in each image for various conditions, and depending on which condition the pixel value meets, write a number to a third array which is "empty" (contains pixels whose values are 0).
Up until now I have been using a sequence of numarray.choose statements to test specific conditions. E.g.:
numarray.choose(numarray.greater(array1,0.70),(arr ay3,array2))
numarray.choose(numarray.less_equal(array2,0.30),( array3,array2))...etc...
[If array1 > 0.7 then pixel in array3 takes value of corresponding pixel in array2; If array2 <= 0.30 then pixel in array 3 takes value of array2].
However, how could I code the above if I wanted to test for BOTH conditions to be true (i.e. I want to assign pixels in array3 a specific value IF (and only if) the corresponding pixels in array1 > 0.7 AND array2 <= 0.30)??
Thanks in advance,
Andrew