New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User defined function not found during cataloge process for LiDAR metrics extraction #267
Comments
Reproducible example library(lidR)
library(future)
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
plan(multisession, workers = 2L)
ctg <- catalog(LASfile)
opt_chunk_buffer(ctg) <- 20
opt_chunk_size(ctg) <- 160
myMetrics = function(z, i)
{
metrics = list(
imean = mean(i),
z95p = quantile(z, 0.95))
return(metrics)
}
metrics = grid_metrics(ctg, myMetrics(Z,Intensity), res=10) |
This error comes back again and again and again... It has been solved several times and yet it comes back anyway 😢 . The problem is that your user-defined function is not exported in each workers. Thank for reporting the issue. That being said Also opt_filter(ctg) <- "-keep_class 1"
opt_select(ctg) <- "xyzi"
metrics = grid_metrics(ctg, myMetrics(Z,Intensity), res=10) To finish you don't have control on the buffer in |
Hi, I have re-installed the latest version after fix from GitHub (master branch) but the problem is still there. What is now changed: the So here are the details: library(lidR)
library(future)
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
plan(multisession, workers = 2L)
ctg <- catalog(LASfile)
opt_chunk_buffer(ctg) <- 20
opt_chunk_size(ctg) <- 160
opt_select(ctg) <- "xyzi"
myMetrics = function(z, i)
{
metrics = list(
imean = mean(i),
z95p = quantile(z, 0.95))
return(metrics)
}
metrics = grid_metrics(ctg, ~myMetrics(Z, Intensity), res=10) This gives both with and without ~ the following error:
If I try to run the following metrics = grid_metrics(ctg, ~quantile(Z, 0.95), res=10,filter = ~Classification == 1L) I got the following new error:
|
Ok for the first issue there were actually two typos (I don't understand why I found it working yesterday). It works now. For the second issue I fixed it. The filter was not actually working. I suspect a change in the |
Thank you, now it is working. |
Dear JR,
I am trying to use lidR2.1.0 to write a user-defined function for extracting LiDAR metrics. I have got the following error message during the process:
Here is the full code using the external dataset of yours:
I have followed the cran example to write this code. If I put a single R function (like ~quantile(Z, 0.95) it is working. But if I put a function there the code crashes. Do you know what could be the issue?
Thank in advance for your help.
Best,
Zsofia
The text was updated successfully, but these errors were encountered: