Skip to content

Commit

Permalink
noSuggest
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Jul 8, 2024
1 parent 6a66de3 commit 61a16fa
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 20 deletions.
6 changes: 3 additions & 3 deletions R/algorithm-dec.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#'
#' # Reach a pulse density of 1 on the overall dataset
#' thinned1 = decimate_points(las, random(1))
#' plot(grid_density(las))
#' plot(grid_density(thinned1))
#' plot(rasterize_density(las))
#' plot(rasterize_density(thinned1))
#' @name sample_random
random = function(density, use_pulse = FALSE)
{
Expand Down Expand Up @@ -91,7 +91,7 @@ random = function(density, use_pulse = FALSE)
#'
#' # Select points randomly to reach an homogeneous density of 1
#' thinned <- decimate_points(las, homogenize(1,5))
#' plot(grid_density(thinned, 10))
#' plot(rasterize_density(thinned, 10))
#' @name sample_homogenize
homogenize = function(density, res = 5, use_pulse = FALSE)
{
Expand Down
5 changes: 3 additions & 2 deletions R/algorithm-dtm.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ knnidw = function(k = 10, p = 2, rmax = 50)
#'
#' This function is made to be used in \link{rasterize_terrain} or \link{normalize_height}. It
#' implements an algorithm for spatial interpolation. Spatial interpolation is based on universal
#' kriging using the \link[gstat:krige]{krige} function from \code{gstat}. This method combines the
#' kriging using the `krige()` function from \code{gstat}. This method combines the
#' KNN approach with the kriging approach. For each point of interest it kriges the terrain using
#' the k-nearest neighbour ground points. This method is more difficult to manipulate but it is also
#' the most advanced method for interpolating spatial data.
#'
#' @param k numeric. Number of k-nearest neighbours. Default 10.
#' @param model A variogram model computed with \link[gstat:vgm]{vgm}. If NULL it performs an ordinary
#' @param model A variogram model computed with `vgm()` from package `gstat`. If NULL it performs an ordinary
#' or weighted least squares prediction.
#'
#' @export
Expand All @@ -125,6 +125,7 @@ knnidw = function(k = 10, p = 2, rmax = 50)
#' plot_dtm3d(dtm)
#' }
#' @name dtm_kriging
#' @md
kriging = function(model = gstat::vgm(.59, "Sph", 874), k = 10L)
{
assert_package_is_installed("gstat")
Expand Down
4 changes: 2 additions & 2 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' Plot displays a 3D interactive windows based on rgl for \link{LAS} objects\cr\cr
#' Plot displays an interactive view for \link[=LAScatalog-class]{LAScatalog} objects with pan and
#' zoom capabilities based on \link[mapview:mapview-package]{mapview}. If the coordinate reference
#' zoom capabilities based on `mapview()` from package `mapview`. If the coordinate reference
#' system (CRS) of the \code{LAScatalog} is non empty, the plot can be displayed on top of base maps
#' (satellite data, elevation, street, and so on).\cr\cr
#' Plot displays a \link[=LASheader-class]{LASheader} object exactly like it displays a LAScatalog
Expand Down Expand Up @@ -46,7 +46,7 @@
#' @param overlaps logical. Highlight the overlaps between files.
#'
#' @param ... Will be passed to \link[rgl:3dobjects]{points3d} (LAS) or \link[graphics:plot.default]{plot}
#' if \code{mapview = FALSE} or to \link[mapview:mapView]{mapview} if \code{mapview = TRUE} (LAScatalog).
#' if \code{mapview = FALSE} or to `mapview()` if \code{mapview = TRUE} (LAScatalog).
#'
#' @examples
#' \dontrun{
Expand Down
2 changes: 1 addition & 1 deletion R/utils_threads.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ get_lidr_threads = function()
#' @noRd
try_to_get_num_future_cores = function()
{
if (!"future" %in% rownames(installed.packages()))
if (!"future" %in% rownames(utils::installed.packages()))
return(1L)

# nocov start
Expand Down
4 changes: 2 additions & 2 deletions man/dtm_kriging.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sample_homogenize.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/sample_random.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions tests/testthat/test-classify_ground.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ opt_progress(ctg) <- FALSE
ws = seq(3,21, 5)
th = seq(0.1, 2, length.out = length(ws))

mypmf = pmf(ws, th)
mycsf = csf(TRUE, 1, 1, time_step = 1)

test_that("classify_ground pmf works with LAS", {

mypmf = pmf(ws, th)

las <- classify_ground(las, mypmf)

n = names(las)
Expand All @@ -30,6 +29,8 @@ test_that("classify_ground pmf works with LAS", {
test_that("classify_ground pmf works with LAScatalog", {
opt_chunk_buffer(ctg) <- 30

mypmf = pmf(ws, th)

expect_error(classify_ground(ctg, mypmf), "output file")

opt_output_files(ctg) <- paste0(tempdir(), "/file_{XLEFT}_{YBOTTOM}")
Expand All @@ -44,6 +45,8 @@ test_that("classify_ground csf works with LAS", {

skip_if_not_installed("RCSF")

mycsf = csf(TRUE, 1, 1, time_step = 1)

las <- classify_ground(las, mycsf)

n = names(las)
Expand All @@ -58,6 +61,8 @@ test_that("classify_ground csf works with LAScatalog", {
skip_if_not_installed("RCSF")
skip_on_cran()

mycsf = csf(TRUE, 1, 1, time_step = 1)

opt_output_files(ctg) <- paste0(tempdir(), "/file_{XLEFT}_{YBOTTOM}_ground")
opt_chunk_buffer(ctg) <- 30

Expand Down Expand Up @@ -102,7 +107,7 @@ test_that("makeZhangParam works", {
})

test_that("classify_ground does not erase former classification (but new ground points)", {

mypmf = pmf(ws, th)
las <- topography
las <- filter_poi(las, X < mean(X), Y < mean(Y))
las$Classification[las$Classification == LASGROUND] <- LASUNCLASSIFIED
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-print.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test_that("print works with lidR algorithms ", {
k <- tin()
j <- p2r(2)
l <- random(2)
m <- csf()
m <- pmf(3,4)
#o <- wing2015()
p <- Roussel2020()

Expand Down

0 comments on commit 61a16fa

Please sign in to comment.