Build a per-day calendar for each camera deployment and mark a date as
operational if there is any in-range image that day. In-range is
defined by a field-of-view flag: image_fov != "OOR" is in-range; "OOR"
is out-of-range. By default, NA in image_fov is treated as in-range.
Usage
cam_get_op_days(
df,
grouping = c("project", "project_id", "location", "location_id"),
datetime_col = "image_date_time",
fov_col = "image_fov",
oor_flag = "OOR",
na_fov_means_inrange = TRUE,
trigger_col = "image_trigger_mode",
trigger_exclude_value = "CodeLoc Not Entered",
span = c("data", "operational"),
missing_as = TRUE
)Arguments
- df
Image report tibble/data.frame.
- grouping
Camera identity columns (only those present are used).
- datetime_col
Timestamp column name. Default
"image_date_time".- fov_col
Field-of-view flag column. Default
"image_fov".- oor_flag
String indicating out-of-range in
fov_col. Default"OOR".- na_fov_means_inrange
Logical; treat
NAinfov_colas in-range? Default TRUE.- trigger_col
Column that indicates trigger mode. Default
"image_trigger_mode".- trigger_exclude_value
Value in
trigger_colto exclude entirely from the calendar and ops logic. Default"CodeLoc Not Entered".- span
"data"or"operational". Default"data".- missing_as
Fill for days with no images after expansion: one of TRUE, FALSE, or NA.
Details
The function:
Pre-filters rows where
trigger_col == trigger_exclude_value(default"CodeLoc Not Entered"). These rows do not contribute to operating days or calendar span.Parses the image timestamp to
Date.Flags in-range by
fov_col != oor_flag(orNAtreated byna_fov_means_inrange).Aggregates to daily
operating = any(in-range).Expands to a full daily calendar, filling missing days with
missing_as.span = "data"uses min..max date of filtered images;span = "operational"trims to first..last TRUEoperating.
Examples
if (FALSE) { # \dontrun{
# image_reports is a WildTrax image report tibble
cal <- cam_get_op_days(
image_reports,
grouping = c("project_id", "project", "location_id", "location"),
span = "data",
missing_as = TRUE
)
} # }