@@ -24,23 +24,24 @@ FIS <- function(layers) {
2424 AlignDataYears(layer_nm = " fis_b_bmsy" , layers_obj = layers ) %> %
2525 dplyr :: select(region_id = rgn_id , stock_id , year = scenario_year , bbmsy )
2626
27+ # # The following code is commented out because we removed the underharvest penalty for v2021. I am leaving the commented out code in the script for future reference, if we want to implement something similar.
2728 # The following stocks are fished in multiple regions and often have high b/bmsy values
2829 # Due to the underfishing penalty, this actually penalizes the regions that have the highest
2930 # proportion of catch of these stocks.
3031
31- high_bmsy_filter <- dplyr :: filter(b , bbmsy > 1.5 & year == 2015 ) %> %
32- dplyr :: group_by(stock_id ) %> %
33- dplyr :: summarise(n = dplyr :: n()) %> %
34- data.frame () %> %
35- dplyr :: filter(n > 3 )
36-
37- high_bmsy <- high_bmsy_filter $ stock_id
32+ # high_bmsy_filter <- dplyr::filter(b, bbmsy>1.5 & year == 2015) %>%
33+ # dplyr::group_by(stock_id) %>%
34+ # dplyr::summarise(n = dplyr::n()) %>%
35+ # data.frame() %>%
36+ # dplyr::filter(n>3)
37+ #
38+ # high_bmsy <- high_bmsy_filter$stock_id
3839
3940 # b <- b %>%
4041 # dplyr::mutate(bbmsy = ifelse(stock_id %in% high_bmsy &
4142 # bbmsy > 1, 1, bbmsy))
4243
43- # # no underharvest penalty
44+ # # Do not apply an underharvest penalty! Cap bbmsy at 1.
4445 b <- b %> %
4546 dplyr :: mutate(bbmsy = ifelse(bbmsy > 1 , 1 , bbmsy ))
4647
@@ -64,6 +65,7 @@ FIS <- function(layers) {
6465 dplyr :: mutate(stock_id = as.character(stock_id ))
6566
6667
68+ # # Note: We can probably ignore the upper buffer now.. since we cap all scores at 1 anyways above.
6769 # ###
6870 # STEP 1. Calculate scores for Bbmsy values
6971 # ###
@@ -245,20 +247,7 @@ MAR <- function(layers) {
245247 mutate(sm_tonnes = ifelse(sm_tonnes == " NaN" , 0 , sm_tonnes ))
246248
247249
248- # smoothed mariculture harvest * sustainability coefficient
249- # m <- m %>%
250- # dplyr::mutate(sust_tonnes = sust_coeff * sm_tonnes)
251-
252-
253250 # aggregate all weighted timeseries per region, and divide by potential mariculture
254-
255- # ry = m %>%
256- # dplyr::group_by(rgn_id, scenario_year) %>%
257- # dplyr::summarize(sust_tonnes_sum = sum(sust_tonnes, na.rm = TRUE)) %>% #na.rm = TRUE assumes that NA values are 0
258- # dplyr::left_join(reference_point, by = c('rgn_id', 'scenario_year')) %>%
259- # dplyr::mutate(mar_score = sust_tonnes_sum / potential_mar_tonnes) %>%
260- # dplyr::ungroup()
261- #
262251
263252 tonnes_pot_div <- m %> %
264253 dplyr :: group_by(rgn_id , scenario_year ) %> %
@@ -268,17 +257,12 @@ MAR <- function(layers) {
268257 dplyr :: ungroup()
269258
270259 sustainability <- m %> %
271- # dplyr::group_by(scenario_year, rgn_id) %>%
272- # dplyr::mutate(SumProd = sum(sm_tonnes, na.rm=TRUE)) %>%
273- # dplyr::ungroup() %>%
274- # dplyr::mutate(wprop = sm_tonnes / SumProd) %>%
275260 dplyr :: group_by(rgn_id , scenario_year ) %> %
276261 dplyr :: summarise(sust_rgn = weighted.mean(x = sust_coeff , w = sm_tonnes , na.rm = TRUE )) %> %
277262 dplyr :: ungroup()
278263
279264 ry <- sustainability %> %
280265 dplyr :: left_join(tonnes_pot_div ) %> %
281- # dplyr::mutate(mar_score = sust_rgn*tonnes_score) %>%
282266 dplyr :: mutate(status = ifelse(tonnes_score > 1 ,
283267 1 ,
284268 tonnes_score )) %> %
@@ -1311,12 +1295,6 @@ LSP <- function(layers) {
13111295 year = scenario_year ,
13121296 cp = a_prot_1km )
13131297
1314-
1315- # ry_offshore <- layers$data$lsp_prot_area_offshore3nm %>%
1316- # select(region_id = rgn_id, year, cmpa = a_prot_3nm)
1317- # ry_inland <- layers$data$lsp_prot_area_inland1km %>%
1318- # select(region_id = rgn_id, year, cp = a_prot_1km)
1319- #
13201298 lsp_data <- full_join(offshore , inland , by = c(" region_id" , " year" ))
13211299
13221300 # fill in time series for all regions
0 commit comments