[SciPy-User] filtering object

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] filtering object

Giuseppe Falcone
Hi to all,

I'm new to this list and to scipy!
I have a question for you....

I use pdal to elaborate las files (lidar data).
As result of elaboration I have a ndarray like this:

[( 626708.60087012,  4481781.14910498,  7.478, 0, 2, 2, 1, 0, 4, -11., 0, 0,  0.,  7.478),( 626708.34087012,  4481780.92910498,  5.418, 0, 2, 3, 1, 0, 4, -11., 0, 0,  0.,  5.418),....]

the name of dimensions are:
 (u'X', u'Y', u'Z', u'Intensity', u'ReturnNumber', u'NumberOfReturns', u'ScanDirectionFlag', u'EdgeOfFlightLine', u'Classification', u'ScanAngleRank', u'UserData', u'PointSourceId', u'GpsTime', u'HeightAboveGround')

I want to split this array in two subarray: the first with element that have ReturnNumber (fifth value) dimension = 1 and the second with all others elements.


There is an efficient way to do this?
Thanks.

Giuseppe

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: filtering object

Hjalmar Turesson
Seems like you have a structured array.

Try:
B1 = A[A['RetrunNumber'] == 1]
B2 = A[A['RetrunNumber'] != 1]

Where A is your original array, and B1 and B2 are the arrays selected in 'ReturnNumber'.

Best

On Mon, Oct 2, 2017 at 9:26 AM, Giuseppe Falcone <[hidden email]> wrote:
Hi to all,

I'm new to this list and to scipy!
I have a question for you....

I use pdal to elaborate las files (lidar data).
As result of elaboration I have a ndarray like this:

[( 626708.60087012,  4481781.14910498,  7.478, 0, 2, 2, 1, 0, 4, -11., 0, 0,  0.,  7.478),( 626708.34087012,  4481780.92910498,  5.418, 0, 2, 3, 1, 0, 4, -11., 0, 0,  0.,  5.418),....]

the name of dimensions are:
 (u'X', u'Y', u'Z', u'Intensity', u'ReturnNumber', u'NumberOfReturns', u'ScanDirectionFlag', u'EdgeOfFlightLine', u'Classification', u'ScanAngleRank', u'UserData', u'PointSourceId', u'GpsTime', u'HeightAboveGround')

I want to split this array in two subarray: the first with element that have ReturnNumber (fifth value) dimension = 1 and the second with all others elements.


There is an efficient way to do this?
Thanks.

Giuseppe

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user