Using {survdat} for Bottom Trawl Indicators
Stephanie Owen
Source:vignettes/using_survdat_data.Rmd
using_survdat_data.Rmd
Bottom Trawl Indicators in NEESP2
This package contains functions for producing bottom trawl indicators from {survdat} data pulls: swept area biomass, stratified mean biomass, species condition, diet, and range. This vignette provides example output data tables and plots using these functions.
For more information on accessing {survdat} data, see vignette “Accessing Bottom Trawl Survey Data”.
Species Condition - Black sea bass
Uses ‘species_condition’ and ‘plot_condition’ functions in R/create_condition_indicator.R and R/plot_condition.R
condition <- species_condition(data = NEesp2::survdat_subset, LWparams = LWparams, species.codes = species.codes)
## Joining with `by = join_by(STRATUM)`
## Joining with `by = join_by(count)`
## # A tibble: 6 x 8
## Species EPU YEAR DATA_VALUE nCond sd variance INDICATOR_NAME
## <chr> <chr> <dbl> <dbl> <int> <dbl> <dbl> <chr>
## 1 Black sea bass GB 1994 0.983 4 0.0330 0.00109 mean condition
## 2 Black sea bass GB 1999 0.960 15 0.0330 0.00109 mean condition
## 3 Black sea bass GB 2000 0.982 4 0.0330 0.00109 mean condition
## 4 Black sea bass GB 2003 0.965 8 0.0330 0.00109 mean condition
## 5 Black sea bass GB 2005 0.944 13 0.0330 0.00109 mean condition
## 6 Black sea bass GB 2007 0.962 7 0.0330 0.00109 mean condition
plot_condition(data = bsb_condition, var = 'Black sea bass')
Species Range - Black sea bass in fall
Uses ‘species_range’ function in R/create_bottomtrawl_indicators.R
range <- species_range(data = NEesp2::survdat_subset, species = NEesp2::species)
## Joining with `by = join_by(SVSPP)`
bsb_range <- range %>%
subset(SPECIES == 'BLACK SEA BASS') %>%
subset(SEASON == 'FALL') %>%
subset(INDICATOR_NAME == c('range_lat','range_lon'))
head(bsb_range)
## # A tibble: 6 x 7
## YEAR SEASON INDICATOR_NAME DATA_VALUE SPECIES SVSPP INDICATOR_UNITS
## <dbl> <chr> <chr> <dbl> <chr> <dbl> <chr>
## 1 1983 FALL range_lat 5.33 BLACK SEA BASS 141 degrees
## 2 1983 FALL range_lon 5.93 BLACK SEA BASS 141 degrees
## 3 1984 FALL range_lat 5.67 BLACK SEA BASS 141 degrees
## 4 1984 FALL range_lon 5.2 BLACK SEA BASS 141 degrees
## 5 1985 FALL range_lat 6.57 BLACK SEA BASS 141 degrees
## 6 1985 FALL range_lon 5.58 BLACK SEA BASS 141 degrees
bsb_range %>%
ggplot2::ggplot(ggplot2::aes(x = YEAR,
y = DATA_VALUE,
color = INDICATOR_NAME,
)) +
ggplot2::geom_point() +
ggplot2::geom_path() +
ggplot2::theme_bw() +
ggplot2::labs(title = "Black Sea Bass Range in Fall (Lat + Lon)",
x = "Year",
y = "Range (degrees)") +
ggplot2::facet_wrap('INDICATOR_NAME')
Swept area biomass - Black sea bass in fall
Uses ‘create_swept_area’ indicator in R/create_bottomtrawl_indicators.R
Modified from ‘calc_swept_area’ in {survdat} package.
bsb_swept_area <- create_swept_area(
surveyData = NEesp2::survdat_subset,
areaPolygon = "NEFSC strata",
areaDescription = "STRATA",
filterByArea = "all",
filterBySeason = "FALL",
groupDescription = "SVSPP",
filterByGroup = "all",
mergesexFlag = T,
tidy = F,
q = NULL,
a = 0.0384
) %>%
dplyr::filter(SVSPP == "141")
## Prepping data ...
## Spherical geometry (s2) switched off
## Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is FALSE
## Filtering data ...
## [1] 3820 3880 3890 3900 3920 1352 0 3860 3840 3870 1390 1351
## [13] 1380 3850 1360 1330 1340 3760 3790 3830 3800 3730 3810 1400
## [25] 3770 3780 3740 3750 3908 3720 3710 1270 1370 1260 3700 1310
## [37] 1280 3690 3680 3670 3660 3650 3630 3640 3620 1320 1290 1300
## [49] 1240 1220 1210 3580 3610 3590 3600 1200 3560 1180 1170 1160
## [61] 3570 1190 1230 1250 3470 3500 3510 3530 3550 3520 3540 3480
## [73] 3450 3460 1050 1090 1130 3010 3020 3030 1100 3040 3050 1060
## [85] 3060 3070 3080 1140 1150 1010 3090 3100 3110 3120 3130 3140
## [97] 1020 1070 1110 1120 3150 3160 3170 1080 1730 1030 1040 3180
## [109] 3190 3200 1740 1750 3220 3230 1760 1690 3240 3250 3260 1700
## [121] 1710 3270 3280 3290 1720 3300 3310 3320 1650 1660 1670 3330
## [133] 1680 3340 3350 3360 3370 3380 3390 3400 3410 1610 1620 1630
## [145] 1640 3420 3430 3440 8510 8520 8530 8500 7500 7510 7520 7540
## [157] 7550 99999 7590 8540 7530 7570 7600 7580 8550 7610 8560 8570
## [169] 7620 7630 7640 8580 7650 7660 7670 8590 8600 8770
## Calculating Stratified Mean ...
## Calculating Swept Area Estimate ...
head(bsb_swept_area)
## # A tibble: 6 x 8
## YEAR SVSPP variance se sd INDICATOR_UNITS INDICATOR_NAME DATA_VALUE
## <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <dbl>
## 1 1983 141 6.11e 8 2.47e4 1.15e6 numberstow-1 swept_area_bi~ 313872.
## 2 1984 141 3.83e 7 6.19e3 1.15e6 numberstow-1 swept_area_bi~ 2867870.
## 3 1985 141 1.41e 9 3.76e4 1.15e6 numberstow-1 swept_area_bi~ 696770.
## 4 1986 141 2.78e 9 5.27e4 1.15e6 numberstow-1 swept_area_bi~ 428373.
## 5 1987 141 4.42e10 2.10e5 1.15e6 numberstow-1 swept_area_bi~ 639254.
## 6 1988 141 5.16e 9 7.19e4 1.15e6 numberstow-1 swept_area_bi~ 229675.
bsb_swept_area %>%
ggplot2::ggplot(ggplot2::aes(x = YEAR,
y = DATA_VALUE,
)) +
ggplot2::geom_point() +
ggplot2::geom_path() +
ggplot2::theme_bw() +
ggplot2::labs(title = "Black Sea Bass Swept Area Biomass (Fall)",
x = "Year",
y = "Swept Area Biomass")
Stratified mean biomass - Black sea bass in fall
Uses ‘create_stratified_mean’ indicator in R/create_bottomtrawl_indicators.R
Modified from ‘calc_stratified_mean’ in {survdat} package.
bsb_strat_mean <- create_stratified_mean(
surveyData = survdat_subset,
areaPolygon = "NEFSC strata",
areaDescription = "STRATA",
filterByArea = "all",
filterBySeason = "FALL",
groupDescription = "SVSPP",
filterByGroup = "all",
mergesexFlag = T,
tidy = F,
returnPrepData = F
) %>%
dplyr::filter(SVSPP == "141")
## Prepping data ...
## Filtering data ...
## [1] 3820 3880 3890 3900 3920 1352 0 3860 3840 3870 1390 1351
## [13] 1380 3850 1360 1330 1340 3760 3790 3830 3800 3730 3810 1400
## [25] 3770 3780 3740 3750 3908 3720 3710 1270 1370 1260 3700 1310
## [37] 1280 3690 3680 3670 3660 3650 3630 3640 3620 1320 1290 1300
## [49] 1240 1220 1210 3580 3610 3590 3600 1200 3560 1180 1170 1160
## [61] 3570 1190 1230 1250 3470 3500 3510 3530 3550 3520 3540 3480
## [73] 3450 3460 1050 1090 1130 3010 3020 3030 1100 3040 3050 1060
## [85] 3060 3070 3080 1140 1150 1010 3090 3100 3110 3120 3130 3140
## [97] 1020 1070 1110 1120 3150 3160 3170 1080 1730 1030 1040 3180
## [109] 3190 3200 1740 1750 3220 3230 1760 1690 3240 3250 3260 1700
## [121] 1710 3270 3280 3290 1720 3300 3310 3320 1650 1660 1670 3330
## [133] 1680 3340 3350 3360 3370 3380 3390 3400 3410 1610 1620 1630
## [145] 1640 3420 3430 3440 8510 8520 8530 8500 7500 7510 7520 7540
## [157] 7550 99999 7590 8540 7530 7570 7600 7580 8550 7610 8560 8570
## [169] 7620 7630 7640 8580 7650 7660 7670 8590 8600 8770
## Calculating Stratified Mean ...
head(bsb_strat_mean)
## # A tibble: 6 x 9
## YEAR SEASON SVSPP variance se sd INDICATOR_UNITS INDICATOR_NAME
## <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr>
## 1 1983 FALL 141 0.000850 0.0292 0.845 kgtow-1 strat_mean_biomass
## 2 1984 FALL 141 0.000104 0.0102 0.845 kgtow-1 strat_mean_biomass
## 3 1985 FALL 141 0.00277 0.0527 0.845 kgtow-1 strat_mean_biomass
## 4 1986 FALL 141 0.00119 0.0344 0.845 kgtow-1 strat_mean_biomass
## 5 1987 FALL 141 0.0636 0.252 0.845 kgtow-1 strat_mean_biomass
## 6 1988 FALL 141 0.0233 0.153 0.845 kgtow-1 strat_mean_biomass
## # i 1 more variable: DATA_VALUE <dbl>
bsb_strat_mean %>%
ggplot2::ggplot(ggplot2::aes(x = YEAR,
y = DATA_VALUE,
)) +
ggplot2::geom_point() +
ggplot2::geom_path() +
ggplot2::theme_bw() +
ggplot2::labs(title = "Black Sea Bass Stratified Mean Biomass (Fall)",
x = "Year",
y = "Stratified Mean Biomass")