write.txt.wide.FAST: Write FAST specrum data to text file

Description Usage Arguments Value Examples

Description

Write FAST specrum data to text file

Usage

1
write.txt.wide.FAST(spc, file, file.meta)

Arguments

spc

The hyperSpec object to be written

file

The file path of the spectral data

file.meta

The file path of the associated metadata

Value

None, used for side effect of writing text files

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
29
30
31
# 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)

# write to file
# write.txt.wide.FAST(SHR, paste0(file.path,"/HCRF.spc"), paste0(file.path,"/HCRF-metadata.spc"))

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