Calculate spectral values at a different set of wavelengths

Share:

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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.