Skip to contents

Calculate multipliers for selecting a range of wavelengths and optionally applying a biological spectral weighting function (BSWF) and wavelength normalization. This function returns numeric multipliers that can be used to select a waveband and apply a weight.

Usage

calc_multipliers(
  w.length,
  w.band,
  unit.out = "energy",
  unit.in = "energy",
  use.cached.mult = FALSE,
  fill = 0
)

Arguments

w.length

numeric vector of wavelengths (nm).

w.band

waveband object.

unit.out

character A string: "photon" or "energy", default is "energy".

unit.in

character A string: "photon" or "energy", default is "energy".

use.cached.mult

logical Flag indicating whether multiplier values should be cached between calls.

fill

numeric If fill = NA then values returned for wavelengths outside the range of the waveband are set to NA.

Value

a numeric vector of multipliers of the same length as w.length.

Examples

with(sun.data, calc_multipliers(w.length, new_waveband(400,700),"photon"))
#>   [1] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>   [6] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [11] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [16] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [21] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [26] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [31] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [36] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [41] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [46] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [51] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [56] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [61] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [66] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [71] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [76] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [81] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [86] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [91] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [96] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [101] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [106] 0.000000e+00 0.000000e+00 3.343739e-06 3.352098e-06 3.360457e-06
#> [111] 3.368817e-06 3.377176e-06 3.385535e-06 3.393895e-06 3.402254e-06
#> [116] 3.410613e-06 3.418973e-06 3.427332e-06 3.435691e-06 3.444051e-06
#> [121] 3.452410e-06 3.460769e-06 3.469129e-06 3.477488e-06 3.485847e-06
#> [126] 3.494207e-06 3.502566e-06 3.510926e-06 3.519285e-06 3.527644e-06
#> [131] 3.536004e-06 3.544363e-06 3.552722e-06 3.561082e-06 3.569441e-06
#> [136] 3.577800e-06 3.586160e-06 3.594519e-06 3.602878e-06 3.611238e-06
#> [141] 3.619597e-06 3.627956e-06 3.636316e-06 3.644675e-06 3.653034e-06
#> [146] 3.661394e-06 3.669753e-06 3.678112e-06 3.686472e-06 3.694831e-06
#> [151] 3.703190e-06 3.711550e-06 3.719909e-06 3.728269e-06 3.736628e-06
#> [156] 3.744987e-06 3.753347e-06 3.761706e-06 3.770065e-06 3.778425e-06
#> [161] 3.786784e-06 3.795143e-06 3.803503e-06 3.811862e-06 3.820221e-06
#> [166] 3.828581e-06 3.836940e-06 3.845299e-06 3.853659e-06 3.862018e-06
#> [171] 3.870377e-06 3.878737e-06 3.887096e-06 3.895455e-06 3.903815e-06
#> [176] 3.912174e-06 3.920534e-06 3.928893e-06 3.937252e-06 3.945612e-06
#> [181] 3.953971e-06 3.962330e-06 3.970690e-06 3.979049e-06 3.987408e-06
#> [186] 3.995768e-06 4.004127e-06 4.012486e-06 4.020846e-06 4.029205e-06
#> [191] 4.037564e-06 4.045924e-06 4.054283e-06 4.062642e-06 4.071002e-06
#> [196] 4.079361e-06 4.087720e-06 4.096080e-06 4.104439e-06 4.112798e-06
#> [201] 4.121158e-06 4.129517e-06 4.137877e-06 4.146236e-06 4.154595e-06
#> [206] 4.162955e-06 4.171314e-06 4.179673e-06 4.188033e-06 4.196392e-06
#> [211] 4.204751e-06 4.213111e-06 4.221470e-06 4.229829e-06 4.238189e-06
#> [216] 4.246548e-06 4.254907e-06 4.263267e-06 4.271626e-06 4.279985e-06
#> [221] 4.288345e-06 4.296704e-06 4.305063e-06 4.313423e-06 4.321782e-06
#> [226] 4.330141e-06 4.338501e-06 4.346860e-06 4.355220e-06 4.363579e-06
#> [231] 4.371938e-06 4.380298e-06 4.388657e-06 4.397016e-06 4.405376e-06
#> [236] 4.413735e-06 4.422094e-06 4.430454e-06 4.438813e-06 4.447172e-06
#> [241] 4.455532e-06 4.463891e-06 4.472250e-06 4.480610e-06 4.488969e-06
#> [246] 4.497328e-06 4.505688e-06 4.514047e-06 4.522406e-06 4.530766e-06
#> [251] 4.539125e-06 4.547484e-06 4.555844e-06 4.564203e-06 4.572563e-06
#> [256] 4.580922e-06 4.589281e-06 4.597641e-06 4.606000e-06 4.614359e-06
#> [261] 4.622719e-06 4.631078e-06 4.639437e-06 4.647797e-06 4.656156e-06
#> [266] 4.664515e-06 4.672875e-06 4.681234e-06 4.689593e-06 4.697953e-06
#> [271] 4.706312e-06 4.714671e-06 4.723031e-06 4.731390e-06 4.739749e-06
#> [276] 4.748109e-06 4.756468e-06 4.764828e-06 4.773187e-06 4.781546e-06
#> [281] 4.789906e-06 4.798265e-06 4.806624e-06 4.814984e-06 4.823343e-06
#> [286] 4.831702e-06 4.840062e-06 4.848421e-06 4.856780e-06 4.865140e-06
#> [291] 4.873499e-06 4.881858e-06 4.890218e-06 4.898577e-06 4.906936e-06
#> [296] 4.915296e-06 4.923655e-06 4.932014e-06 4.940374e-06 4.948733e-06
#> [301] 4.957092e-06 4.965452e-06 4.973811e-06 4.982171e-06 4.990530e-06
#> [306] 4.998889e-06 5.007249e-06 5.015608e-06 5.023967e-06 5.032327e-06
#> [311] 5.040686e-06 5.049045e-06 5.057405e-06 5.065764e-06 5.074123e-06
#> [316] 5.082483e-06 5.090842e-06 5.099201e-06 5.107561e-06 5.115920e-06
#> [321] 5.124279e-06 5.132639e-06 5.140998e-06 5.149357e-06 5.157717e-06
#> [326] 5.166076e-06 5.174435e-06 5.182795e-06 5.191154e-06 5.199514e-06
#> [331] 5.207873e-06 5.216232e-06 5.224592e-06 5.232951e-06 5.241310e-06
#> [336] 5.249670e-06 5.258029e-06 5.266388e-06 5.274748e-06 5.283107e-06
#> [341] 5.291466e-06 5.299826e-06 5.308185e-06 5.316544e-06 5.324904e-06
#> [346] 5.333263e-06 5.341622e-06 5.349982e-06 5.358341e-06 5.366700e-06
#> [351] 5.375060e-06 5.383419e-06 5.391778e-06 5.400138e-06 5.408497e-06
#> [356] 5.416857e-06 5.425216e-06 5.433575e-06 5.441935e-06 5.450294e-06
#> [361] 5.458653e-06 5.467013e-06 5.475372e-06 5.483731e-06 5.492091e-06
#> [366] 5.500450e-06 5.508809e-06 5.517169e-06 5.525528e-06 5.533887e-06
#> [371] 5.542247e-06 5.550606e-06 5.558965e-06 5.567325e-06 5.575684e-06
#> [376] 5.584043e-06 5.592403e-06 5.600762e-06 5.609121e-06 5.617481e-06
#> [381] 5.625840e-06 5.634200e-06 5.642559e-06 5.650918e-06 5.659278e-06
#> [386] 5.667637e-06 5.675996e-06 5.684356e-06 5.692715e-06 5.701074e-06
#> [391] 5.709434e-06 5.717793e-06 5.726152e-06 5.734512e-06 5.742871e-06
#> [396] 5.751230e-06 5.759590e-06 5.767949e-06 5.776308e-06 5.784668e-06
#> [401] 5.793027e-06 5.801386e-06 5.809746e-06 5.818105e-06 5.826465e-06
#> [406] 5.834824e-06 5.843183e-06 0.000000e+00 0.000000e+00 0.000000e+00
#> [411] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [416] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [421] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [426] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [431] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [436] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [441] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [446] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [451] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [456] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [461] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [466] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [471] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [476] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [481] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [486] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [491] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [496] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [501] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [506] 0.000000e+00 0.000000e+00 0.000000e+00
with(sun.data, calc_multipliers(w.length, new_waveband(400,700),"photon"), use.cached.mult = TRUE)
#>   [1] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>   [6] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [11] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [16] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [21] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [26] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [31] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [36] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [41] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [46] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [51] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [56] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [61] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [66] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [71] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [76] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [81] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [86] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [91] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#>  [96] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [101] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [106] 0.000000e+00 0.000000e+00 3.343739e-06 3.352098e-06 3.360457e-06
#> [111] 3.368817e-06 3.377176e-06 3.385535e-06 3.393895e-06 3.402254e-06
#> [116] 3.410613e-06 3.418973e-06 3.427332e-06 3.435691e-06 3.444051e-06
#> [121] 3.452410e-06 3.460769e-06 3.469129e-06 3.477488e-06 3.485847e-06
#> [126] 3.494207e-06 3.502566e-06 3.510926e-06 3.519285e-06 3.527644e-06
#> [131] 3.536004e-06 3.544363e-06 3.552722e-06 3.561082e-06 3.569441e-06
#> [136] 3.577800e-06 3.586160e-06 3.594519e-06 3.602878e-06 3.611238e-06
#> [141] 3.619597e-06 3.627956e-06 3.636316e-06 3.644675e-06 3.653034e-06
#> [146] 3.661394e-06 3.669753e-06 3.678112e-06 3.686472e-06 3.694831e-06
#> [151] 3.703190e-06 3.711550e-06 3.719909e-06 3.728269e-06 3.736628e-06
#> [156] 3.744987e-06 3.753347e-06 3.761706e-06 3.770065e-06 3.778425e-06
#> [161] 3.786784e-06 3.795143e-06 3.803503e-06 3.811862e-06 3.820221e-06
#> [166] 3.828581e-06 3.836940e-06 3.845299e-06 3.853659e-06 3.862018e-06
#> [171] 3.870377e-06 3.878737e-06 3.887096e-06 3.895455e-06 3.903815e-06
#> [176] 3.912174e-06 3.920534e-06 3.928893e-06 3.937252e-06 3.945612e-06
#> [181] 3.953971e-06 3.962330e-06 3.970690e-06 3.979049e-06 3.987408e-06
#> [186] 3.995768e-06 4.004127e-06 4.012486e-06 4.020846e-06 4.029205e-06
#> [191] 4.037564e-06 4.045924e-06 4.054283e-06 4.062642e-06 4.071002e-06
#> [196] 4.079361e-06 4.087720e-06 4.096080e-06 4.104439e-06 4.112798e-06
#> [201] 4.121158e-06 4.129517e-06 4.137877e-06 4.146236e-06 4.154595e-06
#> [206] 4.162955e-06 4.171314e-06 4.179673e-06 4.188033e-06 4.196392e-06
#> [211] 4.204751e-06 4.213111e-06 4.221470e-06 4.229829e-06 4.238189e-06
#> [216] 4.246548e-06 4.254907e-06 4.263267e-06 4.271626e-06 4.279985e-06
#> [221] 4.288345e-06 4.296704e-06 4.305063e-06 4.313423e-06 4.321782e-06
#> [226] 4.330141e-06 4.338501e-06 4.346860e-06 4.355220e-06 4.363579e-06
#> [231] 4.371938e-06 4.380298e-06 4.388657e-06 4.397016e-06 4.405376e-06
#> [236] 4.413735e-06 4.422094e-06 4.430454e-06 4.438813e-06 4.447172e-06
#> [241] 4.455532e-06 4.463891e-06 4.472250e-06 4.480610e-06 4.488969e-06
#> [246] 4.497328e-06 4.505688e-06 4.514047e-06 4.522406e-06 4.530766e-06
#> [251] 4.539125e-06 4.547484e-06 4.555844e-06 4.564203e-06 4.572563e-06
#> [256] 4.580922e-06 4.589281e-06 4.597641e-06 4.606000e-06 4.614359e-06
#> [261] 4.622719e-06 4.631078e-06 4.639437e-06 4.647797e-06 4.656156e-06
#> [266] 4.664515e-06 4.672875e-06 4.681234e-06 4.689593e-06 4.697953e-06
#> [271] 4.706312e-06 4.714671e-06 4.723031e-06 4.731390e-06 4.739749e-06
#> [276] 4.748109e-06 4.756468e-06 4.764828e-06 4.773187e-06 4.781546e-06
#> [281] 4.789906e-06 4.798265e-06 4.806624e-06 4.814984e-06 4.823343e-06
#> [286] 4.831702e-06 4.840062e-06 4.848421e-06 4.856780e-06 4.865140e-06
#> [291] 4.873499e-06 4.881858e-06 4.890218e-06 4.898577e-06 4.906936e-06
#> [296] 4.915296e-06 4.923655e-06 4.932014e-06 4.940374e-06 4.948733e-06
#> [301] 4.957092e-06 4.965452e-06 4.973811e-06 4.982171e-06 4.990530e-06
#> [306] 4.998889e-06 5.007249e-06 5.015608e-06 5.023967e-06 5.032327e-06
#> [311] 5.040686e-06 5.049045e-06 5.057405e-06 5.065764e-06 5.074123e-06
#> [316] 5.082483e-06 5.090842e-06 5.099201e-06 5.107561e-06 5.115920e-06
#> [321] 5.124279e-06 5.132639e-06 5.140998e-06 5.149357e-06 5.157717e-06
#> [326] 5.166076e-06 5.174435e-06 5.182795e-06 5.191154e-06 5.199514e-06
#> [331] 5.207873e-06 5.216232e-06 5.224592e-06 5.232951e-06 5.241310e-06
#> [336] 5.249670e-06 5.258029e-06 5.266388e-06 5.274748e-06 5.283107e-06
#> [341] 5.291466e-06 5.299826e-06 5.308185e-06 5.316544e-06 5.324904e-06
#> [346] 5.333263e-06 5.341622e-06 5.349982e-06 5.358341e-06 5.366700e-06
#> [351] 5.375060e-06 5.383419e-06 5.391778e-06 5.400138e-06 5.408497e-06
#> [356] 5.416857e-06 5.425216e-06 5.433575e-06 5.441935e-06 5.450294e-06
#> [361] 5.458653e-06 5.467013e-06 5.475372e-06 5.483731e-06 5.492091e-06
#> [366] 5.500450e-06 5.508809e-06 5.517169e-06 5.525528e-06 5.533887e-06
#> [371] 5.542247e-06 5.550606e-06 5.558965e-06 5.567325e-06 5.575684e-06
#> [376] 5.584043e-06 5.592403e-06 5.600762e-06 5.609121e-06 5.617481e-06
#> [381] 5.625840e-06 5.634200e-06 5.642559e-06 5.650918e-06 5.659278e-06
#> [386] 5.667637e-06 5.675996e-06 5.684356e-06 5.692715e-06 5.701074e-06
#> [391] 5.709434e-06 5.717793e-06 5.726152e-06 5.734512e-06 5.742871e-06
#> [396] 5.751230e-06 5.759590e-06 5.767949e-06 5.776308e-06 5.784668e-06
#> [401] 5.793027e-06 5.801386e-06 5.809746e-06 5.818105e-06 5.826465e-06
#> [406] 5.834824e-06 5.843183e-06 0.000000e+00 0.000000e+00 0.000000e+00
#> [411] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [416] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [421] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [426] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [431] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [436] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [441] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [446] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [451] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [456] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [461] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [466] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [471] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [476] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [481] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [486] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [491] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [496] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [501] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [506] 0.000000e+00 0.000000e+00 0.000000e+00