Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into main
  • Loading branch information
mabecker89 committed Dec 20, 2023
2 parents 7a88c68 + 4b3db64 commit cb6675c
Show file tree
Hide file tree
Showing 46 changed files with 9,610 additions and 329 deletions.
3 changes: 3 additions & 0 deletions Mammals.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Website
WebsitePath: C:/Users/mabec/Documents/R/MammalModels/bookdown
112 changes: 103 additions & 9 deletions bookdown/01_Data-Collection.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ As of `r Sys.Date()`, the ABMI has deployed X number of cameras across the provi

The ABMI's remote camera deployment protocols can be accessed here: [Terrestrial ABMI Autonomous Recording Unit (ARU) and Remote Camera Trap Protocols](https://abmi.ca/home/publications/551-600/599).

## List of camera projects
## List of ABMI camera projects

The following camera projects have been deployed by the ABMI:

```{r, echo = FALSE, eval = TRUE}
Note - would be nice to have a link to the WildTrax project for those projects that are published.

```{r, echo = FALSE, eval = TRUE, message = FALSE, warning = FALSE}
library(wildRtrax)
library(keyring)
Expand All @@ -29,8 +31,10 @@ wt_auth()
abmi_projects <- wt_get_download_summary(sensor_id = "CAM") |>
filter(organization == "ABMI",
!str_detect(project, "ACME|Pilot|Elk Island|Hare Coat|Sahtu|Ticks|Compression|wildRtrax|first|Lemming|Zoo")) |>
select(Project = project, Cameras = tasks, Status = status) |>
arrange(desc(Cameras))
mutate(Project = str_remove(project, "^ABMI ")) |>
select(Project, `No. Cameras` = tasks, Status = status)
# Would it be better to arrange by year?
# arrange(desc(Cameras))
kable(abmi_projects)
Expand All @@ -39,17 +43,107 @@ kable(abmi_projects)

### Image Tagging

Image tagging is done on the [WildTrax](https://wildtrax.ca/about/) platform. Raw data is also publicly from the ABMI via this platform.
Image tagging is done on the [WildTrax](https://wildtrax.ca/about/) platform. Raw data is also publicly available from the ABMI via this platform.

The image tagging protocols used by the ABMI can be accessed here:

The tagging protocols can be accessed here:
There is a companion R package, [*wildRtrax*](https://abbiodiversity.github.io/wildRtrax/), which is also publicly available and contains many useful functions for downloading and analyzing camera data hosted on the platform. Throughout this document, references will be made to functions within this package.

There is a companion R package, *wildRtrax*, which is also publicly available and contains many useful functions for downloading and analyzing camera data on the platform. Throughout this document, references will be made to functions within this package.
Note: Would be nice to insert the wildRtrax package logo.

## Species detections (2014-2021)

Mammal species detections at ABMI sites sampled with cameras between 2014 and 2021.
The map below displays mammal species detections at ABMI Ecosystem Health (core grid) sites sampled with cameras between 2014 and 2023. Each site is sampled with 4 individual cameras placed 600-m apart in a square shape.

(Note: Need to add EH 2023)

```{r, echo = FALSE, eval = TRUE, message = FALSE, warning = FALSE}
library(sf)
library(crosstalk) # Special branch of GH crosstalk repo required (filter-select-default)
library(leaflet)
library(leaflet.extras)
g_drive <- "G:/Shared drives/ABMI Camera Mammals/"
# Alberta provincial polygon
sf_ab <- st_read(paste0(g_drive, "data/spatial/ab_prov.shp"),
quiet = TRUE, stringsAsFactors = FALSE)
# Site locations
sites <- read_csv(paste0(g_drive, "data/lookup/climate/site-climate-summary_v2020.csv")) |>
select(site = SITE_ID,
latitude = PUBLIC_LATTITUDE,
longitude = PUBLIC_LONGITUDE)
# Occurrence data
occ <- read_csv(paste0(g_drive, "Results/Occurrence/ABMI/occurrence_eh_site_2023-01-23.csv")) |>
filter(!str_detect(site, "^W")) |>
mutate(site = as.numeric(site))
# Species to display
sp <- occ |>
group_by(common_name) |>
summarise(n = sum(present)) |>
filter(n >= 35,
!str_detect(common_name, "Ermine|Squirrel"),
!common_name == "Deer") |>
select(common_name) |>
pull()
occ_subset <- occ |>
filter(common_name %in% sp) |>
mutate(year = str_sub(project, start = -4, end = -1)) |>
full_join(sites, by = "site") |>
mutate(present = ifelse(is.na(present), "Not Surveyed", present)) |>
mutate(present = factor(present, levels = c("Not Surveyed",
"TRUE",
"FALSE"))) |>
select(site, latitude, longitude, year, common_name, present) |>
arrange(site, year)
# Create SharedData object for crosstalk interactivity
shared_ss <- SharedData$new(occ_subset)
# Palette
pal <- colorFactor(palette = c("grey80",
"gold",
"darkred"),
domain = occ_subset$present)
# Create leaflet map
map <- sf_ab |>
st_transform("+init=epsg:4326") %>%
leaflet() %>%
addTiles() %>%
addProviderTiles("CartoDB.Positron") %>%
addFullscreenControl() %>%
addResetMapButton() %>%
addScaleBar(position = "bottomright",
options = scaleBarOptions(imperial = FALSE)) |>
addPolylines(color = "#0a0909", weight = 2.5, smoothFactor = 0.2, opacity = 3, fill = FALSE) |>
addCircleMarkers(data = shared_ss,
color = ~pal(present), stroke = FALSE, fillOpacity = 1,
radius = 6) |>
addLegend(data = shared_ss, pal = pal, values = ~present,
position = "topright", opacity = 1, title = "Occurrence at Site:")
```

```{r, out.width="100%", fig.height=10, eval = TRUE, echo = FALSE, warning = FALSE, message = FALSE}
# Create interactive filters
bscols(widths = c(4, 3),
filter_select("common_name", "Species", shared_ss, ~common_name, multiple = FALSE, selected = "Moose"),
filter_select("year", "Sampling Year", shared_ss, ~year, multiple = TRUE))
Shiny app.
# Display map
map
```

## Deployment duration lengths

Expand Down
90 changes: 88 additions & 2 deletions bookdown/_book/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<meta name="author" content="Marcus Becker, Dr. David J. Huggard, Dr. David Roberts" />


<meta name="date" content="2023-12-05" />
<meta name="date" content="2023-12-19" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -58,8 +58,94 @@
<link href="libs/anchor-sections-1.1.0/anchor-sections.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.1.0/anchor-sections-hash.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.1.0/anchor-sections.js"></script>
<link href="libs/selectize-0.12.4/css/selectize.bootstrap3.css" rel="stylesheet" />
<script src="libs/selectize-0.12.4/js/selectize.min.js"></script>
<link href="libs/crosstalk-1.1.1.9000/css/crosstalk.min.css" rel="stylesheet" />
<script src="libs/crosstalk-1.1.1.9000/js/crosstalk.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="libs/bootstrap-grid-3.4.1/bootstrap-grid.min.css" rel="stylesheet" />
<script src="libs/htmlwidgets-1.6.1/htmlwidgets.js"></script>
<link href="libs/leaflet-1.3.1/leaflet.css" rel="stylesheet" />
<script src="libs/leaflet-1.3.1/leaflet.js"></script>
<link href="libs/leafletfix-1.0.0/leafletfix.css" rel="stylesheet" />
<script src="libs/proj4-2.6.2/proj4.min.js"></script>
<script src="libs/Proj4Leaflet-1.0.1/proj4leaflet.js"></script>
<link href="libs/rstudio_leaflet-1.3.1/rstudio_leaflet.css" rel="stylesheet" />
<script src="libs/leaflet-binding-2.1.1/leaflet.js"></script>
<script src="libs/leaflet-providers-1.9.0/leaflet-providers_1.9.0.js"></script>
<script src="libs/leaflet-providers-plugin-2.1.1/leaflet-providers-plugin.js"></script>
<link href="libs/lfx-fullscreen-1.0.2/lfx-fullscreen-prod.css" rel="stylesheet" />
<script src="libs/lfx-fullscreen-1.0.2/lfx-fullscreen-prod.js"></script>
<link href="libs/leaflet-easybutton-1.3.1/easy-button.css" rel="stylesheet" />
<script src="libs/leaflet-easybutton-1.3.1/easy-button.js"></script>
<script src="libs/leaflet-easybutton-1.3.1/EasyButton-binding.js"></script>
<link href="libs/ionicons-2.0.1/ionicons.min.css" rel="stylesheet" />


<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>

<style type="text/css">

Expand Down Expand Up @@ -114,7 +200,7 @@
<ul>
<li class="chapter" data-level="2.1" data-path="data-collection.html"><a href="data-collection.html#abmi-use-of-remote-cameras"><i class="fa fa-check"></i><b>2.1</b> ABMI use of remote cameras</a></li>
<li class="chapter" data-level="2.2" data-path="data-collection.html"><a href="data-collection.html#camera-deployment-protocols"><i class="fa fa-check"></i><b>2.2</b> Camera deployment protocols</a></li>
<li class="chapter" data-level="2.3" data-path="data-collection.html"><a href="data-collection.html#list-of-camera-projects"><i class="fa fa-check"></i><b>2.3</b> List of camera projects</a>
<li class="chapter" data-level="2.3" data-path="data-collection.html"><a href="data-collection.html#list-of-abmi-camera-projects"><i class="fa fa-check"></i><b>2.3</b> List of ABMI camera projects</a>
<ul>
<li class="chapter" data-level="2.3.1" data-path="data-collection.html"><a href="data-collection.html#image-tagging"><i class="fa fa-check"></i><b>2.3.1</b> Image Tagging</a></li>
</ul></li>
Expand Down
Loading

0 comments on commit cb6675c

Please sign in to comment.