% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ingest_sensors.R
\name{read_rdi_adcp}
\alias{read_rdi_adcp}
\title{Read a Teledyne RDI ADCP binary file (PD0 format)}
\usage{
read_rdi_adcp(
  file,
  lat = NULL,
  lon = NULL,
  spatial_res = 4L,
  min_obs = 5L,
  max_plausible_speed = 2,
  sidelobe_threshold = 0.1,
  rho = 1025,
  Cd = 0.002,
  verbose = TRUE
)
}
\arguments{
\item{file}{Character. Path to the RDI binary \code{.000} / \code{.PD0} / \code{.pd0}
file, or to an ASCII WinRiver II export (\code{.txt} or \code{.csv}) with columns
\code{VelEast_binN} and \code{VelNorth_binN}.}

\item{lat}{Numeric. Fixed latitude for moored deployments (decimal degrees).}

\item{lon}{Numeric. Fixed longitude for moored deployments (decimal degrees).}

\item{spatial_res}{Integer. Decimal places for lat/lon binning (default \code{4}).}

\item{min_obs}{Integer. Minimum ensembles per grid cell (default \code{5}).}

\item{max_plausible_speed}{Numeric. Upper speed threshold in m/s for
sidelobe / spike removal (default \code{2.0}).}

\item{sidelobe_threshold}{Numeric. Fraction of ensembles exceeding
\code{max_plausible_speed} above which a bin is considered sidelobe-contaminated
(default \code{0.10}).}

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

\item{Cd}{Numeric. Drag coefficient for bed shear stress (default \code{0.002}).}

\item{verbose}{Logical. Print progress messages (default \code{TRUE}).}
}
\value{
A dataframe with columns \code{lat}, \code{lon}, \code{current_speed},
\code{bed_shear_stress}, \code{shear_stress_quality}, and \code{n_ensembles} -- ready
for \code{\link[=merge_sensor_data]{merge_sensor_data()}}.
}
\description{
Reads the binary \strong{PD0} output file produced by Teledyne RDI instruments
(WorkHorse II, Sentinel V, StreamPro, Ocean Surveyor, Long Ranger) via the
the \code{oce} package's \code{read.adp.rdi()} parser. The function
extracts east/north velocity profiles, applies sidelobe contamination
detection, and derives current speed and bed shear stress -- producing
output in the same format as \code{\link[=read_nortek_adcp]{read_nortek_adcp()}}.

\strong{Optional dependency:} reading RDI binary (PD0) files requires the \code{oce}
package (\code{install.packages("oce")}). If \code{oce} is absent the function will
stop with an informative message. ASCII WinRiver II exports (\code{.txt}/\code{.csv})
do not require \code{oce}.

\strong{GPS:} vessel-mounted deployments embed GPS in the binary file and are
handled automatically. For moored deployments supply \code{lat} and \code{lon}.
}
\examples{
\donttest{
# Vessel-mounted WorkHorse II (GPS embedded in binary)
adcp <- read_rdi_adcp("survey_2024.000")

# Moored Sentinel V (fixed position)
adcp <- read_rdi_adcp("mooring_2024.000", lat = 52.41, lon = -9.20)

survey <- merge_sensor_data(adcp = adcp, bathy = bathy)
}
}
\seealso{
\code{\link[=read_nortek_adcp]{read_nortek_adcp()}}, \code{\link[=read_nortek_aquadopp]{read_nortek_aquadopp()}}, \code{\link[=merge_sensor_data]{merge_sensor_data()}}
}
