#' QWIP: A Quantitative Metric for Quality Control of Aquatic Reflectance
#' Spectral Shape Using the Apparent Visible Wavelength (Dierssen et al., FRS, 2022)
#'
#' @description This function calculates the Quality Water Index Polynomial (QWIP)
#' based on Diesrssen et al 2022 paper.
#'
#' @param RRS A list generated by \code{\link{compute.Rrs.SAS}}
#'
#' @return AVW, NDI, QWIP and QWIP.score
#'
#' @author Simon Bélanger
#' @export
#' @name QWIP.Rrs
QWIP.Rrs <- function(Waves, Rrs) {
# Compute the Apparent Visible Wavelength (AVW)
Waves.int <- (400:700)
ix.492 <- which(Waves.int == 492)
ix.560 <- which(Waves.int == 560)
ix.665 <- which(Waves.int == 665)
# QWIP ocefficients
p1 <- -8.399885e-9
p2 <- 1.715532e-5
p3 <- -1.301670e-2
p4 <- 4.357838e0
p5 <- -5.449532e2
#### Rrs as is with no correction
Rrs.int <- spline(Waves, Rrs, xout=Waves.int, method = "natural")$y
AVW <- sum(Rrs.int)/sum(Rrs.int/Waves.int)
NDI <- (Rrs.int[ix.665] - Rrs.int[ix.492])/(Rrs.int[ix.665] + Rrs.int[ix.492])
QWIP <- p1*(AVW^4) + p2*(AVW^3) + p3*(AVW^2) + p4*AVW + p5
QWIP.score = NDI - QWIP
return(data.frame(AVW=AVW,
NDI=NDI,
QWIP=QWIP,
QWIP.score=QWIP.score))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.