% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/backscatter.R
\name{estimate_chlorophyll_from_backscatter}
\alias{estimate_chlorophyll_from_backscatter}
\title{Estimate chlorophyll-a concentration from ADCP acoustic backscatter}
\usage{
estimate_chlorophyll_from_backscatter(
  df,
  backscatter_col,
  frequency_khz = 600,
  calibration = NULL,
  min_chl = 0.05,
  max_chl = 50,
  keep_raw = TRUE,
  verbose = TRUE
)
}
\arguments{
\item{df}{Dataframe containing a backscatter column and optional temperature
and depth columns.}

\item{backscatter_col}{Character. Name of the column containing volume
backscatter strength values (Sv in dB re 1 \eqn{m^{-1}}). For Nortek Signature
outputs, this is typically the mean amplitude across clean bins, available
as \code{amp_mean_dB} after \code{\link[=read_nortek_adcp]{read_nortek_adcp()}}.}

\item{frequency_khz}{Numeric. ADCP operating frequency in kHz. Used to
select default calibration constants if \code{calibration} is not supplied.
Common values: 300, 600, 1200. For other frequencies, supply \code{calibration}
directly.}

\item{calibration}{Numeric vector of length 2: \code{c(a, b)} for the log-linear
model \code{log10(Chl_a) = a * Sv + b}. Supply to override the built-in
frequency-based defaults. Derive from concurrent water samples:
fit \code{log10(observed_chl) ~ backscatter} and extract intercept (\code{b}) and
slope (\code{a}).}

\item{min_chl}{Numeric. Floor for estimated chlorophyll-a in ugg/L
(default \code{0.05}). Prevents physically implausible negative estimates.}

\item{max_chl}{Numeric. Ceiling for estimated chlorophyll-a in ugg/L
(default \code{50}). Values above this are likely turbidity artefacts (non-algal
particles dominating backscatter).}

\item{keep_raw}{Logical. If \code{TRUE}, preserves the input backscatter column
(default \code{TRUE}).}

\item{verbose}{Logical. Print conversion summary and warnings (default \code{TRUE}).}
}
\value{
The input dataframe with an additional \code{chlorophyll_a} column
(ugg/L). If a \code{chlorophyll_a} column already exists, a warning is issued
and the existing column is overwritten.
}
\description{
Uses the empirical log-linear relationship between volume backscatter
strength (Sv) and chlorophyll-a concentration to add an estimated
\code{chlorophyll_a} column to a survey dataframe. Intended for surveys where
a fluorometer was not deployed and the ADCP backscatter intensity is
available.

The conversion is: \code{Chl_a (ugg/L) = 10 ^ (a * Sv + b)}

Default \code{a} and \code{b} constants are derived from Deines (1999) for three
common ADCP frequencies (300, 600, 1200 kHz). For best results, calibrate
against concurrent water samples from your survey using the \code{calibration}
argument.
}
\section{Improving accuracy with water samples}{

Collect 5--15 grab/Niskin water samples distributed across your survey area
and depth range, then:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{# Fit calibration from samples
fit  <- lm(log10(sample_chl) ~ backscatter, data = samples_df)
a    <- coef(fit)[["backscatter"]]
b    <- coef(fit)[["(Intercept)"]]
df   <- estimate_chlorophyll_from_backscatter(
          df, "amp_mean_dB", frequency_khz = 600,
          calibration = c(a, b))
}\if{html}{\out{</div>}}
}

\examples{
\donttest{
# Default calibration (300 kHz Nortek Signature)
adcp <- read_nortek_adcp("survey.csv")
adcp <- estimate_chlorophyll_from_backscatter(
          adcp, backscatter_col = "amp_mean_dB",
          frequency_khz = 300)

# Custom calibration from water samples
adcp <- estimate_chlorophyll_from_backscatter(
          adcp, "amp_mean_dB", frequency_khz = 300,
          calibration = c(a = 0.041, b = -0.52))
}
}
