Skip to contents

link_events() extracts nearest-neighbour ocean values from an <ocean_cube> at event coordinates and dates. It is intended for linking daily anomalies to fishing sets, lances, survey stations, biological samples, or occurrence records.

Usage

link_events(
  x,
  events,
  lon_col = "lon",
  lat_col = "lat",
  date_col = "date",
  depth_col = NULL,
  vars = NULL,
  prefix = NULL,
  time_tolerance = 0L,
  keep_grid = TRUE
)

Arguments

x

An <ocean_cube> object. This can be a raw variable cube, an absolute anomaly cube, a z-score cube, or a standardized-anomaly-magnitude cube.

events

A data frame with event coordinates and dates.

lon_col

Name of the longitude column in events.

lat_col

Name of the latitude column in events.

date_col

Name of the date or datetime column in events.

depth_col

Optional name of the depth column in events. If NULL, the first depth level in x is used.

vars

Optional variables to extract. Defaults to all variables in x.

prefix

Optional prefix for extracted columns. If NULL, columns are named <var>_value.

time_tolerance

Maximum allowed date mismatch in days. Use 0 for exact daily matching, or e.g. 1 to allow nearest day within ±1 day.

keep_grid

Logical. If TRUE, appends matched grid lon, lat, depth, date, and time difference.

Value

The original events data frame with extracted ocean variables appended.

Lifecycle

Deprecated as of oceancube 0.3.0. Use cube_extract() with explicit match = "nearest" and axis-specific tolerances, applied through an explicit event-row workflow. There is no single equivalent replacement because link_events() performs row-wise nearest spatial matching without a public spatial tolerance.