Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
adelegem committed Nov 16, 2024
1 parent abcfc85 commit 38b278d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions R/create_multiband_image.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#' @param desired_band_order Order of files to be combined. should be in wavelength order. provide vector of file basenames in correct order
#' @param output_dir Folder to store combined tif file
#' @examples
#' input_dir <- 'inst/extdata/create_multiband_image'
#' input_dir <- system.file("extdata/create_multiband_image", package = "saltbush")
#' output_dir <- tempdir()
#' #create_multiband_image(input_dir, c('blue', 'green', 'red', 'red_edge', 'nir'), output_dir)
#' create_multiband_image(input_dir, c('blue', 'green', 'red', 'red_edge', 'nir'), output_dir)
#' @return combined tif file
#' @export

Expand Down Expand Up @@ -42,13 +42,14 @@ create_multiband_image <- function(input_dir, desired_band_order, output_dir){
combined_image <- combined_image[[match(desired_band_order, band_names)]]

# create output file as .tif and as .envi
output_filename <- file.path(output_dir, paste0(basename(folder), "_combined_image"))
output_filename <- file.path(output_dir, paste0(basename(folder), "_multiband_image"))
# write .tif file
terra::writeRaster(combined_image, filename = paste0(output_filename, '.tif'),
filetype = "GTiff", gdal = c("INTERLEAVE=BAND"), overwrite = TRUE)


# plot image - for checking
# plot(combined_image[[1:5]])
terra::plot(combined_image)
}
}

4 changes: 2 additions & 2 deletions man/create_multiband_image.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 38b278d

Please sign in to comment.