Skip to content

Commit 767e13a

Browse files
committed
export calc_tcc_metrics()
1 parent f47b7de commit 767e13a

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export(DEFAULT_TREE_COLUMNS)
66
export(calc_crown_overlay)
77
export(calc_crwidth)
88
export(calc_ht_metrics)
9+
export(calc_tcc_metrics)
910
export(create_fia_owin)
1011
export(create_fia_ppp)
1112
export(load_tree_data)

R/calc_tcc_metrics.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@
9999
#' [create_fia_ppp()]
100100
#'
101101
#' @examples
102+
#' # spatially explicit "stem-map model"
102103
#' calc_tcc_metrics(plantation)
104+
#'
105+
#' # "FVS method" assuming random tree locations
106+
#' calc_tcc_metrics(plantation, stem_map = FALSE)
107+
#' @export
103108
calc_tcc_metrics <- function(tree_list, stem_map = TRUE, full_output = TRUE,
104109
digits = 1) {
105110

@@ -109,15 +114,13 @@ calc_tcc_metrics <- function(tree_list, stem_map = TRUE, full_output = TRUE,
109114
if (!(is.logical(full_output) && length(full_output) == 1))
110115
stop("'full_output' must be a single logical value", call. = FALSE)
111116

112-
X <- NULL # spatstat point pattern object
113117
L_mean <- NA_real_ # predictor variable based on Ripley's K
114118
if (stem_map) {
115-
# validate the input tree list for stem-mapping and get X
116-
X <- create_fia_ppp(tree_list)
117-
118-
# get estimate of the L-function (square root transform of Ripley's K)
119+
# validates the input tree list for stem-mapping and gets an estimate
120+
# of the L-function (square root transform of Ripley's K)
119121
# r = 0:12 feet
120-
L <- spatstat.explore::Lest(X, r = 0:12)
122+
L <- create_fia_ppp(tree_list) |> spatstat.explore::Lest(r = 0:12)
123+
121124
# mean of L at r = 6, 8, 10, 12 ft (Ripley's isotropic edge correction)
122125
L_mean <- mean(L$iso[c(7, 9, 11, 13)])
123126
}
@@ -133,7 +136,7 @@ calc_tcc_metrics <- function(tree_list, stem_map = TRUE, full_output = TRUE,
133136

134137
model_tcc <- NA_real_
135138
if (stem_map) {
136-
# "stem-map" canopy cover model (Toney et al. 2009)
139+
# implement the stem-map canopy cover model (Toney et al. 2009)
137140

138141
# subplot and microplot crown overlays
139142
subp_overlay <- rep(NA_real_, 4)

inst/WORDLIST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Moisen
5050
NAIP
5151
NLCD
5252
Nouwakpo
53+
Penttinen
5354
Picotte
5455
Proc
5556
RMRS
@@ -61,6 +62,7 @@ Schleeweis
6162
Shettles
6263
Smail
6364
Spaeth
65+
Stoyan
6466
TCC
6567
Tavernia
6668
Tobin

man/calc_tcc_metrics.Rd

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

0 commit comments

Comments
 (0)