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

Species Condition - Black sea bass

Create and plot species condition

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,
  output = "esp"
)
## Joining with `by = join_by(STRATUM)`
## Joining with `by = join_by(count)`
## Removing 16811 outliers from the data set.
bsb_condition <- condition %>%
  subset(Species == "Black sea bass")
head(bsb_condition)
## # A tibble: 6 × 5
##   Species        EPU    YEAR DATA_VALUE INDICATOR_NAME
##   <chr>          <chr> <dbl>      <dbl> <chr>         
## 1 Black sea bass MAB    1992      0.985 mean condition
## 2 Black sea bass MAB    1993      0.998 mean condition
## 3 Black sea bass GB     1994      0.983 mean condition
## 4 Black sea bass MAB    1994      1.02  mean condition
## 5 Black sea bass MAB    1995      0.997 mean condition
## 6 Black sea bass MAB    1996      0.982 mean condition
plot_condition(data = bsb_condition, var = "Black sea bass")

Data are aggregated at the EPU level by default, but the data can also be assessed as a unit.

condition <- species_condition(
  data = NEesp2::survdat_subset,
  LWparams = LWparams,
  species.codes = species.codes,
  output = "esp",
  by_EPU = FALSE
)
## Joining with `by = join_by(count)`
## Removing 16811 outliers from the data set.
bsb_condition <- condition %>%
  subset(Species == "Black sea bass")
head(bsb_condition)
## # A tibble: 6 × 5
##   Species        EPU    YEAR DATA_VALUE INDICATOR_NAME
##   <chr>          <chr> <dbl>      <dbl> <chr>         
## 1 Black sea bass UNIT   1992      0.986 mean condition
## 2 Black sea bass UNIT   1993      0.997 mean condition
## 3 Black sea bass UNIT   1994      1.01  mean condition
## 4 Black sea bass UNIT   1995      0.995 mean condition
## 5 Black sea bass UNIT   1996      0.981 mean condition
## 6 Black sea bass UNIT   1997      0.986 mean condition
plot_condition(data = bsb_condition, var = "Black sea bass")

Create species condition for the State of the Ecosystem report

By setting output = "soe", the species_condition function will format the output in the same style as ecodata::condition. Note that black sea bass is the only species included in the sample dataset shown below, but if additional species were present in the data, the output would be aggregated at the species level.

condition <- species_condition(
  data = NEesp2::survdat_subset,
  LWparams = LWparams,
  species.codes = species.codes,
  output = "soe"
)
## Joining with `by = join_by(STRATUM)`
## Joining with `by = join_by(count)`
## Removing 16811 outliers from the data set.
head(condition)
## # A tibble: 6 × 5
##    Time Var             EPU   Value Units   
##   <dbl> <chr>           <chr> <dbl> <chr>   
## 1  1992 Acadian redfish GB    1.02  MeanCond
## 2  1992 Acadian redfish GOM   0.978 MeanCond
## 3  1992 Acadian redfish SS    1.00  MeanCond
## 4  1993 Acadian redfish GB    1.02  MeanCond
## 5  1993 Acadian redfish GOM   0.994 MeanCond
## 6  1993 Acadian redfish SS    1.02  MeanCond

Additional condition queries

species_condition can also assess the data by sex and by length bin. If these options are selected, the output will be a “full” dataset that contains additional data columns identifying the grouping parameters and data variance. For example:

condition <- species_condition(
  data = NEesp2::survdat_subset,
  LWparams = LWparams,
  species.codes = species.codes,
  by_sex = TRUE,
  length_break = c(0, 20, 65)
)
## You asked to group results by sex and/or length ; data will not be formatted for SOE or ESP output.
## Joining with `by = join_by(STRATUM)`
## Joining with `by = join_by(count)`
## Removing 16811 outliers from the data set.
head(condition)
## # A tibble: 6 × 10
##   Species          YEAR EPU   sexMF length_group MeanCond nCond     sd variance
##   <chr>           <dbl> <chr> <chr> <fct>           <dbl> <int>  <dbl>    <dbl>
## 1 Acadian redfish  1992 GOM   0     [0,20]          1.09      6 0.0559 0.00312 
## 2 Acadian redfish  1992 GOM   1     [0,20]          1.02     27 0.0273 0.000746
## 3 Acadian redfish  1992 GOM   1     (20,65]         0.985    99 0.0194 0.000378
## 4 Acadian redfish  1992 GOM   2     [0,20]          0.927    13 0.0267 0.000713
## 5 Acadian redfish  1992 GOM   2     (20,65]         0.958    93 0.0281 0.000790
## 6 Acadian redfish  1992 SS    1     [0,20]          1.04     11 0.0358 0.00128 
## # ℹ 1 more variable: INDICATOR_NAME <chr>

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 × 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")
## Warning: The `tidy` argument is deprecated and will be removed in the next
## version. `calc_swept_area()` will soon strictly return tidy output.
## Prepping data ...
## Spherical geometry (s2) switched off
## Filtering data ...
## Calculating Stratified Mean  ...
## Calculating Swept Area Estimate  ...
## Assuming a value of q = 1 for all groups
head(bsb_swept_area)
## # A tibble: 6 × 8
##    YEAR SVSPP   variance     se     sd INDICATOR_UNITS INDICATOR_NAME DATA_VALUE
##   <dbl> <dbl>      <dbl>  <dbl>  <dbl> <chr>           <chr>               <dbl>
## 1  1983   141    1.82e 9 4.27e4 3.43e7 numberstow-1    swept_area_bi…    173138.
## 2  1984   141    2.12e11 4.60e5 3.43e7 numberstow-1    swept_area_bi…    520280.
## 3  1985   141    7.09e 9 8.42e4 3.43e7 numberstow-1    swept_area_bi…    291244.
## 4  1986   141    6.36e 9 7.98e4 3.43e7 numberstow-1    swept_area_bi…    255195.
## 5  1987   141    3.45e10 1.86e5 3.43e7 numberstow-1    swept_area_bi…    428221.
## 6  1988   141    2.73e 9 5.22e4 3.43e7 numberstow-1    swept_area_bi…    159033.
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 ...
## Calculating Stratified Mean  ...
head(bsb_strat_mean)
## # A tibble: 6 × 9
##    YEAR SEASON SVSPP  variance      se    sd INDICATOR_UNITS INDICATOR_NAME    
##   <dbl> <chr>  <dbl>     <dbl>   <dbl> <dbl> <chr>           <chr>             
## 1  1983 FALL     141 0.0000423 0.00650  5.87 kgtow-1         strat_mean_biomass
## 2  1984 FALL     141 0.00502   0.0709   5.87 kgtow-1         strat_mean_biomass
## 3  1985 FALL     141 0.000169  0.0130   5.87 kgtow-1         strat_mean_biomass
## 4  1986 FALL     141 0.000151  0.0123   5.87 kgtow-1         strat_mean_biomass
## 5  1987 FALL     141 0.000861  0.0293   5.87 kgtow-1         strat_mean_biomass
## 6  1988 FALL     141 0.0000702 0.00838  5.87 kgtow-1         strat_mean_biomass
## # ℹ 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"
  )