lidR Package Output – Where Results are Stored When opt_output_files() is set to Empty

lidr

I'm revisiting code where I've set opt_output_files() <- ""; i.e., no specified location or name. (I would have found this usage online somewhere but can't find the source now.)

Is output stored in a temporary directory? I don't see anything in folder indicated by tempdir().

The pixel_metrics() function has stopped midway, and I am hoping to recover what has been processed so far.

bigCat <- readLAScatalog("F:/working/las")
opt_output_files(bigCat) <- ""
metrics_w2w <- pixel_metrics(bigCat, .stdmetrics_z, res = 20, pkg = "terra")

Best Answer

When the successive outputs are not written to disk they are stored in R memory as regular R objects like any classical code.

When a function processing a catalog fails midway it does not actually fails programmatically speaking and it returns a partial output. In your case metrics_w2w is not empty which would have been the case in an actual failure scenario.

With opt_restart(bigCat) = 42 you can redo the computation starting at chunk 42. However there is no function to merge the first partial output with the second. You must do some processing yourself. But at least the 42 first chunks are not supposed to be lost.

Related Question