Skip to content

Commit be5e0ce

Browse files
committed
compute only the isotropic correction of Ripley's K
1 parent 80472d4 commit be5e0ce

4 files changed

Lines changed: 29 additions & 27 deletions

File tree

R/calc_tcc_metrics.R

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#' Compute predicted canopy cover from individual tree measurements
22
#'
33
#' `calc_tcc_metrics()` computes predicted plot-level tree canopy cover (TCC)
4-
#' from tree list data. By default, a full set of stand structure metrics used
5-
#' to derive the plot-level TCC value are included in the output (see
6-
#' Details).
4+
#' from standard field inventory measurements. By default, a full set of stand
5+
#' structure metrics used to derive the plot-level TCC value are included in the
6+
#' output (see Details).
77
#'
88
#' @details
99
#' This function provides two methods for predicting plot-level TCC.
@@ -81,13 +81,13 @@
8181
#' frame has a column named `"CRWIDTH"` it will be used for tree crown width
8282
#' values, otherwise, crown widths will be calculated with a call to
8383
#' `calc_crwidth()`.
84-
#' @param stem_map A logical value indicating whether to map individual trees
85-
#' explicitly using coordinates specified in terms of distance and azimuth from
86-
#' subplot/microplot centers. The default is `TRUE`, in which case the input
87-
#' `tree_list` must contain columns `"DIST"` and `"AZIMUTH"`. This argument may
88-
#' be set to `FALSE` if individual tree locations are not available, in which
89-
#' case TCC will be predicted assuming a random arrangement of the stems (see
90-
#' Details).
84+
#' @param stem_map A logical value indicating whether to map individual tree
85+
#' stems explicitly, using coordinates specified in terms of distance and
86+
#' azimuth from subplot/microplot centers. The default is `TRUE`, in which case
87+
#' the input `tree_list` must contain columns `"DIST"` and `"AZIMUTH"`. This
88+
#' argument may be set to `FALSE` if individual tree locations are not
89+
#' available, in which case TCC will be predicted assuming a random arrangement
90+
#' of tree locations (see Details).
9191
#' @param full_output A logical value indicating whether to include the full set
9292
#' of components used to derive the plot-level prediction. By default, the
9393
#' output list includes subplot-level TCC estimates, live tree and sapling
@@ -149,12 +149,13 @@ calc_tcc_metrics <- function(tree_list, stem_map = TRUE, full_output = TRUE,
149149
if (!(is.logical(full_output) && length(full_output) == 1))
150150
stop("'full_output' must be a single logical value", call. = FALSE)
151151

152-
L_mean <- NA_real_ # predictor variable based on Ripley's K
152+
L_mean <- NA_real_
153153
if (stem_map) {
154-
# validates the input tree list for stem-mapping and gets an estimate
154+
# validate the input tree list for stem-mapping and get an estimate
155155
# of the L-function (square root transform of Ripley's K)
156156
# r = 0:12 feet
157-
L <- create_fia_ppp(tree_list) |> spatstat.explore::Lest(r = 0:12)
157+
L <- create_fia_ppp(tree_list) |>
158+
spatstat.explore::Lest(r = 0:12, correction = "isotropic")
158159

159160
# mean of L at r = 6, 8, 10, 12 ft (Ripley's isotropic edge corrected)
160161
L_mean <- mean(L$iso[c(7, 9, 11, 13)])
@@ -243,7 +244,7 @@ calc_tcc_metrics <- function(tree_list, stem_map = TRUE, full_output = TRUE,
243244
}
244245

245246
} else {
246-
# "FVS method" for tree canopy cover (Crookston and Stage 1999)
247+
# FVS method for percent tree canopy cover (Crookston and Stage 1999)
247248
# *** assumes random tree locations ***
248249

249250
if (!("TPA_UNADJ" %in% colnames(tree_list))) {
@@ -252,14 +253,15 @@ calc_tcc_metrics <- function(tree_list, stem_map = TRUE, full_output = TRUE,
252253
}
253254

254255
# "uncorrected" total tree canopy cover without accounting for overlap
256+
# may be > 100
255257
# Crookston and Stage (1999) Eq. 1
256258
tot_crown_area_per_acre <-
257259
sum(tree_list$TPA_UNADJ[tree_list$STATUSCD == 1] * pi *
258260
(tree_list$CRWIDTH[tree_list$STATUSCD == 1] / 2)^2)
259261

260262
uncorrected_tcc <- 100 * tot_crown_area_per_acre / 43560
261263

262-
# corrected plot canopy cover accounting for overlap
264+
# "corrected" TCC accounting for overlap
263265
# Crookston and Stage (1999) Eq. 2
264266
model_tcc <- round(100 * (1 - exp(-0.01 * uncorrected_tcc)), digits)
265267
}

R/spatstat_helpers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
#' background = "gray90", legend = FALSE)
104104
#'
105105
#' # Ripley's K-function
106-
#' K <- spatstat.explore::Kest(X, rmax = 12)
106+
#' K <- spatstat.explore::Kest(X, rmax = 12, correction = "isotropic")
107107
#' plot(K, main = "Ripley's K for the plantation trees")
108108
#' @export
109109
create_fia_owin <- function(linear_unit = "ft", macroplot = FALSE,

man/calc_tcc_metrics.Rd

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/spatstat_helpers.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)