[SciPy-User] filtering object

Hjalmar Turesson hturesson at gmail.com
Mon Oct 2 09:35:28 EDT 2017


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'.


See abut structured arrays here:
https://docs.scipy.org/doc/numpy-1.13.0/user/basics.rec.html
and recarrays:
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.recarray.html

Best

On Mon, Oct 2, 2017 at 9:26 AM, Giuseppe Falcone <falcone.giuseppe at gmail.com
> 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
> SciPy-User at python.org
> https://mail.python.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-user/attachments/20171002/996ba681/attachment.html>


More information about the SciPy-User mailing list