1

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")

1 Answer 1

1

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.

2
  • Thank you for the answer. It doesn't look possible to stop the process I'm running now (it's stuck on 2594/7738) without losing metrics_w2w by terminating R. Maybe this is a memory limitation of my computer, if so I think my other option is to write the results to disk and then merge them after.
    – Ray J
    Oct 6, 2022 at 17:43
  • 1
    If you need to kill the R session it is indeed another issue. But with 7000+ files you should really put your output in file so they persist even if the session itself crashes. with so many data it might indeed be related to memory.
    – JRR
    Oct 6, 2022 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.