% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/live_data.R
\name{fetch_live_environmental_data}
\alias{fetch_live_environmental_data}
\title{Fetch live environmental data for a survey extent}
\usage{
fetch_live_environmental_data(
  survey,
  sources = "all",
  date_range = NULL,
  verbose = TRUE
)
}
\arguments{
\item{survey}{Dataframe with \code{lat} and \code{lon} columns defining the survey
extent. The bounding box of these coordinates is used as the query extent.}

\item{sources}{Character vector. Which data sources to fetch. Options:
\code{"cmems"}, \code{"ices_hab"}, \code{"ices_vms"}, \code{"emodnet_predators"},
\code{"fsa_shellfish"}. Use \code{"all"} to attempt all sources.}

\item{date_range}{Character vector of length 2: \code{c("YYYY-MM-DD", "YYYY-MM-DD")}.
Date range for time-windowed queries (CMEMS, ICES HAB). Defaults to
the last 5 years.}

\item{verbose}{Logical. Print progress (default TRUE).}
}
\value{
Named list. Each successfully fetched source produces one element:
\itemize{
\item \verb{$cmems}: SST, salinity, chlorophyll grid
\item \verb{$ices_hab}: HAB event records within extent
\item \verb{$ices_vms}: Swept-area ratio per ICES c-square
\item \verb{$emodnet_predators}: Predator occurrence records
\item \verb{$fsa_shellfish}: Shellfish classification polygons / area descriptions
}
}
\description{
Convenience wrapper that fetches data from one or more live sources and
returns a named list of dataframes that can be passed to the relevant
scoring functions. Each source can be fetched independently or all at once.

This function requires internet access and registered API credentials where
applicable (see \code{\link[=oystermapR_live_config]{oystermapR_live_config()}}). If a source fails, it is
silently skipped and not included in the output - the function never aborts
due to a single failed source.
}
\examples{
\dontrun{
oystermapR_live_config(cmems_user = "u", cmems_password = "p")
live <- fetch_live_environmental_data(survey, sources = c("ices_hab", "ices_vms"))
result <- score_hab_risk(result, hab_data = live$ices_hab, species = "ostrea_edulis")
result <- score_anthropogenic_disturbance(result, trawling_data = live$ices_vms)
}
}
