[Numpy-discussion] scan array to extract min-max values (with if condition)
Pierre GM
pgmdevlist at gmail.com
Sat Sep 11 17:00:06 EDT 2010
On Sep 11, 2010, at 9:53 PM, Massimo Di Stefano wrote:
> have you hints on how to get working the "MASK" code ?
> as it is now it pick all the points in the "mydata" array.
Brett's code for the mask matched the loop of your post. However, taking a second look at it, I don't see why it would work. Mind trying something like
# Selection on the NS axis
yselect = (mydata[:,1] <= N) & (mydata[:,1] >= S)
# selection on the EW axis
xselect = (mydata[:,1] <= E) & (mydata[:,1] >= W)
# Global selection
selected_data = mydata[xselect & yselect]
Now you can check in selected data that the coordinates are indeed in the rectangle that you want, and take the min/max of your data as needed.
let me know how it goes
P.
More information about the NumPy-Discussion
mailing list