diff --git a/R/extract_pixel_values.R b/R/extract_pixel_values.R index 10e4144..87f3636 100644 --- a/R/extract_pixel_values.R +++ b/R/extract_pixel_values.R @@ -4,13 +4,14 @@ #' #' @param raster_files directory of input raster files #' @param aoi_files area of interest file - shapefile containing one or more site polygons for each raster +#' @param wavelength_names the wavelength corresponding to each layer of the raster_files #' @return a df with pixel values for each of the image layers #' @examples #' aoi_files <- list.files('inst/extdata/aoi', #' pattern = 'image_aoi.shp$', full.names = TRUE) #' raster_files <- list.files('inst/extdata/multiband_image', #' pattern = '.tif$', full.names = TRUE) -#' pixelvalues <- extract_pixel_values(raster_files, aoi_files) +#' pixelvalues <- extract_pixel_values(raster_files, aoi_files, c('blue','green','red','red_edge','nir')) #' @export extract_pixel_values <- function(raster_files, aoi_files, wavelength_names){ diff --git a/man/extract_pixel_values.Rd b/man/extract_pixel_values.Rd index 1dd8597..b7c79fa 100644 --- a/man/extract_pixel_values.Rd +++ b/man/extract_pixel_values.Rd @@ -4,12 +4,14 @@ \alias{extract_pixel_values} \title{Extract pixel values} \usage{ -extract_pixel_values(raster_files, aoi_files) +extract_pixel_values(raster_files, aoi_files, wavelength_names) } \arguments{ \item{raster_files}{directory of input raster files} \item{aoi_files}{area of interest file - shapefile containing one or more site polygons for each raster} + +\item{wavelength_names}{the wavelength corresponding to each layer of the raster_files} } \value{ a df with pixel values for each of the image layers @@ -22,5 +24,5 @@ aoi_files <- list.files('inst/extdata/aoi', pattern = 'image_aoi.shp$', full.names = TRUE) raster_files <- list.files('inst/extdata/multiband_image', pattern = '.tif$', full.names = TRUE) -pixelvalues <- extract_pixel_values(raster_files, aoi_files) +pixelvalues <- extract_pixel_values(raster_files, aoi_files, c('blue','green','red','red_edge','nir')) } diff --git a/tests/testthat/test-drone_process.R b/tests/testthat/test-drone_process.R index 9db6046..9e9294e 100644 --- a/tests/testthat/test-drone_process.R +++ b/tests/testthat/test-drone_process.R @@ -25,7 +25,7 @@ test_that("extract_pixel_values works", { pattern = '.tif$', full.names = TRUE ) pixelvalues <- extract_pixel_values( - raster_files, aoi_files + raster_files, aoi_files, c('blue','green','red','red_edge','nir') ) expect_true(dim(pixelvalues)[1] > 2000000) expect_true(mean(pixelvalues[,3]) > 0.05 & mean(pixelvalues[,3]) < 0.06)