| divide_plot | R Documentation |
This function divides a plot (or several plots) into subplots in the relative coordinates system, and returns the coordinates of subplot corners.
divide_plot(
corner_data,
rel_coord,
proj_coord = NULL,
longlat = NULL,
grid_size,
grid_tol = 0.1,
origin = NULL,
tree_data = NULL,
tree_coords = NULL,
corner_plot_ID = NULL,
tree_plot_ID = NULL,
sd_coord = NULL,
n = 100
)
corner_data |
A data frame, data frame extension, containing the plot corner coordinates. Typically, the output |
rel_coord |
A character vector of length 2, specifying the column names (resp. x, y) of the corner relative coordinates. |
proj_coord |
(optional, if longlat is not provided) A character vector of length 2, specifying the column names (resp. x, y) of the corner projected coordinates. |
longlat |
(optional, if proj_coord is not provided) A character vector of length 2, specifying the column names of the corner geographic coordinates (long,lat). |
grid_size |
A vector indicating the dimensions of grid cells (resp. X and Y dimensions). If only one value is given, grid cells will be considered as squares. |
grid_tol |
A numeric between (0;1) corresponding to the percentage of the plot area allowed to be excluded from the plot division (when grid_size doesn't match exactly plot dimensions). |
origin |
Alignment of the subplot grid, based on relative coordinates. If NULL (default), the grid is aligned to the origin corner of the relative coordinates. Alternatively provide a numeric vector of length 2, specifying the relative coordinates to which the grid should be aligned. This option is especially useful when |
tree_data |
A data frame containing tree relative coordinates and other optional tree metrics (one row per tree). |
tree_coords |
A character vector of length 2, specifying the column names of the relative coordinates of the trees. |
corner_plot_ID |
If dealing with several plots: a vector indicating plot IDs for corners. |
tree_plot_ID |
If dealing with several plots: a vector indicating tree plot IDs. |
sd_coord |
used to propagate GPS measurements uncertainties to the subplot polygon areas and the ref_raster footprint in |
n |
used to propagate GPS measurements uncertainties: the number of iterations to be used (as in |
If corner coordinates in the projected coordinate system are provided (proj_coord), projected coordinates of subplot corners are calculated by a bilinear interpolation in relation with relative coordinates of plot corners. Be aware that this bilinear interpolation only works if the plot in the relative coordinates system is rectangular (ie, has 4 right angles).
In order to propagate GPS measurement uncertainties, the sd_coord argument has to be provided and must contains the average standard deviation of the GPS measurements for each corner on the X and Y axes (typically, the output $sd_coord of the check_plot_coord() function). If corner_data contains only one plot, sd_coord must be a numeric. If dealing with several plot, sd_coord must be a data frame of two columns named 'plot_ID' and 'sd_coord' containing respectively the plot IDs and the previous metric (again, see the output $sd_coord of the check_plot_coord() function).
Returns a list containing:
$sub_corner_coord: a data-frame containing as many rows as there are corners corresponding to the subplots, and the following columns :
plot_ID: If dealing with multiple plots: the plot code, else, a column containing an empty character
subplot_ID: The automatically generated subplot code, using the following rule : subplot_X_Y
x_rel and y_rel : the relative X-axis and Y-axis coordinates of subplots corners.
x_proj and y_proj : if proj_coord is provided, the projected X-axis and Y-axis coordinates of subplots corners
$tree_data: the tree_data argument with the subplot_ID of each tree in the last column
$UTM_code: if 'longlat' is provided, a data.frame containing the UTM code of the corner GPS coordinates for each plot
$simu_coord: if sd_coord is provided, a list of n data-tables containing the simulated coordinates
Arthur PERE, Arthur BAILLY, John L. GODLEE
# One plot with repeated measurements of each corner
data("NouraguesPlot201")
check_plot201 <- check_plot_coord(
corner_data = NouraguesPlot201,
proj_coord = c("Xutm","Yutm"), rel_coord = c("Xfield","Yfield"),
trust_GPS_corners = TRUE, draw_plot = FALSE)
subplots_201 <- divide_plot(
corner_data = check_plot201$corner_coord,
rel_coord = c("x_rel","y_rel"), proj_coord = c("x_proj","y_proj"),
grid_size = 50)
subplots_201
# Assigning trees to subplots
data("NouraguesTrees")
plot201_trees <- NouraguesTrees[NouraguesTrees$Plot == 201,]
subplots_201 <- suppressWarnings(
divide_plot(
corner_data = check_plot201$corner_coord,
rel_coord = c("x_rel","y_rel"), proj_coord = c("x_proj","y_proj"),
grid_size = 50,
tree_data = plot201_trees, tree_coords = c("Xfield","Yfield")))
head(subplots_201$sub_corner_coord)
head(subplots_201$tree_data)
# When grid dimensions (40m x 40m) don't fit perfectly plot dimensions
# an origin at (10 ; 10) will center the grid
divide_plot(
corner_data = check_plot201$corner_coord,
rel_coord = c("x_rel","y_rel"),
grid_size = c(40,40),
grid_tol = 0.4,
origin = c(10,10)
)
# Dealing with multiple plots
data("NouraguesCoords")
nouragues_subplots <- suppressWarnings(
divide_plot(
corner_data = NouraguesCoords,
rel_coord = c("Xfield","Yfield"), proj_coord = c("Xutm","Yutm"),
corner_plot_ID = "Plot",
grid_size = 50,
tree_data = NouraguesTrees, tree_coords = c("Xfield","Yfield"),
tree_plot_ID = "Plot"))
head(nouragues_subplots$sub_corner_coord)
head(nouragues_subplots$tree_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.