% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spatial_smooth.R
\name{smooth_suitability}
\alias{smooth_suitability}
\title{Apply Gaussian kernel smoothing to suitability scores}
\usage{
smooth_suitability(
  result,
  bandwidth_m = 500,
  max_radius_m = NULL,
  smooth_excluded = FALSE,
  verbose = TRUE
)
}
\arguments{
\item{result}{Dataframe from \code{\link[=predict_oyster]{predict_oyster()}} with \code{lat}, \code{lon},
\code{suitability}, and \code{excluded} columns.}

\item{bandwidth_m}{Numeric. Gaussian kernel bandwidth (1 sigma) in metres.
Default 500 m. Increase for sparser surveys; decrease to preserve fine detail.}

\item{max_radius_m}{Numeric. Maximum search radius for neighbours in metres.
Cells further than this are ignored (default \code{3 * bandwidth_m}).}

\item{smooth_excluded}{Logical. If FALSE (default), excluded cells do not
contribute to neighbours' smoothed scores (hard barriers are preserved).}

\item{verbose}{Logical. Print summary (default TRUE).}
}
\value{
Input dataframe with \code{suitability_raw} (original) and
\code{suitability} (smoothed, overwrites original) columns, plus a
\code{suitability_class} column reclassified from the smoothed score.
}
\description{
Individual CTD or ADCP casts are point measurements subject to instrument
noise, micro-scale patchiness, and tidal state variability. \code{smooth_suitability()}
applies a Gaussian distance-weighted kernel to the suitability scores, replacing
each cell's score with a weighted mean of all cells within \code{bandwidth_m} metres.
The result is a spatially coherent surface that better reflects broad habitat
quality rather than single-cast noise.

The smoothed score is computed as:
\deqn{\hat{s}_i = \frac{\sum_j w_{ij} \cdot s_j}{\sum_j w_{ij}}}
where \eqn{w_{ij} = \exp(-d_{ij}^2 / (2\sigma^2))} and \eqn{\sigma} is the
Gaussian bandwidth in metres. Excluded cells (suitability = 0, excluded flag)
are down-weighted but included so that unsuitable barriers are preserved.
}
\examples{
\donttest{
result <- predict_oyster(survey, "ostrea_edulis")

# Smooth with 300 m bandwidth (good for dense ADCP surveys)
result_smooth <- smooth_suitability(result, bandwidth_m = 300)

# Compare raw vs smoothed
plot(result$suitability_raw, result$suitability,
     xlab = "Raw", ylab = "Smoothed", pch = 20)
}
}
