Prepare data_daily by aggregating any daily data, renaming K600.daily to K600.daily.obs, & setting data_daily$weight to reflect user weights & filters
Source:R/metab_Kmodel.R
prepdata_Kmodel.Rd
Prepare data_daily by aggregating any daily data, renaming K600.daily to K600.daily.obs, & setting data_daily$weight to reflect user weights & filters
Usage
prepdata_Kmodel(
data,
data_daily,
weights,
filters,
day_start,
day_end,
day_tests,
required_timestep
)
Arguments
- data
unit data to aggregate to daily_data. may be NULL.
- data_daily
daily data to prepare for K modeling
- weights
For Kmodel, character vector indicating the type of weighting to use. Set to c() for no weights. One of c("1/CI", "K600/CI", c()).
- filters
For Kmodel, named numeric vector of limits to use in filtering data_daily. Elements may include c("CI.max","discharge.daily.max","velocity.daily.max"). If an element is given, the corresponding filter is applied: K600.daily.upper-K600.daily.lower <= CI.max, discharge.daily <= discharge.daily.max, velocity.daily <= velocity.daily.max
- day_start
start time (inclusive) of a day's data in number of hours from the midnight that begins the date. For example, day_start=-1.5 indicates that data describing 2006-06-26 begin at 2006-06-25 22:30, or at the first observation time that occurs after that time if day_start doesn't fall exactly on an observation time. For metabolism models working with single days of input data, it is conventional/useful to begin the day the evening before, e.g., -1.5, and to end just before the next sunrise, e.g., 30. For multiple consecutive days, it may make the most sense to start just before sunrise (e.g., 4) and to end 24 hours later. For nighttime regression, the date assigned to a chunk of data should be the date whose evening contains the data. The default is therefore 12 to 36 for metab_night, of which the times of darkness will be used.
- day_end
end time (exclusive) of a day's data in number of hours from the midnight that begins the date. For example, day_end=30 indicates that data describing 2006-06-26 end at the last observation time that occurs before 2006-06-27 06:00. See day_start for recommended start and end times.
- day_tests
list of tests to conduct to determine whether each date worth of data is valid for modeling. The results of these tests will be combined with the result of the test implied if
required_timestep
is numeric and then will be passed tomodel_fun
as theply_validity
argument to that function.- required_timestep
NA or numeric (length 1). If numeric, the timestep length in days that a date must have to pass the validity check (to within a tolerance of 0.2% of the value of
required_timestep
). The result of this test will be combined with the results of the tests listed inday_tests
and reported tomodel_fun
as theply_validity
argument to that function.