Skip to contents

Insert new wavelength values into a spectrum interpolating the corresponding spectral data values.

Usage

insert_spct_hinges(spct, hinges = NULL, byref = FALSE)

Arguments

spct

an object of class "generic_spct"

hinges

numeric vector of wavelengths (nm) at which the s.irrad should be inserted by interpolation, no interpolation is indicated by an empty vector (numeric(0))

byref

logical indicating if new object will be created by reference or by copy of spct

Value

a generic_spct or a derived type with variables w.length and other numeric variables.

Note

Inserting wavelengths values "hinges" immediately before and after a discontinuity in the SWF, greatly reduces the errors caused by interpolating the weighted irradiance during integration of the effective spectral irradiance. This is specially true when data has a large wavelength step size.

Examples


insert_spct_hinges(sun.spct, c(399.99,400.00,699.99,700.00))
#> Object: source_spct [524 x 3]
#> Wavelength range 280-800 nm, step 0.01-1 nm 
#> Label: sunlight, simulated 
#> Measured on 2010-06-22 09:51:00 UTC 
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#>  s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1] 
#> --
#> # A tibble: 524 × 3
#>    w.length s.e.irrad s.q.irrad
#>       <dbl>     <dbl>     <dbl>
#>  1     280          0         0
#>  2     281.         0         0
#>  3     282.         0         0
#>  4     283.         0         0
#>  5     284.         0         0
#>  6     285.         0         0
#>  7     286.         0         0
#>  8     286.         0         0
#>  9     287.         0         0
#> 10     288.         0         0
#> # ℹ 514 more rows
insert_spct_hinges(sun.spct,
                   c(199.99,200.00,399.50,399.99,400.00,699.99,
                         700.00,799.99,1000.00))
#> Object: source_spct [526 x 3]
#> Wavelength range 280-800 nm, step 0.01-1 nm 
#> Label: sunlight, simulated 
#> Measured on 2010-06-22 09:51:00 UTC 
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#>  s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1] 
#> --
#> # A tibble: 526 × 3
#>    w.length s.e.irrad s.q.irrad
#>       <dbl>     <dbl>     <dbl>
#>  1     280          0         0
#>  2     281.         0         0
#>  3     282.         0         0
#>  4     283.         0         0
#>  5     284.         0         0
#>  6     285.         0         0
#>  7     286.         0         0
#>  8     286.         0         0
#>  9     287.         0         0
#> 10     288.         0         0
#> # ℹ 516 more rows