-
Notifications
You must be signed in to change notification settings - Fork 6
/
fig_S2b_bd_in_mpas_any.Rmd
262 lines (198 loc) · 9.27 KB
/
fig_S2b_bd_in_mpas_any.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
---
title: 'MPAs and biodiversity intactness - any MPAs'
author: "*Compiled on `r date()` by `r Sys.info()['user']`*"
output:
html_document:
code_folding: hide
toc: true
toc_depth: 3
toc_float: yes
number_sections: true
theme: cerulean
highlight: haddock
includes:
in_header: '~/github/src/templates/ohara_hdr.html'
pdf_document:
toc: true
---
``` {r setup, echo = TRUE, message = FALSE, warning = FALSE}
knitr::opts_chunk$set(fig.width = 6, fig.height = 4, fig.path = 'figs/',
echo = TRUE, message = FALSE, warning = FALSE)
library(raster)
library(data.table)
source('https://raw.githubusercontent.com/oharac/src/master/R/common.R')
### includes library(tidyverse); library(stringr);
### dir_M points to ohi directory on Mazu; dir_O points to home dir on Mazu
dir_git <- here()
source(file.path(dir_git, '_setup/common_fxns.R'))
```
# Summary
Compare MPAs to biodiversity risk.
# Data sources
* IUCN species API: IUCN. (2019). The IUCN Red List of Threatened Species. Version 2019-2.
* IUCN species shapefiles: IUCN. (2019). The IUCN Red List of Threatened Species. Version 2019-2. Retrieved August 2019, from http://www.iucnredlist.org
* BirdLife International shapefiles: BirdLife International and Handbook of the Birds of the World. (2018). Bird species distribution maps of the world. Version 7.0. Available at http://datazone.birdlife.org/species/requestdis
* World Database on Protected Areas: IUCN, & UNEP-WCMC. (2018, June). The World Database on Protected Areas (WDPA). Retrieved June 9, 2018, from Cambridge, UK: UNEP-WCMC website: www.protectedplanet.net
* Marine Ecoregions of the World: Spalding, M. D., Fox, H. E., Allen, G. R., Davidson, N., Ferdaña, Z. A., Finlayson, M. A. X., … others. (2007). Marine ecoregions of the world: A bioregionalization of coastal and shelf areas. BioScience, 57(7), 573–583.
# Methods
## Compare MPA coverage to biodiversity risk
MPA coverage will be compared to non-MPA areas within EEZs. The .csv codes MPAs as their numeric IUCN category (i.e. Ia = Ib = 1, II = 2, ..., VI = 6); areas that are specifically designated as no-take (that are not already in categories Ia, Ib, and II) are coded as -1; areas that are designated in the WDPA database but do not fall into one of these categories are coded as 8.
``` {r set up mpa and values dataframe}
mean_rast <- raster(file.path(dir_output, 'mean_risk_raster_comp.tif'))
eez_rast <- raster(file.path(dir_spatial, 'eez_rast.tif'))
ocean_area_rast <- raster(file.path(dir_spatial, 'ocean_area_rast.tif'))
rgn_labels <- read_csv(file.path(dir_spatial, 'rgn_names.csv')) %>%
mutate(r1_label = str_replace(r1_label, 'Americas', 'N. America'),
r1_label = str_replace(r1_label, 'Latin Am.+', 'S. America'),
r1_label = ifelse(str_detect(r2_label, 'Central America|Caribbean'),
'C. America/Caribbean', r1_label),
r1_label = ifelse(rgn_id == 135, 'N. America', r1_label))
risk_df <- data.frame(cell_id = 1:length(values(mean_rast)),
ocean_area = values(ocean_area_rast),
eez = values(eez_rast),
mean_risk = values(mean_rast)) %>%
left_join(rgn_labels, by = c('eez' = 'rgn_id')) %>%
filter(!is.na(mean_risk))
```
``` {r set up any mpa vs risk df}
calc_mpa_areas <- function(df) {
### ensure MPA area is no larger than ocean area of the cell; and
### code NA as zero for means and weights calculations
df %>%
mutate(mpa = ifelse(is.na(mpa), 0, mpa),
mpa = ifelse(mpa > ocean_area, ocean_area, mpa),
non_mpa = ocean_area - mpa) %>%
gather(mpa_status, area, mpa, non_mpa) %>%
mutate(mpa_status = (mpa_status == 'mpa'))
}
mpa_df <- read_csv(file.path(dir_spatial, 'wdpa_mpa_area.csv'),
col_types = 'dddd') %>%
filter(wdpa_category <= 8) %>%
select(-wdpa_category) %>%
group_by(cell_id) %>%
summarize(mpa = sum(prot_area_km2, na.rm = TRUE))
risk_mpa_df <- risk_df %>%
left_join(mpa_df, by = 'cell_id') %>%
calc_mpa_areas()
```
``` {r any mpas, eval = TRUE}
global_any <- risk_mpa_df %>%
filter(eez < 255 & eez != 213) %>%
mutate(lbl = 'Global EEZ')
highseas_any <- risk_mpa_df %>%
filter(eez > 255 | eez == 213) %>%
mutate(lbl = 'High seas')
rgn_any <- risk_mpa_df %>%
filter(eez < 255 & eez != 213) %>%
mutate(lbl = r1_label) %>%
arrange(lbl)
any_df <- bind_rows(global_any,
rgn_any, highseas_any) %>%
mutate(lbl = forcats::fct_inorder(lbl))
prot_pct <- any_df %>%
group_by(lbl) %>%
summarize(pct_prot = sum(area * mpa_status) / sum(area) * 100,
tot_area = sum(area))
### this is independent of range-rarity weighting
any_means <- any_df %>%
group_by(mpa_status, lbl) %>%
summarize(mu = sum(mean_risk * area) / sum(area)) %>%
ungroup()
```
``` {r set up overall rr-weighted dataframe}
mean_rr_rast <- raster(file.path(dir_output, 'mean_rr_risk_raster_comp.tif'))
risk_rr_df <- data.frame(cell_id = 1:length(values(mean_rr_rast)),
ocean_area = values(ocean_area_rast),
eez = values(eez_rast),
mean_risk = values(mean_rr_rast)) %>%
left_join(rgn_labels, by = c('eez' = 'rgn_id')) %>%
filter(!is.na(mean_risk))
```
``` {r set up any vs risk rr df}
risk_mpa_rr_df <- risk_rr_df %>%
left_join(mpa_df, by = 'cell_id') %>%
calc_mpa_areas()
```
``` {r rr-weighted protection level dataframes}
global_any_rr <- risk_mpa_rr_df %>%
filter(eez < 255 & eez != 213) %>%
mutate(lbl = 'Global EEZ')
highseas_any_rr <- risk_mpa_rr_df %>%
filter(eez > 255 | eez == 213) %>%
mutate(lbl = 'High seas')
rgn_any_rr <- risk_mpa_rr_df %>%
filter(eez < 255 & eez != 213) %>%
mutate(lbl = r1_label) %>%
arrange(lbl)
any_rr_df <- bind_rows(global_any_rr,
rgn_any_rr,
highseas_any_rr) %>%
mutate(lbl = forcats::fct_inorder(lbl))
any_rr_means <- any_rr_df %>%
group_by(mpa_status, lbl) %>%
summarize(mu = sum(mean_risk * area) / sum(area)) %>%
ungroup()
```
There seem to be two philosophies of MPA priority: place MPAs in impacted areas to reduce pressure and prevent further degradation, or place MPAs to protect pristine places to maintain their pristine state. This suggests that we may see a bimodal distribution of mean risk within MPA cells relative to the distribution of mean risk in general.
### Mean risk
``` {r plot_function}
plot_dist <- function(df, means_df, var_name, x_lims = c(0, .6)) {
x <- ggplot(df, aes(x = mean_risk)) +
ggtheme_plot(base_size = 7) +
theme(strip.text.y = element_text(angle = 0, hjust = 0),
axis.text.y = element_blank(),
axis.title = element_blank(),
panel.grid.major.y = element_blank(),
plot.margin = unit(c(.1, .25, .1, .35), 'cm')) +
geom_density(aes(x = mean_risk, weight = area, ..scaled..,
fill = mpa_status, color = mpa_status),
alpha = .5, size = .25) +
geom_vline(data = means_df,
aes(xintercept = mu, linetype = mpa_status),
color = 'grey20', alpha = .8) +
scale_x_continuous(expand = c(0, 0),
limits = x_lims,
labels = risk_lbls,
breaks = risk_brks) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_manual(values = c('red4', 'cadetblue2')) +
scale_color_manual(values = c('red3', 'cadetblue4')) +
facet_grid( lbl ~ ., scales = 'free_y') +
labs(fill = var_name, color = var_name, linetype = var_name)
return(x)
}
```
``` {r generate figure}
prot_pct_lbls <- prot_pct %>%
mutate(area_lbl = sprintf('%.1f x 10⁶ km²', tot_area/1e6),
prot_lbl = sprintf('%.1f%% MPA', pct_prot))
mpa_plot_unweighted <- plot_dist(any_df, any_means, 'MPA (any)')
mpa_plot_rrweighted <- plot_dist(any_rr_df, any_rr_means, 'MPA (any)') +
geom_text(data = prot_pct_lbls, aes(x = .59, y = .95, label = area_lbl),
hjust = 1, size = 2.1, vjust = 1, color = 'grey20') +
geom_text(data = prot_pct_lbls, aes(x = .59, y = .45, label = prot_lbl),
hjust = 1, size = 2.1, vjust = 1, color = 'grey20')
plot_combined <- cowplot::plot_grid(mpa_plot_unweighted +
theme(strip.text.y = element_blank(),
legend.justification = c(1, 1),
legend.position = c(1, 1)),
mpa_plot_rrweighted +
theme(legend.position = 'none'),
labels = c('C', 'D'),
label_size = 9,
hjust = 0,
rel_widths = c(2, 3))
ggsave(file.path(dir_git, 'ms_figures/fig_S2b_bd_risk_vs_mpas_any.png'),
height = 2.75, width = 4.75, dpi = 300, units = 'in')
```
![](ms_figures/fig_S2b_bd_risk_vs_mpas_any.png)
### unweighted means
`r knitr::kable(any_means)`
### rr-weighted means
`r knitr::kable(any_rr_means)`
``` {r save means}
means_to_save <- any_means %>%
left_join(any_rr_means %>% rename(mu_rr = mu),
by = c('lbl', 'mpa_status'))
write_csv(means_to_save, file.path(dir_setup, 'int/mpa_mean_risks_any.csv'))
```