interpolate_spectrum: Calculate spectral values at a different set of wavelengths

Description Usage Arguments Value Note Examples

View source: R/interpolate.spectrum.R

Description

For example interpolate spectral irradiance (or spectral transmittance) values at new wavelengths values.

Usage

1
interpolate_spectrum(w.length.in, s.irrad, w.length.out, fill = NA)

Arguments

w.length.in

numeric array of wavelengths (nm)

s.irrad

a numeric array of spectral values

w.length.out

numeric array of wavelengths (nm)

fill

a value to be assigned to out of range wavelengths

Value

a numeric array of interpolated spectral values

Note

The current version of interpolate uses spline if fewer than 25 data points are available. Otherwise it uses approx. In the first case a cubic spline is used, in the second case linear interpolation, which should be faster.

Examples

1
2
3
4
5
my.w.length <- 300:700
my.s.e.irrad <-
  with(sun.data, interpolate_spectrum(w.length, s.e.irrad, my.w.length))
plot(my.s.e.irrad ~ my.w.length)
lines(s.e.irrad ~ w.length, data=sun.data)

photobiology documentation built on June 25, 2017, 5:03 p.m.

Search within the photobiology package
Search all R packages, documentation and source code