# Set the timezone to UTC
# Select the directory where databases are stored on your computer
# Identify the receiver(s) you wish to plot
# Serial number Name on plot (MB) Start date End date
~recvID, ~name, ~size, ~dtStart, ~dtEnd,
'CTT-F0C333DDFB45', 'Blackie Spit', 1789.18, "2021-07-01", "2021-08-01"
mutate(dtStart = as.Date(dtStart),
MB.daily = (size / as.integer(dtEnd-dtStart)) %>% round(digits = 3)) %>%
# Run the code below and login using your Motus account credentials.
recvs.df %>% by(seq_len(nrow(recvs.df)),
message("Downloading data for ", d$recvID, " (", d$name, ")")
sql <- tagme(projRecv = d$recvID, new = !file.exists(paste0(dir, d$recvID, '.motus')), update = T, forceMeta = F, dir = dir)
message("Finished downloading")
pulses.df <- sql %>% tbl('pulseCounts') %>% collect() %>% as_tibble() %>%
mutate(ts = as.POSIXct(hourBin*60*60, origin = '1970-01-01'))
daily.pulses.df <- pulses.df %>%
year = (ts %>% year)) %>%
group_by(day, year, month, ant) %>%
count = sum(count, na.rm = T))
message("Found ", daily.pulses.df %>%
filter(ts > d$dtStart, ts < d$dtEnd) %>% nrow(), " pulses.")
message("Making the plot...")
filter(ts > d$dtStart, ts < d$dtEnd) %>%
ggplot(aes(count/1e+06))+
facet_wrap(.~paste0("Antenna ", ant), ncol = 1, scales = "free_y")+
labs(x = "Daily pulse count (millions)",
title = paste0(d$name, " (", d$recvID, "): ", d$MB.daily, " MB/day"))