#' GEDI functions to clip several GEDI files at once
#'
#' This function allows you to clip several GEDI files using rGEDI functions
#' @param inpath characterstring to folder with all files that should be merged (2B level)
#' @param xmin
#' @param xmax
#' @param ymin
#' @param ymax
#' @param out_dir directory name to put in clipped files (will be within folder of original files)
#'
#' @keywords clip
#' @export
#' @examples
#' gedi_clip()
#'
#' @import rGEDI
gedi_clip <- function(inpath, xmin, xmax, ymin, ymax, clip_dir = "rGEDI_2B_clipped"){
if (file.exists(paste0(inpath, "../", clip_dir))==F){
dir.create(file.path(paste0(inpath, "../", clip_dir)), recursive = T)
}
files <- list.files(inpath, full.names = T, recursive = F)
file_clp <- lapply(files, function (i){
# i <- files[1]
file_nm_raw <- substr(basename(i), 1,(nchar(basename(i))-3))
level2b <- readLevel2B(level2Bpath = i)
level2b_clip <- clipLevel2B(level2b, xmin, xmax, ymin, ymax,
output=paste0(inpath, "../", clip_dir, "/", file_nm_raw, "_clip.h5"))
})
}
#gedi_clip(inpath = inpath, xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.