PDAL / python

PDAL's Python Support
Other
116 stars 34 forks source link

executing pdal pipeline into laspy File object. #43

Closed spolloni closed 4 years ago

spolloni commented 4 years ago

I find laspy's File object a bit more convenient to work with than the structured arrays obtained from pipeline.arrays. I am trying to avoid the following workflow:


import pdal
import laspy

pipeline_json = """
                [
                    {
                        "type": "readers.ept",
                        "filename": "/path/to/ept.json",
                        "bounds": "([{xmin}, {xmax}], [{ymin}, {ymax}])"
                    },
                    "some/file.las"
                ]
                """.format(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)

pipeline = pdal.Pipeline(pipeline_json)
pipeline.validate() 
pipeline.execute()

somefile = laspy.file.File('some/file.las', mode='r')

by not writing any intermediate files to disk. Is this currently possible?

hobu commented 4 years ago

I find laspy's File object a bit more convenient to work with

I'm interested to hear what's missing in PDAL's Python API. I am unfortunately the designer of both APIs 😄 laspy's interface is just arrays too, or am I missing something?

spolloni commented 4 years ago

@hobu thanks for responding so promptly!

The convenience is admittedly selfish, as I was hoping not to rewrite several existing functions that expect File instances as argument -- and will call, say, somefile.return_num instead of somearray['ReturnNumber'].

With that said, I do find laspy's syntax a bit more elegant in that it feels more pythonic and object-oriented, though I guess that's a matter of taste. I enjoy being able to pass around a self-contained object having all attributes easily accessible, including everything in somefile.header.

I am very new to PDAL's python API, however, so my take is probably biased.

hobu commented 4 years ago

Closing for now. Please reopen if there will be more discussion on the topic.