% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ingest_sensors.R
\name{read_nortek_adcp}
\alias{read_nortek_adcp}
\title{Read and process a Nortek Signature 500 ADCP CSV file}
\usage{
read_nortek_adcp(
  file,
  spatial_res = 4L,
  min_obs = 5L,
  max_plausible_speed = 1.5,
  sidelobe_threshold = 0.1,
  rho = 1025,
  Cd = 0.002,
  verbose = TRUE
)
}
\arguments{
\item{file}{Character. Path to the Nortek merged CSV file.}

\item{spatial_res}{Integer. Decimal places for lat/lon binning (default \code{4},
approx.11 m cells at 56degrees N). Reduce to \code{3} (~111 m) for coarser surveys.}

\item{min_obs}{Integer. Minimum number of raw ensembles per spatial cell
to include in output (default \code{5}). Cells with fewer observations are
dropped as unreliable.}

\item{max_plausible_speed}{Numeric. Speed in m/s above which a reading is
considered a sidelobe spike (default \code{1.5} m/s -- appropriate for sheltered
coastal/loch environments). Increase to \code{2.5} for open coast surveys.}

\item{sidelobe_threshold}{Numeric. Fraction of readings in a bin that must
exceed \code{max_plausible_speed} before the bin is flagged as contaminated
(default \code{0.10}, i.e. 10\%).}

\item{rho}{Numeric. Seawater density in kg/m^3 (default \code{1025}).}

\item{Cd}{Numeric. Drag coefficient for bed shear stress calculation
(default \code{0.002}, typical for mixed sandy/rocky coastal seabed).}

\item{verbose}{Logical. Print processing summary (default \code{TRUE}).}
}
\value{
A dataframe with one row per spatial cell containing:
\itemize{
\item \code{lat}, \code{lon} -- cell centroid coordinates
\item \code{date} -- earliest observation date in cell (character, \code{"YYYY-MM-DD"})
\item \code{current_velocity} -- mean speed from deepest clean bin (m/s)
\item \code{current_velocity_sd} -- standard deviation within cell (m/s)
\item \code{current_velocity_p95} -- 95th percentile speed (m/s)
\item \code{shear_stress} -- estimated bed shear stress (N/m^2)
\item \code{shear_stress_quality} -- \code{"good"}, \code{"moderate"}, or \code{"low"}
\item \code{n_ensembles} -- raw ensembles averaged into this cell
\item \code{bins_used} -- which velocity bins contributed (e.g. \code{"bin1"})
\item \code{bins_excluded} -- which bins were removed as contaminated
}
}
\description{
Reads a raw merged Nortek Signature 500 ADCP CSV, automatically detects
and excludes depth bins contaminated by acoustic sidelobe interference,
computes current velocity and estimated bed shear stress from the deepest
clean bin, and returns a spatially averaged dataframe ready to merge with
other sensor data via \code{\link[=merge_sensor_data]{merge_sensor_data()}}.

\strong{Sidelobe detection:} Each bin is tested independently. A bin is flagged
as contaminated if more than \code{sidelobe_threshold} fraction of its speed
readings exceed \code{max_plausible_speed}. Once a bin is flagged, all deeper
bins are also flagged (contamination propagates downward).

\strong{Shear stress accuracy:} Bed shear stress (\code{tau = rho * Cd * U_bed^2})
is most accurate when computed from near-bed velocity. If near-bed bins are
contaminated and only near-surface bins remain, a warning is issued and the
\code{shear_stress_quality} column is set to \code{"low"}. If two or more clean bins
exist, the deepest clean bin is used and quality is \code{"moderate"} or
\code{"good"}.
}
\examples{
\donttest{
adcp <- read_nortek_adcp("S104456A008_AWE_Melfort_merged.csv")
print(adcp)
}
}
