From 5a79202d7e2e361f0b07a5cdce8e6cbae90a30c7 Mon Sep 17 00:00:00 2001
From: jmmonnet <jean-matthieu.monnet@inrae.fr>
Date: Tue, 9 Nov 2021 16:30:57 +0100
Subject: [PATCH] updated function names, removed buffer points

---
 R/area-based.2.model.calibration.Rmd     | 15 ++++++++++-----
 R/area-based.3.mapping.and.inference.Rmd |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/R/area-based.2.model.calibration.Rmd b/R/area-based.2.model.calibration.Rmd
index b63f1d7..7303ee3 100644
--- a/R/area-based.2.model.calibration.Rmd
+++ b/R/area-based.2.model.calibration.Rmd
@@ -81,20 +81,25 @@ metrics_terrain <- metrics_terrain[plots$plot_id, ]
 
 # ALS metrics computation
 
-Two types of metrics can be computed.
+Two types of vegetation metrics can be computed.
 
 * Point cloud metrics are directly computed from the point cloud or from the derived surface model on the whole plot extent. These are the metrics generally used in the area-based approach.
 + Tree metrics are computed from the characteristics of trees detected in the point cloud (or in the derived surface model). They are more CPU-intensive to compute and require ALS data with higher density, but in some cases they allow a slight improvement in models prediction accuracy.
 
 ## Point cloud metrics
 
-Point cloud metrics are computed with the function `lidaRtRee::clouds_metrics`, which applies the `lidR::cloud_metrics` to all point clouds in the list. Default computed metrics are those proposed by the function [`lidR::stdmetrics`](https://github.com/Jean-Romain/lidR/wiki/stdmetrics). Additional metrics are available with the function `lidaRtRee::ABAmodelMetrics`.
+Point cloud metrics are computed with the function `lidaRtRee::clouds_metrics`, which applies the `lidR::cloud_metrics` to all point clouds in a list. Default computed metrics are those proposed by the function [`lidR::stdmetrics`](https://github.com/Jean-Romain/lidR/wiki/stdmetrics). Additional metrics are available with the function `lidaRtRee::aba_metrics`. The buffer points, which are located outside of the plot extent inventoried on the field, should be removed before computing those metrics
 
 ```{r computeMetrics, include=TRUE}
 # define function for later use
 aba_point_metrics_fun <- ~ lidaRtRee::aba_metrics(Z, Intensity, ReturnNumber, Classification, 2)
+# create list of point clouds without buffer
+llas_height_plot_extent <-
+  lapply(llas_height, function(x) {
+    lidR::filter_poi(x, buffer == FALSE)
+  })
 # apply function on each point cloud in list
-metrics_points <- lidaRtRee::clouds_metrics(llas_height, aba_point_metrics_fun)
+metrics_points <- lidaRtRee::clouds_metrics(llas_height_plot_extent, aba_point_metrics_fun)
 round(head(metrics_points[, 1:8], n = 3), 2)
 ```
 
@@ -136,7 +141,7 @@ metrics <- cbind(
 
 ## Calibration for a single variable
 
-Once a dependent variable (forest parameter of interest) has been chosen, the function `lidaRtRee::ABAmodel` is used to select the linear regression model that yields the highest adjusted-R^2^ with a defined number of independent variables, while checking linear model assumptions. A Box-Cox transformation of the dependent variable can be applied to normalize its distribution, or a log transformation of all variables (parameter `transform`). Model details and cross-validation statistics are available from the returned object.
+Once a dependent variable (forest parameter of interest) has been chosen, the function `lidaRtRee::aba_build_model` is used to select the linear regression model that yields the highest adjusted-R^2^ with a defined number of independent variables (metrics), while checking linear model assumptions. A Box-Cox transformation of the dependent variable can be applied to normalize its distribution, or a log transformation of all variables (parameter `transform`). Model details and cross-validation statistics are available from the returned object.
 
 ```{r modelCalibration, include=TRUE, message = FALSE, warning = FALSE}
 variable <- "G_m2_ha"
@@ -243,7 +248,7 @@ When calibrating a statistical relationship between forest stand parameters, whi
 
 Stratum-specific models are computed and stored in a list during a `for` loop. The function `lidaRtRee::aba_combine_strata` then combines the list of models corresponding to each stratum to compute aggregated statistics for all plots, making it easier to compare stratified with non-stratified models.
 
-In this example, the model for "private" yields a large error on the plot "Verc-C5-1", which considerably lowers the accuracy of the stratified approach.
+In this example, the model for "private" ownership yields a large error on the plot "Verc-C5-1", which considerably lowers the accuracy of the stratified approach.
 
 ```{r stratifiedmodelCalibration, include=TRUE, warning = FALSE}
 # stratification variable
diff --git a/R/area-based.3.mapping.and.inference.Rmd b/R/area-based.3.mapping.and.inference.Rmd
index 2c586c7..79e28c4 100644
--- a/R/area-based.3.mapping.and.inference.Rmd
+++ b/R/area-based.3.mapping.and.inference.Rmd
@@ -440,7 +440,7 @@ raster::plot(prediction_map_public, main = "Public model", zlim = limits, xaxt =
 
 ### Forest mask and thresholds
 
-To avoid applying models in non-forest areas and to remove the extremes values that may have been predicted due to outliers in the ALS and metrics values, the function `lidaRtRee::clean_raster` can be applied:
+To avoid applying models in non-forest areas and to remove the extremes values that may have been predicted due to outliers in the ALS point cloud and metrics values, the function `lidaRtRee::clean_raster` can be applied:
 
 * it applies a lower and upper threshold to map values,
 * it sets to 0 the NA values in the map,
-- 
GitLab