bcgov / bccamtrap

Managing camera trap data
https://bcgov.github.io/bccamtrap/
Apache License 2.0
2 stars 0 forks source link

Trap day calculation when no daily timelapse image capture (Solution) #32

Open btitaro opened 5 months ago

btitaro commented 5 months ago

Issue background:

Current solution (May 2024):

##Create a dummy dataset of daily timelapse images that can be added to the dataset that has no timelapse images. This assumes the camera was active every day and so makes a timelapse record for each deployment label from the date of the first motion detection to the date of the final motion detection.

library(dplyr) library(tidyr)

mock_tl <- group_by(image_data, study_area_name, sample_station_label, deployment_label) |> summarise( min_date = min(as.Date(date_time), na.rm = TRUE), max_date = max(as.Date(date_time), na.rm = TRUE), .groups = "keep" ) |> expand( date = as.Date(min_date:max_date) ) |> mutate( date_time = as.POSIXct(paste(date, "12:00:00"), tz = "UTC"), trigger_mode = "Time Lapse", lens_obscured = FALSE ) |> select(-date)

##Join the mock Time Lapse dataset onto the original dataset (with no timelapse) images

tl_image_data <- bind_rows(image_data, mock_tl) |> arrange(date_time)

Long-term Solution: