get_correction_factors {treePlotArea}R Documentation

Correction Factors for Tree Plot Areas Intersected by Stand Boundaries

Description

Get correction factors for an angle count table (i.e. a data.frame) and a corresponding boundary table (i.e. a data.frame).

Usage

get_correction_factors(
  angle_counts,
  boundaries,
  verbose = TRUE,
  stop_on_error = FALSE,
  skip_check = FALSE,
  counting_factor = 4,
  is_ti_round = TRUE
)

Arguments

angle_counts

A data.frame containing angle counts. It has to have columns named by the contents of either
get_defaults()[["angle_counts"]] or
getOption("treePlotArea")[["angle_counts"]].
Could be bw2bwi2022de(get(data("trees", package = "treePlotArea")))).

boundaries

A data.frame containing boundaries. It has to have columns named by the contents of either
get_defaults()[["boundaries"]] or
getOption("treePlotArea")[["boundaries"]].
Could be get(data("boundaries", package = "treePlotArea")) or the output of get_boundary_polygons.

verbose

Be verbose?

stop_on_error

Passed to get_boundary_polygons.

skip_check

We usually check if the angle counts are suitable (for example whether a diameter at breast height, a horizontal distance and an azimuth measurement are given). Skip this check? This might be of interest if you want to check whether another plot with no dbh recorded (for example a corner) is intersected by a boundary.

counting_factor

The basal area factor used in counting the trees. For tally trees in the German national forest inventory its value is 4 [m^2].

is_ti_round

When checking for the boundary circle of a tree to include the center of the plot: round that circle's radius to the unit (i.e. [cm]) as done by Thuenen Institute?

Details

The columns in the names have to be named according to the values of getOption("treePlotArea"). If they do not: you can either rename the columns or set the option accordingly, probably using set_options.

Value

A data.frame containing the correction factors and a status giving information on possibly errors.

See Also

set_options

Examples

data("trees", "boundaries", package = "treePlotArea")

# For CRAN's sake: draw a subset
tracts <- c(sample(boundaries[["tnr"]], 20), 10056)

# Calculate correction factors
trees <- subset(trees, tnr %in% tracts)
boundaries <- subset(boundaries, tnr %in% tracts)
angle_counts <- bw2bwi2022de(trees)
validate_data(x = boundaries)
validate_data(x = angle_counts)
boundary_polygons <- get_boundary_polygons(boundaries)
correction_factors <- get_correction_factors(angle_counts, boundary_polygons)
summary(correction_factors$status)

#  Select valid angle count trees only
valid_angle_counts <- select_valid_angle_count_trees(angle_counts)
correction_factors <- get_correction_factors(valid_angle_counts,
                                             boundary_polygons)
summary(correction_factors$status)

# Select a single tree
tnr <- 10056
enr <- 4
bnr <- 3
tree <- valid_angle_counts[valid_angle_counts[["tnr"]] == tnr &
                     valid_angle_counts[["enr"]] == enr &
                     valid_angle_counts[["bnr"]] == bnr, TRUE]
bounds <- boundaries[boundaries[["tnr"]] == tnr & boundaries[["enr"]] == enr,
                     TRUE]
get_correction_factors(tree, bounds)

# Deadwood plots:
dead_wood_plots <- unique(trees[TRUE, c("tnr", "enr")])
dead_wood_plots[["bnr"]] <- 0
dead_wood_plots[["hori"]] <- 0
dead_wood_plots[["azi"]] <- 0
dead_wood_plots[["bhd"]] <- 200
get_correction_factors(dead_wood_plots, boundary_polygons,
                       skip_check = TRUE)
# Set the deadwood plot's radius to 500 mm
dead_wood_plots[["bhd"]] <- 5000
# The counting factor has unit square meters per area.
# Area is hardcoded to 10000 [square meters], so to get a plot radius that's
# equal to the dbh, we need 2 * sqrt(counting_factor) / sqrt(10000) to be
# equal to 1.
get_correction_factors(dead_wood_plots, boundary_polygons,
                       skip_check = TRUE,
                       counting_factor = 2500)

[Package treePlotArea version 2.1.0 Index]