[pdal] filtering pipeline result

Howard Butler howard at hobu.co
Mon Oct 2 06:52:02 PDT 2017


> 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 <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 <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/cbdf92fa/attachment.html>


More information about the pdal mailing list