R/catalog_fakerun.R

Defines functions catalog_fakerun

# nocov start
catalog_fakerun = function(ctg, sleep = 0.05, pwarning = 0.05, perror = 0.01)
{
  opt_wall_to_wall(ctg) <- FALSE
  options <- list(need_buffer = FALSE, drop_null = FALSE)

  fake = function(x)
  {
    Sys.sleep(sleep)
    if (stats::runif(1) < pwarning) warning("Fake warning", call. = FALSE)
    if (stats::runif(1) < perror) stop("Fake error", call. = FALSE)
    return(0)
  }

  return(catalog_apply(ctg, fake, .options = options))
}
# nocov end

Try the lidR package in your browser

Any scripts or data that you put into this service are public.

lidR documentation built on Sept. 11, 2024, 5:21 p.m.