[pdal] filtering pipeline result

Giuseppe Falcone falcone.giuseppe at gmail.com
Mon Oct 2 07:00:41 PDT 2017


Thanks for the response, but maybe I didn't explain well what I want.

The pipeline result is 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, 1, 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.

So, I have:

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

Thanks

Giuseppe

2017-10-02 15:52 GMT+02:00 Howard Butler <howard at hobu.co>:

>
> On Oct 2, 2017, at 5:50 AM, Giuseppe Falcone <falcone.giuseppe at gmail.com>
> wrote:
>
> Hi to all,
>
> I have a pipe that elaborate a las file. on the pipe.arrays[0] command I
> have, as result, a ndarray.
> I want to split this array in twa subarray: the first with element that
> have ReturnNumber dimension = 1 and the second with all others elements.
>
> There is an efficient way to do this?
>
>
> numpy.where is probably the cleanest way to do this purely in python
> https://docs.scipy.org/doc/numpy-1.13.0/reference/
> generated/numpy.where.html
>
> return_nos = pipe.arrays[0]['ReturnNumber']
> firsts = np.where(return_nos < 2)
>
>
> Another way would be to write a pipeline with two readers.las, two
> filters.range, and a filters.merge. Both readers.las would read the same
> file, and each filters.range would define the range [1] of ReturnNumber you
> wanted in each set. Then you would use a filters.merge to bring them back
> together into two separate arrays. This approach is less than ideal due to
> the fact that you end up reading the same file twice.
>
> Howard
>
> [1] https://www.pdal.io/stages/filters.range.html#ranges
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20171002/c8d8df2a/attachment.html>


More information about the pdal mailing list