Skip to contents

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”.

Load subset of {survdat} data

#NEesp2::survdat_subset
#NEesp2::species

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) 
## Rows: 235 Columns: 11
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## chr (4): SpeciesName, Season, Gender, ln_a
## dbl (7): LW_SVSPP, N, SEa, b, SEb, SE_estimate, r2
## 
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
bsb_condition <- condition %>%
  subset(Species == 'Black sea bass')
head(bsb_condition)
## # A tibble: 6 x 7
##   Species        EPU    Time MeanCond nCond     sd variance
##   <chr>          <chr> <dbl>    <dbl> <int>  <dbl>    <dbl>
## 1 Black sea bass GB     1994    0.983     4 0.0415  0.00172
## 2 Black sea bass GB     1999    0.960    15 0.0415  0.00172
## 3 Black sea bass GB     2000    0.982     4 0.0415  0.00172
## 4 Black sea bass GB     2003    0.965     8 0.0415  0.00172
## 5 Black sea bass GB     2005    0.944    13 0.0415  0.00172
## 6 Black sea bass GB     2007    0.962     7 0.0415  0.00172
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')) %>%
  dplyr::rename(INDICATOR_NAME = indicator_name,
                DATA_VALUE = indicator_value) 
head(bsb_range)
## # A tibble: 6 x 6
##    YEAR SEASON INDICATOR_NAME DATA_VALUE species        SVSPP
##   <dbl> <chr>  <chr>               <dbl> <chr>          <dbl>
## 1  1983 FALL   range_lat            5.33 BLACK SEA BASS   141
## 2  1983 FALL   range_lon            5.93 BLACK SEA BASS   141
## 3  1984 FALL   range_lat            5.67 BLACK SEA BASS   141
## 4  1984 FALL   range_lon            5.2  BLACK SEA BASS   141
## 5  1985 FALL   range_lat            6.57 BLACK SEA BASS   141
## 6  1985 FALL   range_lon            5.58 BLACK SEA BASS   141
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')

Species diet table

Uses ‘diet’ function in R/create_bottomtrawl_indicators.R

allfh <- get(load(here::here("data-raw/allfh.RData")))
diet <- diet(data = allfh)
head(diet)
## # A tibble: 6 x 6
## # Groups:   prey_name, season, region [1]
##   prey_name      season region  year mean_proportion    range_proportion
##   <chr>          <chr>  <chr>  <int> <chr>              <chr>           
## 1 ANIMAL_REMAINS FALL   GB      1978 "0.034 +- NA (1) " 0.034 - 0.034   
## 2 ANIMAL_REMAINS FALL   GB      1979 "0.006 +- NA (1) " 0.006 - 0.006   
## 3 ANIMAL_REMAINS FALL   GB      1986 "0.05 +- NA (1) "  0.05 - 0.05     
## 4 ANIMAL_REMAINS FALL   GB      1989 "0.046 +- NA (1) " 0.046 - 0.046   
## 5 ANIMAL_REMAINS FALL   GB      1990 "0.012 +- NA (1) " 0.012 - 0.012   
## 6 ANIMAL_REMAINS FALL   GB      1991 "0.022 +- NA (1) " 0.022 - 0.022

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 7
##    Year SVSPP     variance      se       sd indicator_name     indicator_value
##   <dbl> <dbl>        <dbl>   <dbl>    <dbl> <chr>                        <dbl>
## 1  1983   141   611006122.  24719. 1150775. swept_area_biomass         313872.
## 2  1984   141    38320078.   6190. 1150775. swept_area_biomass        2867870.
## 3  1985   141  1413388353.  37595. 1150775. swept_area_biomass         696770.
## 4  1986   141  2779662376.  52723. 1150775. swept_area_biomass         428373.
## 5  1987   141 44213084604. 210269. 1150775. swept_area_biomass         639254.
## 6  1988   141  5163593606.  71858. 1150775. swept_area_biomass         229675.
bsb_swept_area %>%
  ggplot2::ggplot(ggplot2::aes(x = Year,
                               y = indicator_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 8
##    Year SEASON SVSPP variance     se    sd indicator_name     indicator_value
##   <dbl> <chr>  <dbl>    <dbl>  <dbl> <dbl> <chr>                        <dbl>
## 1  1983 FALL     141 0.000850 0.0292 0.845 strat_mean_biomass           0.370
## 2  1984 FALL     141 0.000104 0.0102 0.845 strat_mean_biomass           4.72 
## 3  1985 FALL     141 0.00277  0.0527 0.845 strat_mean_biomass           0.976
## 4  1986 FALL     141 0.00119  0.0344 0.845 strat_mean_biomass           0.280
## 5  1987 FALL     141 0.0636   0.252  0.845 strat_mean_biomass           0.767
## 6  1988 FALL     141 0.0233   0.153  0.845 strat_mean_biomass           0.488
bsb_strat_mean %>%
  ggplot2::ggplot(ggplot2::aes(x = Year,
                               y = indicator_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")