read.asd | R Documentation |
A function to import raw ASD binary files to ascii flat file format
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
)
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. |
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.
Shawn P. Serbin
# 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 (%)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.