calc.reflectance: Calculate reflectance spectra using a logfile to assign...

Description Usage Arguments Details Value Examples

Description

Given a log file with columns sample identification, path to reference and sample measurements [id, R, S] and hyperSpec objects that represent reference and sample spectra, this function divides samples by references using the specified pairs

Usage

1
calc.reflectance(reference, sample, logfile = "fieldlog.csv")

Arguments

reference

A hyperSpec object with radiometrically corrected 'reference' spectra

sample

A hyperSpec object with radiometrically corrected 'sample' spectra

logfile

Path to the corresponding logfile for the object

Details

The format of the logfile must be followed (.CSV). FIXME make more flexible

Value

A hyperSpec object of 'reflectance' spectra

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# set path to data files
file.path <- system.file("extdata", package = "FASTSpectra")

# parse spectra into hyperSpec object
dn <- read.txt.OceanOptics(files=paste0(file.path,"/*.txt"))

# assign measurement id and type using fieldlog file
logfile <- paste0(file.path,"/fieldlog.csv")
dn <- assign.type(dn, logfile=logfile)

# split into sample and reference
type <- slot(dn,"data")[["type"]]
dn <- split(x=dn, f=type)

# convert samples to spectral radiance [W / sr m2 nm]
cal.rad <- paste0(file.path,"/*.IrradCal")
rad <- rad.corr(dn$SAMP, type="spectral.radiance", cal.DN2RadiantEnergy = cal.rad)
require(hyperSpec)
plot(rad, wl.range=380:850)

# convert references to spectral irradiance relative to 100% reference panel [W / m2 nm]
cal.ref <- paste0(file.path,"/*.ReflCal")
ref <- rad.corr(dn$REF, type="spectral.irradiance", is.REF=TRUE, cal.DN2RadiantEnergy = cal.rad, cal.RRefPanel = cal.ref)
plot(ref, wl.range=380:850)

# calculate reflectance as 'radiance/irradiance'
SHR <- calc.reflectance(reference=ref, sample=rad, logfile=logfile)
plot(SHR, wl.range=380:850)

edwardpmorris/FASTSpectra documentation built on May 15, 2019, 11:03 p.m.