Re: [Numpy-discussion] scan array to extract min-max values (with if condition)

2010-09-11 Thread Brett Olsen
On Sat, Sep 11, 2010 at 4:46 PM, Massimo Di Stefano wrote: > Thanks Pierre, > > i tried it and all works fine and fast. > > my apologize :-( > > i used a wrong "if" statment to represent my needs > > if mydata[i,0] < E or mydata[i,0] > W or mydata[i,1] < N or mydata[i,1] > S : > > ^^ totally wrong

Re: [Numpy-discussion] scan array to extract min-max values (with if condition)

2010-09-11 Thread Massimo Di Stefano
Thanks Pierre, i tried it and all works fine and fast. my apologize :-( i used a wrong "if" statment to represent my needs if mydata[i,0] < E or mydata[i,0] > W or mydata[i,1] < N or mydata[i,1] > S : ^^ totally wrong for my needs^^ this "if" instead : if W < mydata[i,0] < E and S < mydata

Re: [Numpy-discussion] scan array to extract min-max values (with if condition)

2010-09-11 Thread Pierre GM
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 wor

Re: [Numpy-discussion] scan array to extract min-max values (with if condition)

2010-09-11 Thread Massimo Di Stefano
Brett, i tried a different way to solve the problem, using : # import os fpath = '/Users/sasha/py/' input_fp = open( os.path.join(fpath, 'BE3730072600WC20050817.txt'), 'r' ) input_file = input_fp.readlines() N = 234560.94503118 S = 234482.56929822 E = 921336.53116178 W = 921185.

Re: [Numpy-discussion] scan array to extract min-max values (with if condition)

2010-09-11 Thread Massimo Di Stefano
That's awesome! masked array are defintley what i need! thanks to point my attention on it! best regards, Massimo. Il giorno 11/set/2010, alle ore 16.19, Brett Olsen ha scritto: > On Sat, Sep 11, 2010 at 7:45 AM, Massimo Di Stefano > wrote: >> Hello All, >> >> i need to extract data from a

Re: [Numpy-discussion] scan array to extract min-max values (with if condition)

2010-09-11 Thread Brett Olsen
On Sat, Sep 11, 2010 at 7:45 AM, Massimo Di Stefano wrote: > Hello All, > > i need to extract data from an array, that are inside a > rectangle area defined as : > > N, S, E, W = 234560.94503118, 234482.56929822, 921336.53116178, 921185.3779625 > > the data are in a csv (comma delimited text file,

[Numpy-discussion] scan array to extract min-max values (with if condition)

2010-09-11 Thread Massimo Di Stefano
Hello All, i need to extract data from an array, that are inside a rectangle area defined as : N, S, E, W = 234560.94503118, 234482.56929822, 921336.53116178, 921185.3779625 the data are in a csv (comma delimited text file, with 3 columns X,Y,Z) #X,Y,Z 3020081.5500,76.3100,0.0300 3020086.