Skip to contents

Converts a data frame of lake observations into the format required for AEME. The function maps variable names and units to AEME standards using provided lookup tables. It also ensures that required columns are present and correctly named.

Usage

lake_obs_to_aeme(
  data,
  depth_col_name,
  datetime_col_name,
  var_col_name,
  value_col_name,
  lake_id_col,
  var_map,
  depth_to_col_name,
  sd_col_name,
  tz = "UTC"
)

Arguments

data

data frame containing lake observations

depth_col_name

column name for depth (m). If missing, the function will attempt to infer it.

datetime_col_name

column name for date/time. If missing, the function will attempt to infer it.

var_col_name

column name for variable names. If missing, the function will attempt to infer it.

value_col_name

column name for variable values. If missing, the function will attempt to infer it.

lake_id_col

column name for lake identifier. If missing, the function assumes all data is for a single lake.

var_map

data frame with columns "var_aeme", "name", and "unit" for mapping variable names and units to AEME standards. "var_aeme" is the defined AEME variable name, "name" is the name used in the input data, and "unit" is the unit used in the input data.

depth_to_col_name

column name for the bottom of an integrated sample (m). Optional; if missing, no depth_to column is produced.

sd_col_name

column name for the measurement standard deviation, in the input units of each variable. Optional; if missing, no sd column is produced.

tz

character; Olson timezone a naive datetime column is expressed in. Sub-daily timestamps are converted to UTC and kept at their time-of-day; daily data is treated as calendar dates (never shifted) and anchored at 12:00:00 UTC. Default "UTC".

Value

A data frame formatted for AEME with required columns "Date" (UTC POSIXct; daily observations anchored at 12:00:00), "var_aeme", "depth", and "value", plus the optional columns "depth_to" and "sd" when the corresponding arguments are supplied.