-
Notifications
You must be signed in to change notification settings - Fork 4
/
resolution.Rmd
87 lines (70 loc) · 2.58 KB
/
resolution.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: "resolution"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{resolution}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(dplyr)
library(sf)
```
## Get biological occurrences
```{r occ}
occ <- occ_SAtlantic # occ_1M OR occ_SAtlantic
```
## Create function to make grid, calculate metrics, and plot maps for different resolution grid sizes
```{r function}
res_changes <- function(resolution = 2){
hex_res <- 1 # hex_res 0 is too big to work, all others work
hex <- obisindicators::make_hex_res(resolution)
# === Then assign cell numbers to the occurrence data:
occ <- occ %>%
mutate(
cell = h3::geo_to_h3(
data.frame(decimalLatitude, decimalLongitude),
res = resolution))
idx <- calc_indicators(occ)
grid <- hex %>%
inner_join(
idx,
by = c("hexid" = "cell"))
gmap_indicator(grid, "es", label = "ES(50)")
}
```
## Different Resolutions
Details of H3 resolution differences can be found in the [h3geo docs](https://h3geo.org/docs/core-library/restable/).
Resolutions range from 0 (largest) to 15 (smallest).
Generally, resolution 0 is too big to be useful... or even functional, sometimes.
```{r resone}
res_changes(0)
```
```{r restwo}
res_changes(1)
```
At this resolution the S Atlantic is completely covered, meaning that every hex had enough data to compute the ES(50) diversity metric.
We can see some basic expected patterns such as:
* higher diversity near to the coast
* higher diversity near the equator
```{r resthree}
res_changes(2)
```
A this resolution we see gaps throughout the central South Atlantic.
These hexagons did not have enough occurrence records to calculate the diversity metric.
```{r resfour}
res_changes(3)
```
At this higher resolution, gaps dominate the map.
Only places with relatively dense surveying efforts have enough data to calculate the diversity metric.
Note how the relatively data-poor center has a relatively stark boundary spanning from the southern tip of Africa across.
This boundary is visible in the diversity metric plots of lower resolution in the form of a high-low diversity boundary.
The appearance of this abrupt high-low diversity boundary is likely an artifact of how data-poor the central South Atlantic is.
The ES50 diversity metric will bias data-poor to more-diverse when there is extremely low amounts of data.
It should be noted, however, that this bias is *much* less intense than the data-poor to less-diverse in other diversity metrics.