ebase_prep {EBASE}R Documentation

Prepare data for ebase

Description

Prepare data for ebase

Usage

ebase_prep(dat, Z, interval, ndays = 1)

Arguments

dat

input data frame

Z

numeric as single value for water column depth (m) or vector equal in length to number of rows in dat

interval

timestep interval in seconds

ndays

numeric for number of days in dat for optimizing the metabolic equation, see details

Details

Checks if all columns are present by matching those in exdat, converts dissolved oxygen from mg/L to mmol/m3, calculates the Schmidt number (unitless) from water temp (C) and salinity (psu), and calculates dissolved oxygen equilibrium concentration (mmol/m3) from salinity and temperature

The ndays argument defines the number of days that are used for optimizing the above mass balance equation. By default, this is done each day, i.e., ndays= 1 such that a loop is used that applies the model equation to observations within each day, evaluated iteratively from the first observation in a day to the last. Individual parameter estimates for a, R, and b are then returned for each day. However, more days can be used to estimate the unknown parameters, such that the loop can be evaluated for every ndays specified by the argument. The ndays argument will separate the input data into groups of consecutive days, where each group has a total number of days equal to ndays. The final block may not include the complete number of days specified by ndays if the number of unique dates in the input data includes a remainder when divided by ndays, e.g., if seven days are in the input data and ndays = 5, there will be two groups where the first has five days and the second has two days. The output data from ebase includes a column that specifies the grouping that was used based on ndays.

Missing values are interpolated at the interval specified by the interval argument for conformance with the core model equation. Records at the start or end of the input time series that do not include a full day are also removed. A warning is returned to the console if gaps are found or dangling records are found.

Value

A data frame with additional columns required for ebase. Dissolved oxygen as a volumetric concentration in dat as mg/L is returned in areal units as mmol/m2. If multiple time steps are identified, the number of rows in data frame is expanded based on the time step define by interval. Numeric values in the expanded rows will be interpolated if interp = TRUE, otherwise they will remain as NA values.

Examples

dat <- ebase_prep(exdat, Z = 1.85, interval = 900)
head(dat)

[Package EBASE version 1.0.1 Index]