#' Determine the 16 grid points for the Lamb classification
#'
#' Compute the 16 pair of coordinates necessary for using the objective version of the Lamb method
#'
#' @param x longitude coordinate of the central point of the scheme.
#' @param y latitude coordinate of the central point of the scheme.
#'
#' @return a data.frame with the 16 points of coordinates.
#'
#' @examples
#' points <- get_lamb_points(x = -5, y = 40)
#' points
#'
#' @importFrom dplyr relocate rename filter
#'
#' @export
get_lamb_points <- function(x,y) {
xi <- 10
yi <- 5
gp_y <- y - seq(-10,10,by= 5)
gp_x <- x - c(-15,-5,5,15)
pre_scheme <- expand.grid(gp_y,gp_x) %>%
setNames(c("y","x"))
corners <- subset(pre_scheme, x == min(x) & y == min(y)|
x == min(x) & y == max(y)|
x == max(x) & y == min(y)|
x == max(x) & y == max(y))
jc_scheme <- pre_scheme %>%
cbind.data.frame(interaction(pre_scheme) %in% interaction(corners)) %>%
rename("TF" = 3) %>%
as_tibble() %>%
filter(.data$TF == F) %>%
select(-.data$TF) %>%
cbind.data.frame(c("P6","P10","P14",
"P2","P5","P9","P13","P16",
"P1","P4","P8","P12","P15",
"P3","P7","P11")) %>%
setNames(c("y","x","label")) %>%
relocate(x,.before = y)
return(jc_scheme)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.