tmontaigu / pylas

⚠️ pylas was merged into laspy 2.0 https://github.com/laspy/laspy⚠️
BSD 3-Clause "New" or "Revised" License
39 stars 13 forks source link

Write return value #41

Closed excalamus closed 3 years ago

excalamus commented 3 years ago

I'm developing a tool which requires laz files and am looking to use pylas to perform conversions from las on-the-fly. The tool uses a GUI and, although pylas is quick, there's no getting around the volume of data; las files are large and can still take several (10+) seconds to convert. I would like to provide users with a process dialog during the conversion.

To convert, I'm running:

las = pylas.read(las_input)
las.write(laz_output)

It doesn't look like write provides a way to measure progress or a return value indicating completion. Is this something you would be interested in?

It looks like LasData (ultimately) uses LasData._write_to() for the write call. This creates a writer which calls write_points. (I think I linked the correct invocation). This checks a self.done. Is that something which could be returned up the call chain to indicate success?

As for getting progress updates, I'd have to think about how that could be done (another method to avoid a performance hit?), if you're even interested in that. For now, I'm just going to check for the existence of the output file; if it exists, the process completed, right? :).

tmontaigu commented 3 years ago

No, the write method does not have way to indicate progress. I don't think that's something I would want to introduce.

I don't know what GUI lib/framework you are using but a better approach to know if the writing succeeded would be to start the computation in another thread and check if that thread ended, or use communication mechanism of the GUI lib.

Another solution could be to try the alpha version of pylas pip install --pre pylas which has the ability to read and write files by chunks, so yould try to use that if you really want to have some kind of progress bar and not just a busy/waiting bar

excalamus commented 3 years ago

I got ahead of myself and realized right after I posted the issue that I was over-complicating things. Since I want the operation to block, just changing the cursor until the process completed is sufficient. I tried closing the issue to avoid further using up your time (I see no way to delete). I appreciate your response. It's good to know there is a chunk reader; that may be useful to me. I don't see a way to kick you some buckazoids, so I hope my thanks is sufficient. Thank you for your time!