Skip to content
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

Handle more errors in pitfree() #286

Closed
Jean-Romain opened this issue Oct 9, 2019 · 4 comments
Closed

Handle more errors in pitfree() #286

Jean-Romain opened this issue Oct 9, 2019 · 4 comments
Assignees
Labels
Enhancement Not actually a bug but a possible improvement

Comments

@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Oct 9, 2019

All the following cases should be handled internally and should fail nicely

library(lidR)
#> Le chargement a nécessité le package : raster
#> Le chargement a nécessité le package : sp

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile)

# 0 points
las2 = lasfilter(las, Z >= 33)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20)))
#> Warning in min(x@data$X): aucun argument trouvé pour min ; Inf est renvoyé
#> Warning in max(x@data$X): aucun argument pour max ; -Inf est renvoyé
#> Warning in min(x@data$Y): aucun argument trouvé pour min ; Inf est renvoyé
#> Warning in max(x@data$Y): aucun argument pour max ; -Inf est renvoyé
#> Error in validityMethod(object): invalid extent: xmin >= xmax

# 3 points
las2 = lasfilter(las, Z >= 31.92)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20)))
#> Error in algorithm(las, layout): Interpolation failed. Input parameters might be wrong.

# 3 points
las2 = lasfilter(las, Z >= 31.92)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20), subcircle = 0.2))
#> Error in `[.data.table`(dt, , f(X, Y, Z, px, py), by = rownames(dt)): 'by' appears to evaluate to column names but isn't c() or key(). Use by=list(...) if you can. Otherwise, by=eval(rownames(dt)) should work. This is for efficiency so data.table can detect which columns are needed.


# 4 points
las2 = lasfilter(las, Z >= 31.9)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20)))
#> Error in algorithm(las, layout): Interpolation failed. Input parameters might be wrong.

# 4 points (works)
las2 = lasfilter(las, Z >= 31.9)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20), subcircle = 0.2))

Created on 2019-10-09 by the reprex package (v0.3.0)

@Jean-Romain Jean-Romain changed the title Handle more error in pitfree() Handle more errors in pitfree() Oct 9, 2019
@Jean-Romain Jean-Romain self-assigned this Oct 9, 2019
@Jean-Romain Jean-Romain added the Enhancement Not actually a bug but a possible improvement label Oct 9, 2019
@Jean-Romain
Copy link
Collaborator Author

library(lidR)
#> Le chargement a nécessité le package : raster
#> Le chargement a nécessité le package : sp

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile)

# 0 points
las2 = lasfilter(las, Z >= 33)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20)))
#> Error: The point cloud contains 0 point

# 3 points
las2 = lasfilter(las, Z >= 31.92)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20)))
#> Error: There are not enought points to triangulate.

# 3 points
las2 = lasfilter(las, Z >= 31.92)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20), subcircle = 0.2))


# 4 points
las2 = lasfilter(las, Z >= 31.9)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20)))

# 4 points (works)
las2 = lasfilter(las, Z >= 31.9)
chm <- grid_canopy(las2, res = 0.5, pitfree(thresholds = c(0,2,5,10,15,20), subcircle = 0.2))

Created on 2019-10-10 by the reprex package (v0.3.0)

@mmacander
Copy link

I am running 2.1.4 and still having an issue with pitfree causing an apply_catalog job to crash.

@Jean-Romain
Copy link
Collaborator Author

Jean-Romain commented Oct 12, 2019

If you are referring to this issue is has not been fixed yet. I'm not able to reproduce. If you have some bug please report in a new issue with a reproducible example. I'm waiting for a bug report from the person who asked this question on stackexchange (is it you?) before to release 2.1.4.

@mmacander
Copy link

I did not ask the original question but I did just submit a bug report with reproducible example (#288)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Not actually a bug but a possible improvement
Projects
None yet
Development

No branches or pull requests

2 participants