read.asd: A function to import raw ASD binary files

View source: R/read.asd.R

read.asdR Documentation

A function to import raw ASD binary files

Description

A function to import raw ASD binary files to ascii flat file format

Usage

read.asd(
  file.dir = NULL,
  out.dir = NULL,
  spec.type = NULL,
  start.wave = NULL,
  end.wave = NULL,
  step.size = NULL,
  image = FALSE,
  spec.file.ext = ".asd",
  output.file.ext = ".csv",
  get.metadata = TRUE,
  settings.file = NULL
)

Arguments

file.dir

A single ASD binary file or directory of ASD files to import. Currently only supports single directory processing (i.e. no nested dir structures)

out.dir

Main output directory for processed spectra files. If not set then no output ASCII files are provided. If set then output ASCII files for each spectra are written to out.dir/ascii_files

spec.type

Optional. Option to set the type of spectra being processed. Options: "Reflectance" or "Transmittance" Defaults to "Reflectance"

start.wave

Optional. Selected starting wavelength of ASD binary spectra files. Depends on instrument. If not set then read from file header

end.wave

Optional. Selected ending wavelength of ASD binary spectra files. Depends on instrument. If not set then read from file header

step.size

Optional. Wavelength step size for ASD files. E.g. 1nm, 5nm, 10nm If not set then read from file header. If selected for larger size than raw data, spectrum is interpolated (not yet availible)

image

Logical. Whether to produce .png images of each spectrum (TRUE) or not (FALSE). Default is FALSE. Useful for diagnosing spectral observations during processing.

spec.file.ext

file extension of ASD files. Usually ".asd" (Default)

output.file.ext

optional setting to set file extension to output files. Defaults to .csv

get.metadata

Logical. Run extract.metadata when importing .asd files and place information in a metadata file? TRUE/FALSE. Default is TRUE

settings.file

settings file used for spectral processing options (OPTIONAL). Contains information related to the spectra collection instrument, output directories, and processing options such as applying a jump correction to the spectra files. Options in the settings file take precedent over options selected in the function call.

Value

output for a single file returns a list with wavelengths and measured reflectance or transmittance values. For a directory, outputs individual ascii text files with wavelength and spectra values for each input ASD file.

Author(s)

Shawn P. Serbin

Examples

# Set input file
file.dir <- system.file("extdata/PM01_TIAM_B_LC_REFL00005.asd",package="FieldSpectra")
spec <- read.asd(file.dir,out.dir='~',start.wave=350,end.wave=2500,step.size=1)

# Get info from file header
spec <- read.asd(file.dir,out.dir='~')

# Plot output
plot(spec$Wavelength,spec$Spectra,type="l",lwd=2,xlab="Wavelength (nm)", ylab="Reflectance (%)")



serbinsh/R-FieldSpectra documentation built on March 31, 2022, 10:08 p.m.