Queries environmental bottle cast data with temporal, depth, and variable filters. Returns a dbplyr lazy table for efficient downstream processing.
Arguments
- env_var
Character string of database column name for environmental variable (e.g., "t_deg_c", "salnty")
- qtr
Character or numeric vector of quarters to include (1-4)
- date_range
Date vector of length 2 (start date, end date)
- min_depth
Numeric minimum depth in meters
- max_depth
Numeric maximum depth in meters
Value
dbplyr lazy table with columns:
date- date of casttime- time of cast (seconds since midnight)dtime- datetime (computed via SQL CAST and INTERVAL)depthm- depth in meterslat_dec- latitude (decimal degrees)lon_dec- longitude (decimal degrees)qty- renamed environmental variable valuehex_h3res*- H3 hexagon indices at multiple resolutions
Details
The function joins cast and bottle tables, then joins with
site to obtain H3 spatial indices. Only records with non-NA values
for the selected variable are returned. Datetime is constructed from separate
date and time fields using DuckDB SQL.
See also
prep_env_hex for spatial aggregation
prep_ts_env for temporal aggregation