diff --git a/DESCRIPTION b/DESCRIPTION index 1044ce6bffd6fc780584813a5525dabed71efd46..99e41c37f6a4bcbe2460082d0c94f8b91fd26818 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: lidaRtRee Type: Package -Version: 4.0.7 +Version: 4.0.8 Title: Forest Analysis with Airborne Laser Scanning (LiDAR) Data -Date: 2024-09-13 +Date: 2025-01-22 Authors@R: c( person("Jean-Matthieu", "Monnet", email = "jean-matthieu.monnet@inrae.fr", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9948-9891")), person("Pascal", "Obstétar", email = "pascal.obstetar@onf.fr", role = c("ctb"), comment = c(ORCID = "0000-0002-2811-7548"))) diff --git a/NEWS.md b/NEWS.md index 3aac860caa588058a36bf2075d5ac92886137e57..6b26bc6007d292659259f69976cf8c68aa82aa64 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +# lidaRtRee 4.0.8 + +## Change + +* number of threads used by package `lidR` set to 2 in examples. +* projection information (epsg 2154) added to external data `las_chablais3.las`. + # lidaRtRee 4.0.7 ## New @@ -8,7 +15,7 @@ ## Change * `boxcox_tr()` and `boxcox_itr()` do not automatically replace `0` with `NA` anymore. -* `RasterLayer` objects are not supported anymore as the `raster` package package is now obsolete. +* `RasterLayer` objects are not supported anymore as the `raster` package is now obsolete. * in `aba_build_model()`, when specified the minimum `threshold` parameter now replaces non finite values in predictions. * added `...` argument in `aba_build_model()`: passed to `leaps::regsubsets()` diff --git a/R/aba.R b/R/aba.R index 9dd6f998b9b829a405ef19de9642c5d840d5cfa8..01e4889b7d6dbd94160e554caf554e3372681fc2 100755 --- a/R/aba.R +++ b/R/aba.R @@ -54,7 +54,7 @@ #' data(quatre_montagnes) #' # build ABA model for basal area, with all metrics as predictors #' model_aba <- aba_build_model(quatre_montagnes$G_m2_ha, quatre_montagnes[, 9:76], -#' transform = "boxcox", nmax = 3 +#' transform = "boxcox", nmax = 2 #' ) #' # summary of regression model #' summary(model_aba$model) @@ -624,9 +624,10 @@ aba_combine_strata <- function(model.list, plotsId = NULL) { #' @examples #' # load Quatre Montagnes dataset #' data(quatre_montagnes) -#' # build ABA model for basal area, with all metrics as predictors -#' model_aba <- aba_build_model(quatre_montagnes$G_m2_ha, quatre_montagnes[, 9:76], -#' transform = "boxcox", nmax = 3 +#' # build ABA model for basal area, with three metrics as predictors +#' model_aba <- aba_build_model(quatre_montagnes$G_m2_ha, +#' quatre_montagnes[, c("zpcum8", "ipcumzq70", "p_hmin")], +#' transform = "log", nmax = 2 #' ) #' #' # plot field values VS predictions in cross-validation diff --git a/R/common.R b/R/common.R index afcc2a20d7854600f6db25c6e32bbeb558030917..8c42036d3cbf73a6b7bc33d5279cadae69612bca 100755 --- a/R/common.R +++ b/R/common.R @@ -16,8 +16,6 @@ aa_las_chablais3 <- function() { LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee") las_chablais3 <- lidR::readLAS(LASfile) - # set projection - lidR::projection(las_chablais3) <- 2154 las_chablais3 } @@ -43,9 +41,9 @@ aa_las_chablais3 <- function() { #' # load LAS file #' LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee") #' las_chablais3 <- lidR::readLAS(LASfile) -#' # set projection -#' lidR::projection(las_chablais3) <- 2154 #' +#' # set number of threads +#' lidR::set_lidr_threads(2) #' # create a digital surface model with first-return points, resolution 0.5 m #' dsm <- points2DSM(lidR::filter_first(las_chablais3), res = 0.5) #' @@ -95,9 +93,9 @@ points2DSM <- function(.las, res = 1, xmin, xmax, ymin, ymax) { #' # load LAS file #' LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee") #' las_chablais3 <- lidR::readLAS(LASfile) -#' # set projection -#' lidR::projection(las_chablais3) <- 2154 -#' +#' +#' # set number of threads +#' lidR::set_lidr_threads(2) #' # create digital terrain model with points classified as ground #' dtm <- points2DTM(las_chablais3) #' diff --git a/R/extdata.R b/R/extdata.R index 801103b658717ab6b85348df018085b7b5758662..350a468a1a5cd976829312ef4e1dbd888db74f46 100755 --- a/R/extdata.R +++ b/R/extdata.R @@ -17,8 +17,6 @@ #' @examples #' LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee") #' las_chablais3 <- lidR::readLAS(LASfile) -#' # set projection information -#' lidR::projection(las_chablais3) <- 2154 #' las_chablais3 #' @name las_chablais3 NULL diff --git a/R/metrics.R b/R/metrics.R index 649df8595eca8ea80d785155314c9b0ee110c512..dbd9f08570965ba9747af4aa901cac4366b2fbd2 100755 --- a/R/metrics.R +++ b/R/metrics.R @@ -20,9 +20,9 @@ #' # load LAS file #' LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee") #' las_chablais3 <- lidR::readLAS(LASfile) -#' # set projection -#' lidR::projection(las_chablais3) <- 2154 -#' +#' +#' # set number of threads +#' lidR::set_lidr_threads(2) #' # extract four point clouds from LAS object #' llas <- list() #' llas[["A"]] <- lidR::clip_circle(las_chablais3, 974350, 6581680, 10) @@ -109,7 +109,9 @@ clouds_metrics <- function(llasn, #' # load LAS file #' LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee") #' las_chablais3 <- lidR::readLAS(LASfile) -#' +#' +#' # set number of threads +#' lidR::set_lidr_threads(2) #' # extract two point clouds from LAS object #' llas <- lidR::clip_circle(las_chablais3, #' c(974350, 974390), @@ -235,6 +237,8 @@ std_tree_metrics <- function(x, area_ha = NA) { #' @return a data.frame with altitude, exposition (gr), slope (gr) and adjR2 of #' plane fitting #' @examples +#' # set number of threads +#' lidR::set_lidr_threads(2) #' # sample points #' XYZ <- data.frame(x = runif(200, -10, 10), y = runif(200, -10, 10)) #' XYZ$z <- 350 + 0.3 * XYZ$x + 0.1 * XYZ$y + rnorm(200, mean = 0, sd = 0.5) @@ -348,6 +352,8 @@ terrain_points_metrics <- function(p, centre = NULL, r = NULL) { #' LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee") #' las_chablais3 <- lidR::readLAS(LASfile) #' +#' # set number of threads +#' lidR::set_lidr_threads(2) #' # extract two point clouds from LAS object #' llas <- lidR::clip_circle(las_chablais3, #' c(974350, 974390), diff --git a/R/tree_detection.R b/R/tree_detection.R index b0e82e8c49a05ad5cfb0f975f0a9da84b9d43bac..896e2372ca0bc7b9ef23f47c0f55e0980f8f86c1 100755 --- a/R/tree_detection.R +++ b/R/tree_detection.R @@ -1145,7 +1145,7 @@ cimg2Raster <- function(cimg, r = NULL) { #' filtered to avoid effect of holes on volume and surface computation #' @param NA_replace numeric. value to replace NA values with. #' @param maxpixels numeric. maximum number of pixels to be converted to cimg -#' (argument passed to \code{\link{as.cimg}}). +#' (argument passed to \code{\link[imager]{as.cimg}}). #' @return A cimg object #' @examples #' data(chm_chablais3) diff --git a/README.md b/README.md index 37f14f672e1d0f412a5835406b7068afcc30fc1d..ca47d4db66ba7c82d894d371104daa05433d6110 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ # Install -* `R` >= 4.2.3 recommended, package `lidR` >= 4.0.0 required. +* `R` >= 4.2.3 recommended, package `lidR` >= 4.1.1 required. * Install from [CRAN](https://cran.r-project.org/package=lidaRtRee), by running in the `R` console: `install.packages("lidaRtRee")`. * Build development version from source with the `devtools` package: `devtools::install_git("https://forgemia.inra.fr/lidar/lidaRtRee")`.