diff --git a/..Rcheck/00check.log b/..Rcheck/00check.log new file mode 100644 index 00000000..aec3c1a5 --- /dev/null +++ b/..Rcheck/00check.log @@ -0,0 +1,13 @@ +* using log directory ‘/home/rklasky/R/packages/Rpath/..Rcheck’ +* using R version 4.3.1 (2023-06-16) +* using platform: x86_64-pc-linux-gnu (64-bit) +* R was compiled by + gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 + GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 +* running under: Linux Mint 20 +* using session charset: UTF-8 +* checking for file ‘./DESCRIPTION’ ... ERROR +Required fields missing or empty: + ‘Author’ ‘Maintainer’ +* DONE +Status: 1 ERROR diff --git a/.Rbuildignore b/.Rbuildignore index d416705d..51de8582 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,8 +1,10 @@ - -^.*\.Rproj$ -^\.Rproj\.user$ -^\.github$ -^_pkgdown\.yml$ -^docs$ -^pkgdown$ -^data-raw$ + +^.*\.Rproj$ +^\.Rproj\.user$ +^\.github$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ +^data-raw$ +^doc$ +^Meta$ \ No newline at end of file diff --git a/.Renviron b/.Renviron new file mode 100644 index 00000000..357e3a04 --- /dev/null +++ b/.Renviron @@ -0,0 +1 @@ +_R_CHECK_DONTTEST_EXAMPLES_=FALSE diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 05282628..12449b10 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,8 +1,8 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master] + branches: [main, master, UnitTests] pull_request: branches: [main, master] @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} @@ -29,30 +29,21 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: rcmdcheck - - - uses: r-lib/actions/check-r-package@v1 - - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 2623cee6..187ab501 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -12,7 +12,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@master diff --git a/.github/workflows/secretScan.yml b/.github/workflows/secretScan.yml index 51301a68..57602a3a 100644 --- a/.github/workflows/secretScan.yml +++ b/.github/workflows/secretScan.yml @@ -8,6 +8,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - fetch-depth: '0' + fetch-depth: '2' - name: gitleaks-action - uses: zricethezav/gitleaks-action@master + uses: gitleaks/gitleaks-action@v1.6.0 + \ No newline at end of file diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 00000000..b78d0619 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,94 @@ + +on: + push: + paths: + - '.github/workflows/tests.yml' + - 'R/*' + - 'tests/testthat/*' + - 'README.md' + - 'DESCRIPTION' + pull_request: + paths: + - '.github/workflows/tests.yml' + - 'R/*' + - 'tests/testthat/*' + +name: Unit-Tests + +jobs: + # build: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: r-lib/actions/setup-r@v2 + # - uses: r-lib/actions/setup-pandoc@v2 + # - name: Install dependencies + # run: Rscript -e "install.packages(c('testthat', 'tidyverse', 'here'))" + # - name: Run tests + # run: Rscript -e "source('tests/testthat.R')" + + Unit-Tests: + runs-on: ${{matrix.config.os}} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + #os: [macos-latest, ubuntu-latest, windows-latest] + #os: [ubuntu-latest] + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} +# R_REMOTES_NO_ERRORS_FROM_WARNINGS: false + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true +# r-version: '4.3.1' + + - uses: r-lib/actions/setup-r-dependencies@v2 + + - name: Install command line packages + if: runner.os == 'Linux' + run: | + sudo apt update + sudo apt-get install libcurl4-openssl-dev libgit2-dev + + - name: Install dependencies + #run: Rscript -e "install.packages(c('remotes','testthat', 'tidyverse', 'here'))" + run: | + install.packages(c('usethis','remotes','testthat','tidyverse','here','rmarkdown','qpdf','distillery','ggpubr','rlist')) + remotes::install_github("NOAA-EDAB/Rpath") + shell: Rscript {0} + + - name: Run tests + #run: Rscript -e "source('tests/testthat.R')" + run: | + source(here::here("data-raw/REcosystem.R")) + source(here::here("tests/testthat.R")) + shell: Rscript {0} + + # - name: commit data files + # run: | + # git config user.name github-actions + # git config user.email github-actions@github.com + # file.copy('here::here("tests/testthat/Rplots.pdf")",to=here::here("inst/extdata/Rplots.pdf")) + # git add inst/extdata/Rplots.pdf + # git commit -m "automated commit from testthat yml" + # git push diff --git a/.gitignore b/.gitignore index 3b6055a1..95358e3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,29 @@ .Rproj.user .Rhistory .RData -*.png +.Renviron *.jpg *.tif +*.tar +*.so outputs code *.xlsx *.docx +*.pdf Ecopath_dev Rpath.Rcheck* src/*.o src/*.dll -NAMESPACE +tests/testthat/data/output/* +tests/testthat/data/bkup/* +tests/testthat/data/input/REcosystem_Current_*.dat +tests/testthat/data/input/REcosystem_Current_*.rds +tests/testthat/data/input/REcosystem_Current_*.csv +tests/testthat/old/* +tests/testthat/bkup/* +tests/testthat/old dat files/* docs +doc +Meta Rpath.Rproj diff --git a/DESCRIPTION b/DESCRIPTION index badce7bb..9b51f9ef 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,6 +16,7 @@ License: file LICENSE Encoding: UTF-8 Imports: data.table, + methods, graphics, grDevices, MASS, @@ -24,11 +25,24 @@ Imports: utils LinkingTo: Rcpp Suggests: + here, knitr, - rmarkdown + rmarkdown, + distillery, + ggplot2, + ggpubr, + rlist, + stringr, + qpdf, + usethis, + dplyr, + generics, + testthat (>= 3.0.0) VignetteBuilder: knitr -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 URL: https://github.com/NOAA-EDAB/Rpath BugReports: https://github.com/NOAA-EDAB/Rpath/issues Depends: R (>= 2.10) +Config/testthat/edition: 3 +LazyData: true diff --git a/NAMESPACE b/NAMESPACE index 9eaf692b..1a8646cf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -74,4 +74,5 @@ import(stats) import(utils) importFrom(Rcpp,sourceCpp) importFrom(grDevices,rainbow) +importFrom(methods,is) useDynLib(Rpath) diff --git a/NEWS.md b/NEWS.md index c56238ae..513e7288 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# Rpath 0.0.1.3 + +## Major Changes +- Added bioenergetic code +- adjust functions can now supply values by individual months rather than by years + # Rpath 0.0.1.2 ## Major Changes @@ -72,4 +78,4 @@ Did not keep good track of notes prior to version 0.0.0.9003 - My Bad -The initial files were the code sent by Kerim to Sean on March 31, 2014 (ecopath_sim_r_v0_04_toSean_31_03_14.zip) Files have been renamed to drop the version number and take advantage of this VCS. \ No newline at end of file +The initial files were the code sent by Kerim to Sean on March 31, 2014 (ecopath_sim_r_v0_04_toSean_31_03_14.zip) Files have been renamed to drop the version number and take advantage of this VCS. diff --git a/R/RcppExports.R b/R/RcppExports.R index f738567e..77fa2f96 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,23 +1,23 @@ -# Generated by using Rcpp::compileAttributes() -> do not edit by hand -# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - -rk4_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear) { - .Call('_Rpath_rk4_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear) -} - -Adams_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv) { - .Call('_Rpath_Adams_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv) -} - -deriv_vector <- function(params, state, forcing, fishing, stanzas, inyear, m, tt) { - .Call('_Rpath_deriv_vector', PACKAGE = 'Rpath', params, state, forcing, fishing, stanzas, inyear, m, tt) -} - -SplitSetPred <- function(stanzas, state) { - .Call('_Rpath_SplitSetPred', PACKAGE = 'Rpath', stanzas, state) -} - -SplitUpdate <- function(stanzas, state, forcing, deriv, yr, mon) { - .Call('_Rpath_SplitUpdate', PACKAGE = 'Rpath', stanzas, state, forcing, deriv, yr, mon) -} - +# Generated by using Rcpp::compileAttributes() -> do not edit by hand +# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 + +rk4_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear) { + .Call('_Rpath_rk4_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear) +} + +Adams_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv) { + .Call('_Rpath_Adams_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv) +} + +deriv_vector <- function(params, state, forcing, fishing, stanzas, inyear, m, tt) { + .Call('_Rpath_deriv_vector', PACKAGE = 'Rpath', params, state, forcing, fishing, stanzas, inyear, m, tt) +} + +SplitSetPred <- function(stanzas, state) { + .Call('_Rpath_SplitSetPred', PACKAGE = 'Rpath', stanzas, state) +} + +SplitUpdate <- function(stanzas, state, forcing, deriv, yr, mon) { + .Call('_Rpath_SplitUpdate', PACKAGE = 'Rpath', stanzas, state, forcing, deriv, yr, mon) +} + diff --git a/R/Rpath_support.R b/R/Rpath_support.R index 02897d4d..a225bcef 100644 --- a/R/Rpath_support.R +++ b/R/Rpath_support.R @@ -1,172 +1,199 @@ -######################################################################################## -# Set of functions for returning functional group names (character vector) -# using the type input column -# -# Internal supporting function for group names to check type -gtype <- function(Rpath){ - if(class(Rpath)=="Rpath"){gt<-list(type=Rpath$type, grp=Rpath$Group)} - else{ - if(class(Rpath)=="Rpath.params"){ - gt<-list(type=Rpath$model$Type, grp=Rpath$model$Group)} - else{ - stop("Input must be an Rpath (balanced) or Rpath.params (unbalanced) object.") - } - } - names(gt$type)<-NULL; names(gt$grp)<-NULL - return(gt) -} -#################################### -#' Rpath functional group names -#' -#' Get a character vector of functional group names from an Rpath object (balanced model) -#' or an Rpath.params object (unbalanced model parameters) based on the 'type' input -#' parameter as follows: (0: consumers, 1: producers, 2: detrital, 3: gears, 00 & gt$type<0])} - -################################################################################# -#' Extract start and end states from an rsim run output. -#' -#' Extract the starting or ending biomass or catch from the output of an rsim run. -#' -#'@name RsimEndpoints -#' -#'@family Rpath functions -#' -#'@param Rsim.output An Rsim output object generated by rsim.run or rsim.step. -#' -#'@return Returns a named vector of starting or ending biomass or catch. -NULL - -#'@rdname RsimEndpoints -#'@export -starting.biomass <- function(Rsim.output){ - return(Rsim.output$out_Biomass[1, 2:(dim(Rsim.output$out_Biomass)[2])]) -} - -#'@rdname RsimEndpoints -#'@export -ending.biomass <- function(Rsim.output){ - return(Rsim.output$out_Biomass[dim(Rsim.output$out_Biomass)[1], 2:(dim(Rsim.output$out_Biomass)[2])]) -} - -#'@rdname RsimEndpoints -#'@export -starting.catch <- function(Rsim.output){ - return(Rsim.output$out_Catch[1, 2:(dim(Rsim.output$out_Catch)[2])]) -} - -#'@rdname RsimEndpoints -#'@export -ending.catch <- function(Rsim.output){ - return(Rsim.output$out_CC[dim(Rsim.output$out_Catch)[1], 2:(dim(Rsim.output$out_Catch)[2])]) -} - - - -############################################################################### - -#'@export -rsim.deriv.q <- function(Rpath.scenario, year=0, month=0, tstep=0){ - scene <- copy(Rpath.scenario) - rout <- deriv_vector(scene$params, scene$start_state, - scene$forcing, scene$fishing, - scene$stanzas, year, month, tstep) - - rtab <- data.frame(scene$params$spname[scene$params$PreyTo+1], - scene$params$spname[scene$params$PreyFrom+1], - rout$Qlink) - colnames(rtab)<-c("Predator","Prey","Q") - return(rtab) -} - -############################################################################### -#'@export -get.rsim.predprey <- function(scene,predator="all",prey="all"){ - pd <- scene$params$spname[scene$params$PreyTo+1] - py <- scene$params$spname[scene$params$PreyFrom+1] - if (predator=="all") predator <- scene$params$spname - if (prey=="all") prey <- scene$params$spname - link <- which((pd %in% predator) & (py %in% prey)) - predname <- pd[link] - preyname <- py[link] - QQ <- scene$params$QQ[link] - DD <- scene$params$DD[link] - VV <- scene$params$VV[link] - PredPredWeight <- scene$params$PredPredWeight[link] - PreyPreyWeight <- scene$params$PreyPreyWeight[link] - HandleSwitch <- scene$params$HandleSwitch[link] - return(data.frame(link,predname,preyname,QQ,VV,DD, - HandleSwitch,PredPredWeight,PreyPreyWeight)) -} - -############################################################################### -#'@export -get.rsim.predprey.link <- function(scene,predator="all",prey="all"){ - pd <- scene$params$spname[scene$params$PreyTo+1] - py <- scene$params$spname[scene$params$PreyFrom+1] - if (predator=="all") predator <- scene$params$spname - if (prey=="all") prey <- scene$params$spname - link <- which((pd %in% predator) & (py %in% prey)) - return(link) -} - -############################################################################### -#'@export -adjust.rsim.predprey <- function(scene,parameter, - predator="all",prey="all",values){ - pd <- scene$params$spname[scene$params$PreyTo+1] - py <- scene$params$spname[scene$params$PreyFrom+1] - if (predator=="all") predator <- scene$params$spname - if (prey=="all") prey <- scene$params$spname - link <- which((pd %in% predator) & (py %in% prey)) - - if (parameter %in% c('QQ', 'VV', 'DD', 'HandleSwitch', 'PredPredWeight', - 'PreyPreyWeight')){ - scene$params[[parameter]][link] <- values - } - else {(warning(parameter," is not a valid predator/prey parameter."))} - - return(scene) -} - -############################################################################### - - - +library(methods) + +######################################################################################## +# Set of functions for returning functional group names (character vector) +# using the type input column +# +# Internal supporting function for group names to check type +#' +#' @importFrom methods is +#' +grouptype <- function(Rpath) { + if (is(Rpath,"Rpath")) { + gt<-list(type=Rpath$type, grp=Rpath$Group) + } else { + if (is(Rpath,"Rpath.params")) { + gt<-list(type=Rpath$model$Type, grp=Rpath$model$Group)} + else{ + stop("Input must be an Rpath (balanced) or Rpath.params (unbalanced) object.") + } + } + names(gt$type)<-NULL; names(gt$grp)<-NULL + return(gt) +} +#################################### +#' Rpath functional group names +#' +#' Get a character vector of functional group names from an Rpath object (balanced model) +#' or an Rpath.params object (unbalanced model parameters) based on the 'type' input +#' parameter as follows: (0: consumers, 1: producers, 2: detrital, 3: gears, 00 & gt$type<0]) +} + +################################################################################# +#' Extract start and end states from an rsim run output. +#' +#' Extract the starting or ending biomass or catch from the output of an rsim run. +#' +#'@name RsimEndpoints +#' +#'@family Rpath functions +#' +#'@param Rsim.output An Rsim output object generated by rsim.run or rsim.step. +#' +#'@return Returns a named vector of starting or ending biomass or catch. +NULL + +#'@rdname RsimEndpoints +#'@export +starting.biomass <- function(Rsim.output){ + return(Rsim.output$out_Biomass[1, 2:(dim(Rsim.output$out_Biomass)[2])]) +} + +#'@rdname RsimEndpoints +#'@export +ending.biomass <- function(Rsim.output){ + return(Rsim.output$out_Biomass[dim(Rsim.output$out_Biomass)[1], 2:(dim(Rsim.output$out_Biomass)[2])]) +} + +#'@rdname RsimEndpoints +#'@export +starting.catch <- function(Rsim.output){ + return(Rsim.output$out_Catch[1, 2:(dim(Rsim.output$out_Catch)[2])]) +} + +#'@rdname RsimEndpoints +#'@export +ending.catch <- function(Rsim.output){ + return(Rsim.output$out_CC[dim(Rsim.output$out_Catch)[1], 2:(dim(Rsim.output$out_Catch)[2])]) +} + + + +############################################################################### + +#'@export +rsim.deriv.q <- function(Rpath.scenario, year=0, month=0, tstep=0){ + scene <- copy(Rpath.scenario) + rout <- deriv_vector(scene$params, scene$start_state, + scene$forcing, scene$fishing, + scene$stanzas, year, month, tstep) + + rtab <- data.frame(scene$params$spname[scene$params$PreyTo+1], + scene$params$spname[scene$params$PreyFrom+1], + rout$Qlink) + colnames(rtab)<-c("Predator","Prey","Q") + return(rtab) +} + +############################################################################### +#'@export +get.rsim.predprey <- function(scene,predator="all",prey="all"){ + pd <- scene$params$spname[scene$params$PreyTo+1] + py <- scene$params$spname[scene$params$PreyFrom+1] + if (predator=="all") predator <- scene$params$spname + if (prey=="all") prey <- scene$params$spname + link <- which((pd %in% predator) & (py %in% prey)) + predname <- pd[link] + preyname <- py[link] + QQ <- scene$params$QQ[link] + DD <- scene$params$DD[link] + VV <- scene$params$VV[link] + PredPredWeight <- scene$params$PredPredWeight[link] + PreyPreyWeight <- scene$params$PreyPreyWeight[link] + HandleSwitch <- scene$params$HandleSwitch[link] + return(data.frame(link,predname,preyname,QQ,VV,DD, + HandleSwitch,PredPredWeight,PreyPreyWeight)) +} + +############################################################################### +#'@export +get.rsim.predprey.link <- function(scene,predator="all",prey="all"){ + pd <- scene$params$spname[scene$params$PreyTo+1] + py <- scene$params$spname[scene$params$PreyFrom+1] + if (predator=="all") predator <- scene$params$spname + if (prey=="all") prey <- scene$params$spname + link <- which((pd %in% predator) & (py %in% prey)) + return(link) +} + +############################################################################### +#'@export +adjust.rsim.predprey <- function(scene,parameter, + predator="all",prey="all",values){ + pd <- scene$params$spname[scene$params$PreyTo+1] + py <- scene$params$spname[scene$params$PreyFrom+1] + if (predator=="all") predator <- scene$params$spname + if (prey=="all") prey <- scene$params$spname + link <- which((pd %in% predator) & (py %in% prey)) + + if (parameter %in% c('QQ', 'VV', 'DD', 'HandleSwitch', 'PredPredWeight', + 'PreyPreyWeight')){ + scene$params[[parameter]][link] <- values + } + else {(warning(parameter," is not a valid predator/prey parameter."))} + + return(scene) +} + +############################################################################### + + + diff --git a/R/data.R b/R/data.R index 59ccb377..2ed34e3c 100644 --- a/R/data.R +++ b/R/data.R @@ -1,3 +1,33 @@ + + +#' AB.params +#' +#' A tutorial ecosystem for teaching Rpath +#' +#' @format An Rpath balanced model object that contains: +#' \describe{ +#' \item{model}{A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).} +#' \item{diet}{A data.table containing the Ecopath model's diet matrix.} +#' \item{stanzas}{Parameters for multistanza groups.} +#' \item{pedigree}{A data.table containing the data quality (pedigree) for the Ecopath model.} +#' ... +#' } +"AB.params" + +#' REco.params +#' +#' A sample ecosystem for Rpath - Anchovy Bay. +#' +#' @format An Rpath balanced model object that contains: +#' \describe{ +#' \item{model}{A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).} +#' \item{diet}{A data.table containing the Ecopath model's diet matrix.} +#' \item{stanzas}{Parameters for multistanza groups.} +#' \item{pedigree}{A data.table containing the data quality (pedigree) for the Ecopath model.} +#' ... +#' } +"REco.params" + #' Eastern Bering Sea 1990s Ecopath model (53 biological groups and 1 fleet). #' #' Rpath inputs (unbalanaced model). diff --git a/R/ecopath.R b/R/ecopath.R index d7165ef6..6bbe99e2 100644 --- a/R/ecopath.R +++ b/R/ecopath.R @@ -15,7 +15,7 @@ #'@return Returns an Rpath object that can be supplied to the rsim.scenario function. #'@import data.table #'@export -rpath <- function(Rpath.params, eco.name = NA, eco.area = 1){ +rpath <- function(Rpath.params, eco.name = NA, eco.area = 1) { #Need to define variables to eliminate check() note about no visible binding Type <- Group <- DetInput <- ProdCons <- PB <- QB <- noB <- noEE <- alive <- NULL BEE <- Biomass <- Q <- BioAcc <- BioQB <- diag.a <- EEa <- B <- M0 <- NULL @@ -340,11 +340,9 @@ rpath.stanzas <- function(Rpath.params){ lastmonth <- rep(NA,Nsplit) for(isp in 1:Nsplit){ #Put the stanzas in order for each split species - stnum <- order(stanzafile[StGroupNum == isp, First]) - + stnum <- order(stanzafile[StGroupNum == isp, First]) stanzafile[StGroupNum == isp, StanzaNum := stnum] - #Calculate the last month for the final ("leading") stanza #KYA Aug 2021: # Formerly used fraction of Winf, but that didn't work for species diff --git a/R/ecosim.R b/R/ecosim.R index 1127d137..918ff05f 100755 --- a/R/ecosim.R +++ b/R/ecosim.R @@ -59,6 +59,14 @@ rsim.scenario <- function(Rpath, Rpath.params, years = 1:100){ return(rsim) } +# +# Test function +# +rsim.check <- function(Rsim.scenario) { + scene <- copy(Rsim.scenario) + scene.years <- list(1900:2000) + return (scene.years) +} #'Run Rsim #' #'Carries out the numerical integration of the Rsim alogrithms. @@ -78,6 +86,11 @@ rsim.scenario <- function(Rpath, Rpath.params, years = 1:100){ rsim.run <- function(Rsim.scenario, method = 'RK4', years = 1:100){ scene <- copy(Rsim.scenario) + # Perform argument checks: Check method name and figure out starting and ending years for run + if (method != 'RK4' && method != 'AB') { + stop("Invalid method name for solving nonlinear equations") + } + # Figure out starting and ending years for run # KYA 4/23/18 single year (e.g. 1971:1971) reduces to a scalar so take out length trap #if (length(years)<2){stop("Years should be a vector of year labels")} @@ -95,8 +108,7 @@ rsim.run <- function(Rsim.scenario, method = 'RK4', years = 1:100){ rout <- rk4_run(scene$params, scene$start_state, scene$forcing, scene$fishing, scene$stanzas, syear, eyear) - } - if(method == 'AB'){ + } else if(method == 'AB'){ #Run initial derivative derv <- deriv_vector(scene$params, scene$start_state, scene$forcing, scene$fishing, diff --git a/README.md b/README.md index 06623bd2..e5529494 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ - - Rpath ===== -![gitleaks](https://github.com/NOAA-EDAB/LeMANS/workflows/gitleaks/badge.svg) + +[![gitleaks](https://github.com/NOAA-EDAB/Rpath/actions/workflows/secretScan.yml/badge.svg)](https://github.com/NOAA-EDAB/Rpath/actions/workflows/secretScan.yml) +[![pkgdown](https://github.com/NOAA-EDAB/Rpath/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/NOAA-EDAB/Rpath/actions/workflows/pkgdown.yaml) +[![R-CMD-check](https://github.com/NOAA-EDAB/Rpath/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/NOAA-EDAB/Rpath/actions/workflows/R-CMD-check.yaml) +[![tests](https://github.com/NOAA-EDAB/Rpath/actions/workflows/tests.yml/badge.svg)](https://github.com/NOAA-EDAB/Rpath/actions/workflows/R-CMD-check.yaml) + + This is the repository for Rpath - the R implementation of the mass balance algorithms. diff --git a/Rpath.Rproj b/Rpath.Rproj index fec809a6..eaa6b818 100644 --- a/Rpath.Rproj +++ b/Rpath.Rproj @@ -1,18 +1,18 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace diff --git a/data-raw/Ecosense_EBS_base.csv b/data-raw/Ecosense_EBS_base.csv index f0d21e03..c76da33c 100644 --- a/data-raw/Ecosense_EBS_base.csv +++ b/data-raw/Ecosense_EBS_base.csv @@ -1,55 +1,55 @@ -Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery -Toothed whales,0,0.03503154,0.06911141,17.39968,,,0,0.2,,0.4,0.6,2.52E-05,0.000006747 -Gray whales,0,0.0326672,0.063365,8.87285,,,0,0.2,,0.4,0.6,0,0 -Other baleen,0,0.5007642,0.02832879,6.642456,,,0,0.2,,0.4,0.6,0.000000183,1.91E-05 -Bowhead whales,0,0.007173534,0.01005034,8.679965,,,0,0.2,,0.4,0.6,0,0 -Other pinnipeds,0,0.04919672,0.09292668,33.97923,,,0,0.2,,0.4,0.6,0.000100598,5.62E-06 -Walrus/bearded seal,0,0.1142484,0.051293,15.37061,,,0,0.2,,0.4,0.6,3.09E-05,5.96E-06 -Wintering seals,0,0.03029022,0.068998,19.19651,,,0,0.2,,0.4,0.6,0.000031609,3.15E-07 -Procellarids,0,0.000920162,0.07456178,73,,,0,0.2,,0.4,0.6,2.20E-09,0.000003567 -Alcids piscivorous,0,0.008617982,0.1623509,72.05511,,,0,0.2,,0.4,0.6,2.08E-08,3.34E-05 -Larids,0,0.000767614,0.08903116,104.9432,,,0,0.2,,0.4,0.6,1.90E-09,2.98E-06 -Alcids planktivorous,0,0.001754495,0.1694877,110,,,0,0.2,,0.4,0.6,4.20E-09,6.80E-06 -Other seabirds,0,0.000101753,0.06846981,76.18891,,,0,0.2,,0.4,0.6,2.00E-10,3.94E-07 -Cormorants,0,0.000149799,0.1587271,73,,,0,0.2,,0.4,0.6,4.00E-10,5.81E-07 -Sharks,0,0.0532473,0.1,3,,,0,0.2,,0.4,0.6,1.55E-05,0.000695172 -Walleye pollock,0,22.97889,0.8208976,4.193416,,,0,0.2,,0.392,0.608,0.4041824,2.104923 -Pacific cod,0,2.650923,0.5080103,2.739351,,,0,0.2,,0.392,0.608,0.2240711,0.1983278 -Pelagic forage fish,0,7.644652,0.7672387,3.732284,,,0,0.2,,0.392,0.608,0.02158515,0.007684128 -Lg.-mouth flatfish,0,1.58756,0.1937844,1.213555,,,0,0.2,,0.392,0.608,0.01807182,0.04641179 -Sm.-mouth flatfish,0,11.31311,0.2096047,1.325415,,,0,0.2,,0.392,0.608,0.1925451,0.2227745 -Skates,0,0.7733867,0.2,2,,,0,0.2,,0.392,0.608,0.004292543,0.02400982 -Other demersals,0,1.382284,0.2117719,2.526838,,,0,0.2,,0.392,0.608,0.01536881,0.01027679 -Eelpouts,0,2.371533,0.4,2,,,0,0.2,,0.392,0.608,0,0 -Lg.-mouth sculpins,0,0.5403231,0.4,2,,,0,0.2,,0.392,0.608,0.000573506,0.009394558 -Other sculpins,0,1.136692,0.4,2,,,0,0.2,,0.392,0.608,0,0 -Misc. shallow fish,0,1.167694,0.4,2,,,0,0.2,,0.392,0.608,1.13E-05,3.58E-05 -Octopods,0,0.192476,0.8,3.65,,,0,0.2,,0.392,0.608,7.99E-05,0.000228618 -Squids,0,0.9269976,3.2,10.67,,,0,0.2,,0.392,0.608,0.000454888,0.000875192 -Salmon returning,0,0.1637697,1.65,11.6,,,0,0.2,,0.392,0.608,0.1691487,0.00067146 -Salmon outgoing,0,0.0141972,1.28,13.56,,,0,0.2,,0.392,0.608,0,0 -Other crabs,0,3.244238,0.9338375,3.872315,,,0,0.2,,0.1,0.9,0.06657811,0.003027228 -Snow crab,0,2.178832,1.295101,3.117084,,,0,0.2,,0.1,0.9,0.3006897,0.006839902 -Shrimps,0,19.44489,0.5756463,2.40941,,,0,0.2,,0.1,0.9,2.25E-07,0.000001989 -Sea stars,0,2.471359,1.21,6.05,,,0,0.2,,0.1,0.9,3.87E-05,0.006488753 -Brittle stars,0,2.950093,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 -Urchins dollars cucumbers,0,1.167418,0.61,3.05,,,0,0.2,,0.1,0.9,3.48E-07,6.56E-05 -Snails,0,0.8071689,1.81,9.049999,,,0,0.2,,0.1,0.9,1.88E-07,1.80E-05 -Misc. crustacean,0,8.88581,7.4,37,,,0,0.2,,0.1,0.9,0,0 -Benthic amphipods,0,12.79612,7.4,37,,,0,0.2,,0.1,0.9,0,0 -Anemones,0,0.1095207,1,5,,,0,0.4,,0.1,0.9,4.31E-07,0.000384743 -Corals and sea pens,0,0.02658792,0.06929576,0.3464788,,,0,0.4,,0.1,0.9,3.25E-07,0.000025347 -Worms etc.,0,3.905683,2.155615,10.77807,,,0,0.4,,0.1,0.9,0,0 -Benthic urochordate,0,0.3544967,3.58,17.9,,,0,0.4,,0.1,0.9,6.09E-06,0.001505825 -Sponge,0,0.05448509,1,5,,,0,0.4,,0.1,0.9,1.91E-06,0.00064731 -Bivalves,0,61.87307,1.3,6.5,,,0,0.4,,0.1,0.9,2.33E-08,1.11E-07 -Polychaetes,0,21.68738,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 -Scyphozoid Jellies,0,0.3379304,0.88,3,,,0,0.2,,0.4,0.6,0.003364776,0.01527125 -Other zooplankton,0,22.7485,5.253331,15.00952,,,0,0.2,,0.4,0.6,0,0 -Copepods,0,26.85738,6,27.74,,,0,0.2,,0.4,0.6,0,0 -Pelagic microbes,0,45,36.5,104.2857,,,0,0.25,,0.4,0.6,0,0 -Benthic microbes,0,22.06101,36.5,104.2857,,,0,0.25,,0.1,0.9,0,0 -Primary production,1,48.60443,99.40636,,,,0,0,,0.4004332,0.5995669,0,0 -Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 -Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 -Fishery/Subsistence,3,,,,,,,,,0.2278577,0.7721423,, +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Toothed whales,0,0.03503154,0.06911141,17.39968,,,0,0.2,,0.4,0.6,2.52E-05,0.000006747 +Gray whales,0,0.0326672,0.063365,8.87285,,,0,0.2,,0.4,0.6,0,0 +Other baleen,0,0.5007642,0.02832879,6.642456,,,0,0.2,,0.4,0.6,0.000000183,1.91E-05 +Bowhead whales,0,0.007173534,0.01005034,8.679965,,,0,0.2,,0.4,0.6,0,0 +Other pinnipeds,0,0.04919672,0.09292668,33.97923,,,0,0.2,,0.4,0.6,0.000100598,5.62E-06 +Walrus/bearded seal,0,0.1142484,0.051293,15.37061,,,0,0.2,,0.4,0.6,3.09E-05,5.96E-06 +Wintering seals,0,0.03029022,0.068998,19.19651,,,0,0.2,,0.4,0.6,0.000031609,3.15E-07 +Procellarids,0,0.000920162,0.07456178,73,,,0,0.2,,0.4,0.6,2.20E-09,0.000003567 +Alcids piscivorous,0,0.008617982,0.1623509,72.05511,,,0,0.2,,0.4,0.6,2.08E-08,3.34E-05 +Larids,0,0.000767614,0.08903116,104.9432,,,0,0.2,,0.4,0.6,1.90E-09,2.98E-06 +Alcids planktivorous,0,0.001754495,0.1694877,110,,,0,0.2,,0.4,0.6,4.20E-09,6.80E-06 +Other seabirds,0,0.000101753,0.06846981,76.18891,,,0,0.2,,0.4,0.6,2.00E-10,3.94E-07 +Cormorants,0,0.000149799,0.1587271,73,,,0,0.2,,0.4,0.6,4.00E-10,5.81E-07 +Sharks,0,0.0532473,0.1,3,,,0,0.2,,0.4,0.6,1.55E-05,0.000695172 +Walleye pollock,0,22.97889,0.8208976,4.193416,,,0,0.2,,0.392,0.608,0.4041824,2.104923 +Pacific cod,0,2.650923,0.5080103,2.739351,,,0,0.2,,0.392,0.608,0.2240711,0.1983278 +Pelagic forage fish,0,7.644652,0.7672387,3.732284,,,0,0.2,,0.392,0.608,0.02158515,0.007684128 +Lg.-mouth flatfish,0,1.58756,0.1937844,1.213555,,,0,0.2,,0.392,0.608,0.01807182,0.04641179 +Sm.-mouth flatfish,0,11.31311,0.2096047,1.325415,,,0,0.2,,0.392,0.608,0.1925451,0.2227745 +Skates,0,0.7733867,0.2,2,,,0,0.2,,0.392,0.608,0.004292543,0.02400982 +Other demersals,0,1.382284,0.2117719,2.526838,,,0,0.2,,0.392,0.608,0.01536881,0.01027679 +Eelpouts,0,2.371533,0.4,2,,,0,0.2,,0.392,0.608,0,0 +Lg.-mouth sculpins,0,0.5403231,0.4,2,,,0,0.2,,0.392,0.608,0.000573506,0.009394558 +Other sculpins,0,1.136692,0.4,2,,,0,0.2,,0.392,0.608,0,0 +Misc. shallow fish,0,1.167694,0.4,2,,,0,0.2,,0.392,0.608,1.13E-05,3.58E-05 +Octopods,0,0.192476,0.8,3.65,,,0,0.2,,0.392,0.608,7.99E-05,0.000228618 +Squids,0,0.9269976,3.2,10.67,,,0,0.2,,0.392,0.608,0.000454888,0.000875192 +Salmon returning,0,0.1637697,1.65,11.6,,,0,0.2,,0.392,0.608,0.1691487,0.00067146 +Salmon outgoing,0,0.0141972,1.28,13.56,,,0,0.2,,0.392,0.608,0,0 +Other crabs,0,3.244238,0.9338375,3.872315,,,0,0.2,,0.1,0.9,0.06657811,0.003027228 +Snow crab,0,2.178832,1.295101,3.117084,,,0,0.2,,0.1,0.9,0.3006897,0.006839902 +Shrimps,0,19.44489,0.5756463,2.40941,,,0,0.2,,0.1,0.9,2.25E-07,0.000001989 +Sea stars,0,2.471359,1.21,6.05,,,0,0.2,,0.1,0.9,3.87E-05,0.006488753 +Brittle stars,0,2.950093,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 +Urchins dollars cucumbers,0,1.167418,0.61,3.05,,,0,0.2,,0.1,0.9,3.48E-07,6.56E-05 +Snails,0,0.8071689,1.81,9.049999,,,0,0.2,,0.1,0.9,1.88E-07,1.80E-05 +Misc. crustacean,0,8.88581,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Benthic amphipods,0,12.79612,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Anemones,0,0.1095207,1,5,,,0,0.4,,0.1,0.9,4.31E-07,0.000384743 +Corals and sea pens,0,0.02658792,0.06929576,0.3464788,,,0,0.4,,0.1,0.9,3.25E-07,0.000025347 +Worms etc.,0,3.905683,2.155615,10.77807,,,0,0.4,,0.1,0.9,0,0 +Benthic urochordate,0,0.3544967,3.58,17.9,,,0,0.4,,0.1,0.9,6.09E-06,0.001505825 +Sponge,0,0.05448509,1,5,,,0,0.4,,0.1,0.9,1.91E-06,0.00064731 +Bivalves,0,61.87307,1.3,6.5,,,0,0.4,,0.1,0.9,2.33E-08,1.11E-07 +Polychaetes,0,21.68738,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid Jellies,0,0.3379304,0.88,3,,,0,0.2,,0.4,0.6,0.003364776,0.01527125 +Other zooplankton,0,22.7485,5.253331,15.00952,,,0,0.2,,0.4,0.6,0,0 +Copepods,0,26.85738,6,27.74,,,0,0.2,,0.4,0.6,0,0 +Pelagic microbes,0,45,36.5,104.2857,,,0,0.25,,0.4,0.6,0,0 +Benthic microbes,0,22.06101,36.5,104.2857,,,0,0.25,,0.1,0.9,0,0 +Primary production,1,48.60443,99.40636,,,,0,0,,0.4004332,0.5995669,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.2278577,0.7721423,, diff --git a/data-raw/Ecosense_EBS_diet.csv b/data-raw/Ecosense_EBS_diet.csv index ab7e75b0..f66a4ca0 100644 --- a/data-raw/Ecosense_EBS_diet.csv +++ b/data-raw/Ecosense_EBS_diet.csv @@ -1,55 +1,55 @@ -DIETS,Toothed whales,Gray whales,Other baleen,Bowhead whales,Other pinnipeds,Walrus/bearded seal,Wintering seals,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squids,Salmon returning,Salmon outgoing,Other crabs,Snow crab,Shrimps,Sea stars,Brittle stars,Urchins dollars cucumbers,Snails,Misc. crustacean,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid Jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production -Toothed whales,6.47E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Gray whales,0.000133081,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other baleen,0.002040034,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Bowhead whales,2.92E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other pinnipeds,0.000205117,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Walrus/bearded seal,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Wintering seals,,,,,,0.001017812,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Procellarids,,,,,,,,6.33E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Alcids piscivorous,,,,,,,,0.00059265,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Larids,,,,,,,,5.28E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Alcids planktivorous,,,,,,,,0.000120655,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other seabirds,,,,,,,,7.00E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Cormorants,,,,,,,,1.03E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Sharks,0.000239291,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Walleye pollock,0.1698044,,0.08070278,,0.2811362,,0.4888999,0.1655044,0.2614391,0.2021952,0.002550183,0.1678919,0.02434087,0.2,0.08240532,0.2243627,,0.5571692,0.03047612,0.4114217,0.004290166,0.00395613,0.1298186,,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, -Pacific cod,0.01947363,,,,0.01366742,,0.0049334,0.007216445,0.1888303,0.008816263,0.000111195,0.007320547,0.001061329,,0.000594541,0.00446721,,0.006268422,3.22E-05,0.006085007,,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,,, -Pelagic forage fish,0.2487804,,0.1201802,,0.2320068,,0.1287617,0.3508018,0.3939846,0.6618846,0.05411142,0.3104237,0.931414,,0.005597626,0.03139776,,0.0777799,0.04213176,0.0297038,0.004689368,0.01307451,0.08628711,,,,0.15,,,,,,,,,,,,,,,,,,,0.008,,,,, -Lg.-mouth flatfish,0.001034033,,,,5.86E-06,,,,,,,,,0.2,0.000824726,0.001458564,,0.002081271,6.93E-05,0.02431003,1.60E-06,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Sm.-mouth flatfish,0.006842509,,,,0.08088505,,0.0394672,,,,,,,,0.000164344,0.02012908,,0.02068678,0.000488947,0.09006111,0.000020214,7.38E-06,0.03985396,0.009723351,0.007394266,,,,,,,,,,,,,,,,,,,,,,,,,, -Skates,0.003475559,,,,,,,,,,,,,,,5.18E-07,,1.45E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other demersals,0.005536608,,,,0.01134714,,,0.000564447,0.000998577,0.000999001,0.001003092,0.000032534,0.00084674,0.2,4.84E-07,0.001655552,,0.001043523,,,0.000351201,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Eelpouts,0.141124,,,,0.008174762,,0.05969413,,,,,,,,0.000426192,0.03098069,,0.04269749,0.001878417,0.08047485,3.13E-06,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Lg.-mouth sculpins,,,,,,,,,,,,,,,7.54E-06,0.001176434,,0.0002093,1.93E-05,0.000021452,0.000121231,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other sculpins,0.05504273,,,,0.01009857,,0.07893439,,,,,,,,0.000323667,0.01049386,,0.01287026,0.001030404,0.02096508,0.000147024,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Misc. shallow fish,0.03660734,,0.01555704,,0.02213815,,0.09866799,,,,,,,0.02,8.52E-05,0.003238108,,0.004294502,0.000809832,0.007287188,5.99E-06,0.000986537,0.01898878,0.04985736,,,,,,,,,,,,,,,,,,,,,,,,,,, -Octopods,0.005624069,,,,0.02070426,0.01017812,0.009866798,,,,,,,0.02,2.62E-05,0.005013016,,0.000651224,7.19E-05,,0.000360057,,0.01435832,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Squids,0.2922446,,0.002097894,,0.2519298,,0.00049334,0.4435776,0.03470331,0.006531665,0.00074037,0.503465,,0.2,0.001616147,0.00071992,,0.07333685,0.00012839,2.53E-05,0.2840489,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,,0.001,,,,, -Salmon returning,0.01169868,,0.005824628,,0.008696572,,,,,,,,,0.05,,0.001279095,,,,0.02247792,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Salmon outgoing,7.14E-08,,3.56E-08,,0.008696572,,,,,,,7.53E-08,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other crabs,,0.002564021,,0.001170194,0.01055097,0.006252694,0.009866799,,,,,,0.000783198,0.0025,0.001008549,0.1117827,,0.01110253,0.01499601,0.05703641,0.001302062,0.008096965,0.06165776,0.05453778,0.000531343,0.15,,,,0.005500491,0.06013035,,0.01,,,,,,,,,,,,,,,,,, -Snow crab,,0.001909877,,0.000871649,0.000698742,0.003925424,,,,,,,0.00121494,,1.81E-05,0.05749471,,0.004300768,0.004455289,0.0300742,,0.09333689,0.03866288,,,0.05,,,,,,,0.005,,,,,,,,,,,,,,,,,, -Shrimps,,0.01358641,,0.006200707,0.02408229,0.02035623,0.0542674,,,,,,0.0086428,0.005,0.03297897,0.1420867,0,0.05616299,0.08154,0.07128841,0.2867417,0.01367033,0.1972778,0.5433436,0.225388,,,,,,,,0.01,,,,,,,,,,,,,,,,,, -Sea stars,,0.001959092,,0.000894111,,,,,,,,,,,2.83E-05,0.00012312,,1.04E-08,3.16E-06,0.00055577,4.92E-06,,5.38E-05,,,,,,,0.000382242,0.000603733,,,,,,,,,,,,,,,,,,,, -Brittle stars,,0.002253839,,0.00102863,,,,,,,,,,,3.63E-05,0.000185201,,6.63E-05,0.05973076,5.11E-05,2.43E-06,0.1822525,0.000102108,0.000181826,,,,,,0.01228855,0.07161608,,0.03,,,,,,,,,,,,,,,,,, -Urchins dollars cucumbers,,0.000840129,,0.000383427,0.01513655,,,,,,,,,,1.25E-07,0.000107477,,5.44E-06,0.02279872,8.06E-08,,,2.12E-05,,,,,,,0.01201729,0.007422531,,,,,,,,,,,,,,,,,,,, -Snails,,0.000502282,,0.000229237,2.21E-05,0.0610687,,,,,,,,0.0025,0.000179459,0.004685467,,0.000333693,0.007431038,0.000301499,0.000000029,,0.001372771,,,0.4,,,,0.01685826,0.04829947,,0.005,,,,,,,,,,,,,,,,,, -Misc. crustacean,,0.006993907,,0.003191952,,,,0.004287296,0.009203487,0.003571809,0.00072099,3.73E-05,0.004449074,,0.007055759,0.002030444,,2.65E-05,0.02593507,0.000023285,4.31E-07,0.005357117,0.000792121,0.01442491,4.38E-05,,,,,0.001538223,0.01720634,,,,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, -Benthic amphipods,,0.9,,0.004360963,,,,6.32E-05,,0.004879939,0.000985044,5.10E-05,0.006078489,,0.03478977,0.1104455,2.96E-06,0.001273519,0.09940312,0.008388263,0.001051775,0.3280452,0.05959997,0.1947338,0.09178961,,,,,0.005461351,0.04782058,0.3,,0.1,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, -Anemones,,8.68E-05,,3.96E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,0.001850753,,,,,,,,,,,,,,,,,,,, -Corals and sea pens,,2.11E-05,,9.62E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Worms etc.,,0.002718438,,0.001240668,,0.1832061,0.02614701,1.69E-05,,0.001301065,0.000262628,1.36E-05,,,0.001353052,0.02704704,,0.000266081,0.09399602,5.84E-05,7.86E-07,0.02537635,0.01925321,0.03702217,,,,,,0.2085163,0.03021216,,0.01,,,0.2,,,,,,,,,,,,,,, -Benthic urochordate,,0.000281016,,0.000128253,,,,,,,,,,,1.68E-05,0.000549436,,3.16E-06,0.002288761,1.66E-06,0.000489444,,,,,,,,,0.000570783,,,,,,,,,,,,,,,,,,,,, -Sponge,,4.32E-05,,1.97E-05,,,,,,,,,,,5.47E-05,4.36E-05,,9.00E-10,9.09E-05,7.98E-06,,,,,,,,,,0.00023874,0.002601985,,,,,,,,,,,,,,,,,,,, -Bivalves,,0.04904792,,0.022385,2.21E-05,0.7139949,,0.00032442,,0.02504892,0.005056271,0.000261789,,,0.000490379,0.00165732,,0.000577568,0.08503099,2.78E-05,8.08E-06,0.05257819,0.000393605,,,0.4,,,,0.2533802,0.2524816,0.1,0.91,,,0.2,,,,,,,,,,,,,,, -Polychaetes,,0.01719198,,0.007846256,,,,0.000113714,,0.008779998,0.001772293,9.18E-05,,,0.00366851,0.03710564,3.12E-05,0.000641417,0.3154908,0.002781462,0.000225772,0.2386699,0.10978,0.02550208,1.19E-05,,,,,0.263431,0.2847306,,0.02,,,0.2,,,,,,,,,,,,,,, -Scyphozoid Jellies,,,,,,,,,,,,,,,2.91E-05,3.76E-06,,1.33E-06,0.001530271,1.47E-05,0.0001446,,7.51E-06,,0.06429844,,,,,,,,,,,,,,,,,,,,,,,,,, -Other zooplankton,,,0.5746825,0.55,,,,0.01148704,0.04877095,0.03297732,0.4103911,0.004580894,0.008569111,,0.4335781,0.1106963,0.9033016,0.09674293,0.09784253,0.000493316,0.3819539,0.001346271,0.1561293,0.01137116,0.6102213,,0.65,0.6,0.5,,0.004736442,0.2,,,,,,,,,,,,,,0.74,0.008073313,,,, -Copepods,,,0.200955,0.4,,,,0.01519615,0.06206967,0.04196949,0.5222954,0.00583,0.01259939,,0.3857745,0.001424687,0.09666412,0.000011405,0.00054752,,0.03367182,,2.77E-05,0.01865575,0.000321321,,0.2,0.2,0.5,,,,,,,,,,,,,,,,,0.15,0.25,,,, -Pelagic microbes,,,,,,,,,,,,,,,1.93E-06,8.57E-06,,,0.000224104,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,,0.05,0.15,0.5,,, -Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4901808,0.15,0.15,0.15,0.5,,,,,, -Primary production,,,,,,,,,,,,,,,,1.85E-05,,1.76E-07,5.60E-09,,,,,,,,,,,0.001516897,0.004452738,,,,0.25,0.2,,,,,,,,,,0.05,0.5919268,0.5,0.7,, -Pelagic detritus,,,,,,,,,,0.00104472,,,,,,,,,,,,,,,,,,,,0.000994342,0.005903513,,,,,,,,,,,,,,,,,,0.3,, -Benthic detritus,,,,,,,,,,,,,,0.1,0.006865464,0.0561312,,0.02938087,0.009528337,0.1360623,0.000363454,0.00062444,0.008015924,,,,,,,0.2173052,0.1599311,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5028055,0.6,0.6,0.6,0.5,,,,,1, -Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +DIETS,Toothed whales,Gray whales,Other baleen,Bowhead whales,Other pinnipeds,Walrus/bearded seal,Wintering seals,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squids,Salmon returning,Salmon outgoing,Other crabs,Snow crab,Shrimps,Sea stars,Brittle stars,Urchins dollars cucumbers,Snails,Misc. crustacean,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid Jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production +Toothed whales,6.47E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whales,0.000133081,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other baleen,0.002040034,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bowhead whales,2.92E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other pinnipeds,0.000205117,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walrus/bearded seal,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Wintering seals,,,,,,0.001017812,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,,,,,6.33E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,,,,,0.00059265,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,,,,,5.28E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,,,,,0.000120655,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,,,,,7.00E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,,,,,1.03E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sharks,0.000239291,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,0.1698044,,0.08070278,,0.2811362,,0.4888999,0.1655044,0.2614391,0.2021952,0.002550183,0.1678919,0.02434087,0.2,0.08240532,0.2243627,,0.5571692,0.03047612,0.4114217,0.004290166,0.00395613,0.1298186,,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, +Pacific cod,0.01947363,,,,0.01366742,,0.0049334,0.007216445,0.1888303,0.008816263,0.000111195,0.007320547,0.001061329,,0.000594541,0.00446721,,0.006268422,3.22E-05,0.006085007,,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,0.2487804,,0.1201802,,0.2320068,,0.1287617,0.3508018,0.3939846,0.6618846,0.05411142,0.3104237,0.931414,,0.005597626,0.03139776,,0.0777799,0.04213176,0.0297038,0.004689368,0.01307451,0.08628711,,,,0.15,,,,,,,,,,,,,,,,,,,0.008,,,,, +Lg.-mouth flatfish,0.001034033,,,,5.86E-06,,,,,,,,,0.2,0.000824726,0.001458564,,0.002081271,6.93E-05,0.02431003,1.60E-06,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,0.006842509,,,,0.08088505,,0.0394672,,,,,,,,0.000164344,0.02012908,,0.02068678,0.000488947,0.09006111,0.000020214,7.38E-06,0.03985396,0.009723351,0.007394266,,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,0.003475559,,,,,,,,,,,,,,,5.18E-07,,1.45E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,0.005536608,,,,0.01134714,,,0.000564447,0.000998577,0.000999001,0.001003092,0.000032534,0.00084674,0.2,4.84E-07,0.001655552,,0.001043523,,,0.000351201,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,0.141124,,,,0.008174762,,0.05969413,,,,,,,,0.000426192,0.03098069,,0.04269749,0.001878417,0.08047485,3.13E-06,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,,,,,,,,,,,,,,7.54E-06,0.001176434,,0.0002093,1.93E-05,0.000021452,0.000121231,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,0.05504273,,,,0.01009857,,0.07893439,,,,,,,,0.000323667,0.01049386,,0.01287026,0.001030404,0.02096508,0.000147024,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,0.03660734,,0.01555704,,0.02213815,,0.09866799,,,,,,,0.02,8.52E-05,0.003238108,,0.004294502,0.000809832,0.007287188,5.99E-06,0.000986537,0.01898878,0.04985736,,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,0.005624069,,,,0.02070426,0.01017812,0.009866798,,,,,,,0.02,2.62E-05,0.005013016,,0.000651224,7.19E-05,,0.000360057,,0.01435832,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Squids,0.2922446,,0.002097894,,0.2519298,,0.00049334,0.4435776,0.03470331,0.006531665,0.00074037,0.503465,,0.2,0.001616147,0.00071992,,0.07333685,0.00012839,2.53E-05,0.2840489,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,,0.001,,,,, +Salmon returning,0.01169868,,0.005824628,,0.008696572,,,,,,,,,0.05,,0.001279095,,,,0.02247792,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,7.14E-08,,3.56E-08,,0.008696572,,,,,,,7.53E-08,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other crabs,,0.002564021,,0.001170194,0.01055097,0.006252694,0.009866799,,,,,,0.000783198,0.0025,0.001008549,0.1117827,,0.01110253,0.01499601,0.05703641,0.001302062,0.008096965,0.06165776,0.05453778,0.000531343,0.15,,,,0.005500491,0.06013035,,0.01,,,,,,,,,,,,,,,,,, +Snow crab,,0.001909877,,0.000871649,0.000698742,0.003925424,,,,,,,0.00121494,,1.81E-05,0.05749471,,0.004300768,0.004455289,0.0300742,,0.09333689,0.03866288,,,0.05,,,,,,,0.005,,,,,,,,,,,,,,,,,, +Shrimps,,0.01358641,,0.006200707,0.02408229,0.02035623,0.0542674,,,,,,0.0086428,0.005,0.03297897,0.1420867,0,0.05616299,0.08154,0.07128841,0.2867417,0.01367033,0.1972778,0.5433436,0.225388,,,,,,,,0.01,,,,,,,,,,,,,,,,,, +Sea stars,,0.001959092,,0.000894111,,,,,,,,,,,2.83E-05,0.00012312,,1.04E-08,3.16E-06,0.00055577,4.92E-06,,5.38E-05,,,,,,,0.000382242,0.000603733,,,,,,,,,,,,,,,,,,,, +Brittle stars,,0.002253839,,0.00102863,,,,,,,,,,,3.63E-05,0.000185201,,6.63E-05,0.05973076,5.11E-05,2.43E-06,0.1822525,0.000102108,0.000181826,,,,,,0.01228855,0.07161608,,0.03,,,,,,,,,,,,,,,,,, +Urchins dollars cucumbers,,0.000840129,,0.000383427,0.01513655,,,,,,,,,,1.25E-07,0.000107477,,5.44E-06,0.02279872,8.06E-08,,,2.12E-05,,,,,,,0.01201729,0.007422531,,,,,,,,,,,,,,,,,,,, +Snails,,0.000502282,,0.000229237,2.21E-05,0.0610687,,,,,,,,0.0025,0.000179459,0.004685467,,0.000333693,0.007431038,0.000301499,0.000000029,,0.001372771,,,0.4,,,,0.01685826,0.04829947,,0.005,,,,,,,,,,,,,,,,,, +Misc. crustacean,,0.006993907,,0.003191952,,,,0.004287296,0.009203487,0.003571809,0.00072099,3.73E-05,0.004449074,,0.007055759,0.002030444,,2.65E-05,0.02593507,0.000023285,4.31E-07,0.005357117,0.000792121,0.01442491,4.38E-05,,,,,0.001538223,0.01720634,,,,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, +Benthic amphipods,,0.9,,0.004360963,,,,6.32E-05,,0.004879939,0.000985044,5.10E-05,0.006078489,,0.03478977,0.1104455,2.96E-06,0.001273519,0.09940312,0.008388263,0.001051775,0.3280452,0.05959997,0.1947338,0.09178961,,,,,0.005461351,0.04782058,0.3,,0.1,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, +Anemones,,8.68E-05,,3.96E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,0.001850753,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,2.11E-05,,9.62E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Worms etc.,,0.002718438,,0.001240668,,0.1832061,0.02614701,1.69E-05,,0.001301065,0.000262628,1.36E-05,,,0.001353052,0.02704704,,0.000266081,0.09399602,5.84E-05,7.86E-07,0.02537635,0.01925321,0.03702217,,,,,,0.2085163,0.03021216,,0.01,,,0.2,,,,,,,,,,,,,,, +Benthic urochordate,,0.000281016,,0.000128253,,,,,,,,,,,1.68E-05,0.000549436,,3.16E-06,0.002288761,1.66E-06,0.000489444,,,,,,,,,0.000570783,,,,,,,,,,,,,,,,,,,,, +Sponge,,4.32E-05,,1.97E-05,,,,,,,,,,,5.47E-05,4.36E-05,,9.00E-10,9.09E-05,7.98E-06,,,,,,,,,,0.00023874,0.002601985,,,,,,,,,,,,,,,,,,,, +Bivalves,,0.04904792,,0.022385,2.21E-05,0.7139949,,0.00032442,,0.02504892,0.005056271,0.000261789,,,0.000490379,0.00165732,,0.000577568,0.08503099,2.78E-05,8.08E-06,0.05257819,0.000393605,,,0.4,,,,0.2533802,0.2524816,0.1,0.91,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,0.01719198,,0.007846256,,,,0.000113714,,0.008779998,0.001772293,9.18E-05,,,0.00366851,0.03710564,3.12E-05,0.000641417,0.3154908,0.002781462,0.000225772,0.2386699,0.10978,0.02550208,1.19E-05,,,,,0.263431,0.2847306,,0.02,,,0.2,,,,,,,,,,,,,,, +Scyphozoid Jellies,,,,,,,,,,,,,,,2.91E-05,3.76E-06,,1.33E-06,0.001530271,1.47E-05,0.0001446,,7.51E-06,,0.06429844,,,,,,,,,,,,,,,,,,,,,,,,,, +Other zooplankton,,,0.5746825,0.55,,,,0.01148704,0.04877095,0.03297732,0.4103911,0.004580894,0.008569111,,0.4335781,0.1106963,0.9033016,0.09674293,0.09784253,0.000493316,0.3819539,0.001346271,0.1561293,0.01137116,0.6102213,,0.65,0.6,0.5,,0.004736442,0.2,,,,,,,,,,,,,,0.74,0.008073313,,,, +Copepods,,,0.200955,0.4,,,,0.01519615,0.06206967,0.04196949,0.5222954,0.00583,0.01259939,,0.3857745,0.001424687,0.09666412,0.000011405,0.00054752,,0.03367182,,2.77E-05,0.01865575,0.000321321,,0.2,0.2,0.5,,,,,,,,,,,,,,,,,0.15,0.25,,,, +Pelagic microbes,,,,,,,,,,,,,,,1.93E-06,8.57E-06,,,0.000224104,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,,0.05,0.15,0.5,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4901808,0.15,0.15,0.15,0.5,,,,,, +Primary production,,,,,,,,,,,,,,,,1.85E-05,,1.76E-07,5.60E-09,,,,,,,,,,,0.001516897,0.004452738,,,,0.25,0.2,,,,,,,,,,0.05,0.5919268,0.5,0.7,, +Pelagic detritus,,,,,,,,,,0.00104472,,,,,,,,,,,,,,,,,,,,0.000994342,0.005903513,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,,,,,0.1,0.006865464,0.0561312,,0.02938087,0.009528337,0.1360623,0.000363454,0.00062444,0.008015924,,,,,,,0.2173052,0.1599311,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5028055,0.6,0.6,0.6,0.5,,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/data-raw/Ecosense_EBS_pedigree.csv b/data-raw/Ecosense_EBS_pedigree.csv index 8f783a1e..4b6981fe 100644 --- a/data-raw/Ecosense_EBS_pedigree.csv +++ b/data-raw/Ecosense_EBS_pedigree.csv @@ -1,54 +1,54 @@ -Group,B,PB,QB,Diet,F_Fishery/Subsistence -Toothed whales,0.8,0.6,0.6,0.8,0.3 -Gray whales,0.5,0.6,0.6,0.8,0 -Other baleen,0.8,0.6,0.6,0.8,0.3 -Bowhead whales,0.5,0.1,0.6,0.8,0 -Other pinnipeds,0.5,0.6,0.8,0.8,0.3 -Walrus/bearded seal,0.5,0.6,0.6,0.7,0.3 -Wintering seals,0.5,0.6,0.6,0.7,0.3 -Procellarids,0.8,0.6,0.6,0.8,0.5 -Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 -Larids,0.5,0.6,0.6,0.8,0.5 -Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 -Other seabirds,0.8,0.6,0.6,0.8,0.5 -Cormorants,0.5,0.6,0.6,0.8,0.5 -Sharks,0.5,0.7,0.7,0.8,0.7 -Walleye pollock,0.5,0.4,0.4,0.1,0.1 -Pacific cod,0.8,0.4,0.4,0.1,0.7 -Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 -Lg.-mouth flatfish,0.8,0.6,0.8,0.3,0.7 -Sm.-mouth flatfish,0.8,0.6,0.8,0.7,0.3 -Skates,0.5,0.7,0.7,0.7,0.7 -Other demersals,0.8,0.7,0.8,0.8,0.8 -Eelpouts,0.8,0.7,0.7,0.8,0.7 -Lg.-mouth sculpins,0.1,0.7,0.7,0.3,0.8 -Other sculpins,0.8,0.7,0.7,0.3,0 -Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 -Octopods,0.8,0.7,0.7,0.8,0.4 -Squids,0.8,0.7,0.7,0.8,0.4 -Salmon returning,0.8,0.5,0.8,0.7,0.3 -Salmon outgoing,0.8,0.6,0.6,0.8,0 -Other crabs,0.8,0.6,0.8,0.8,0.8 -Snow crab,0.1,0.6,0.8,0.7,0.3 -Shrimps,0.8,0.6,0.8,0.8,0.5 -Sea stars,0.5,0.6,0.7,0.8,0.8 -Brittle stars,0.8,0.6,0.7,0.8,0 -Urchins dollars cucumbers,0.8,0.6,0.7,0.8,0.5 -Snails,0.8,0.6,0.7,0.8,0.5 -Misc. crustacean,0.8,0.6,0.7,0.8,0 -Benthic amphipods,0.8,0.6,0.7,0.8,0 -Anemones,0.5,0.6,0.7,0.8,0.5 -Corals and sea pens,0.5,0.6,0.7,0.8,0.5 -Worms etc.,0.8,0.6,0.7,0.8,0 -Benthic urochordate,0.5,0.6,0.7,0.8,0.5 -Sponge,0.5,0.6,0.7,0.8,0.5 -Bivalves,0.8,0.6,0.7,0.8,0.5 -Polychaetes,0.8,0.6,0.7,0.8,0 -Scyphozoid Jellies,0.5,0.6,0.6,0.8,0.5 -Other zooplankton,0.8,0.7,0.8,0.8,0 -Copepods,0.8,0.7,0.8,0.8,0 -Pelagic microbes,0.8,0.7,0.7,0.8,0 -Benthic microbes,0.8,0.7,0.7,0.1,0 -Primary production,0.8,0.7,0,0.01,0 -Pelagic detritus,0.8,0,0,0,0 -Benthic detritus,0.8,0,0,0,0 +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Toothed whales,0.8,0.6,0.6,0.8,0.3 +Gray whales,0.5,0.6,0.6,0.8,0 +Other baleen,0.8,0.6,0.6,0.8,0.3 +Bowhead whales,0.5,0.1,0.6,0.8,0 +Other pinnipeds,0.5,0.6,0.8,0.8,0.3 +Walrus/bearded seal,0.5,0.6,0.6,0.7,0.3 +Wintering seals,0.5,0.6,0.6,0.7,0.3 +Procellarids,0.8,0.6,0.6,0.8,0.5 +Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 +Larids,0.5,0.6,0.6,0.8,0.5 +Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 +Other seabirds,0.8,0.6,0.6,0.8,0.5 +Cormorants,0.5,0.6,0.6,0.8,0.5 +Sharks,0.5,0.7,0.7,0.8,0.7 +Walleye pollock,0.5,0.4,0.4,0.1,0.1 +Pacific cod,0.8,0.4,0.4,0.1,0.7 +Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 +Lg.-mouth flatfish,0.8,0.6,0.8,0.3,0.7 +Sm.-mouth flatfish,0.8,0.6,0.8,0.7,0.3 +Skates,0.5,0.7,0.7,0.7,0.7 +Other demersals,0.8,0.7,0.8,0.8,0.8 +Eelpouts,0.8,0.7,0.7,0.8,0.7 +Lg.-mouth sculpins,0.1,0.7,0.7,0.3,0.8 +Other sculpins,0.8,0.7,0.7,0.3,0 +Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 +Octopods,0.8,0.7,0.7,0.8,0.4 +Squids,0.8,0.7,0.7,0.8,0.4 +Salmon returning,0.8,0.5,0.8,0.7,0.3 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Other crabs,0.8,0.6,0.8,0.8,0.8 +Snow crab,0.1,0.6,0.8,0.7,0.3 +Shrimps,0.8,0.6,0.8,0.8,0.5 +Sea stars,0.5,0.6,0.7,0.8,0.8 +Brittle stars,0.8,0.6,0.7,0.8,0 +Urchins dollars cucumbers,0.8,0.6,0.7,0.8,0.5 +Snails,0.8,0.6,0.7,0.8,0.5 +Misc. crustacean,0.8,0.6,0.7,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Anemones,0.5,0.6,0.7,0.8,0.5 +Corals and sea pens,0.5,0.6,0.7,0.8,0.5 +Worms etc.,0.8,0.6,0.7,0.8,0 +Benthic urochordate,0.5,0.6,0.7,0.8,0.5 +Sponge,0.5,0.6,0.7,0.8,0.5 +Bivalves,0.8,0.6,0.7,0.8,0.5 +Polychaetes,0.8,0.6,0.7,0.8,0 +Scyphozoid Jellies,0.5,0.6,0.6,0.8,0.5 +Other zooplankton,0.8,0.7,0.8,0.8,0 +Copepods,0.8,0.7,0.8,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.1,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0.8,0,0,0,0 +Benthic detritus,0.8,0,0,0,0 diff --git a/data-raw/Ecosense_ECS_base.csv b/data-raw/Ecosense_ECS_base.csv index bc8fdad4..fe26396a 100644 --- a/data-raw/Ecosense_ECS_base.csv +++ b/data-raw/Ecosense_ECS_base.csv @@ -1,54 +1,54 @@ -Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery -Polar bears,0,0.00052669,0.0603,4.001384,,,0,0.2,,0.3,0.7,1.84E-05,3.00E-10 -Toothed whales,0,0.01158743,0.112092,14.50402,,,0,0.2,,0.3,0.7,6.34E-05,1.00E-10 -Gray whale,0,0.1879512,0.063365,8.87285,,,0,0.2,,0.3,0.7,0,0 -Bowhead whale,0,0.3984775,0.01005,5.260121,,,0,0.2,,0.3,0.7,0.001198808,1.00E-10 -Walrus/bearded seal,0,0.09814298,0.07127273,18.19188,,,0,0.2,,0.3,0.7,0.004842258,2.00E-10 -Wintering seals,0,0.06165962,0.08586258,19.17929,,,0,0.2,,0.3,0.7,0.002269417,2.00E-10 -Procellarids,0,0.001927375,0.06674218,187.9285,,,0,0.2,,0.3,0.7,0,0 -Cormorants,0,1.47E-06,0.1625189,142.6185,,,0,0.2,,0.3,0.7,0,0 -Other seabirds,0,7.77E-05,0.1625189,374.3133,,,0,0.2,,0.3,0.7,0,0 -Larids,0,9.31E-05,0.1057225,205.6736,,,0,0.2,,0.3,0.7,0,0 -Alcids piscivorous,0,0.001155027,0.104122,178.3831,,,0,0.2,,0.3,0.7,0,0 -Alcids planktivorous,0,0.000139496,0.1404024,247.5067,,,0,0.2,,0.3,0.7,0,0 -Lg.-mouth flatfish,0,0.1114285,0.4006235,1.780206,,,0,0.2,,0.3,0.7,0,0 -Sm.-mouth flatfish,0,0.09015632,0.3078811,1.535264,,,0,0.2,,0.3,0.7,0,0 -Lg.-mouth sculpins,0,0.599852,0.4,2,,,0,0.2,,0.3,0.7,0,0 -Other sculpins,0,0.8552857,0.4592638,2.415146,,,0,0.2,,0.3,0.7,0,0 -Eelpouts,0,0.3821929,0.4,2,,,0,0.2,,0.3,0.7,0,0 -Pelagic forage fish,0,1.190608,0.5432349,2.919605,,,0,0.2,,0.3,0.7,0,0 -Misc. shallow fish,0,7.477481,0.41934,2.105119,,,0,0.2,,0.3,0.7,0,0 -Other demersals,0,0.2338559,0.4,2,,,0,0.2,,0.3,0.7,0,0 -Skates,0,0.005364676,0.21,2.1,,,0,0.2,,0.3,0.7,0,0 -Walleye pollock,0,0.0005417,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0,0 -Pacific cod,0,0.000037935,0.5477087,2.802848,,,0,0.2,,0.3,0.7,0,0 -Arctic cod,0,1.044914,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0.000000001,1.00E-10 -Snow crab,0,3.169973,1,2.75,,,0,0.2,,0.1,0.9,0,0 -Bivalves,0,90.28777,0.755625,3.778125,,,0,0.4,,0.1,0.9,0,0 -Snails,0,1.384463,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 -Other crabs,0,3.067152,0.82,4.1,,,0,0.2,,0.1,0.9,0,0 -Shrimps,0,7.492234,0.576,2.409,,,0,0.2,,0.1,0.9,0,0 -Sea stars,0,2.180155,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 -Brittle stars,0,5.644247,0.485,2.425,,,0,0.4,,0.1,0.9,0,0 -Basket stars,0,0.5098612,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 -"Urchins, dollars, cucumbers",0,36.28965,0.695,3.475,,,0,0.4,,0.1,0.9,0,0 -Sponge,0,0.5271555,1,5,,,0,0.4,,0.1,0.9,0,0 -Anemones,0,0.3841269,1,5,,,0,0.2,,0.1,0.9,0,0 -Benthic urochordate,0,1.160084,3.58,17.9,,,0,0.4,,0.1,0.9,0,0 -Corals and sea pens,0,0.02567942,0.046,0.23,,,0,0.4,,0.1,0.9,0,0 -Scyphozoid jellies,0,0.3719727,0.88,3,,,0,0.2,,0.3,0.7,0,0 -Octopods,0,0.01057694,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 -Salmon outgoing,0,0.000520686,1.28,13.56,,,0,0.2,,0.3,0.7,0,0 -Salmon returning,0,0.005206862,1.65,11.6,,,0,0.2,,0.3,0.7,0,0 -Benthic amphipods,0,20.52637,1,5,,,0,0.4,,0.1,0.9,0,0 -Polychaetes,0,27.80796,2.915733,14.57867,,,0,0.4,,0.1,0.9,0,0 -Worms etc.,0,17.03959,2.23,11.15,,,0,0.4,,0.1,0.9,0,0 -Misc. crustaceans,0,5.580986,2.008,10.04,,,0,0.4,,0.1,0.9,0,0 -Copepods,0,2.042696,6,27.74,,,0,0.2,,0.3,0.7,0,0 -Other zooplankton,0,1.225213,5.475,15.64286,,,0,0.2,,0.3,0.7,0,0 -Pelagic microbes,0,1.488708,26.25,75,,,0,0.2,,0.3,0.7,0,0 -Benthic microbes,0,22.31168,26.25,75,,,0,0.2,,0.1,0.9,0,0 -Primary production,1,27.8,75,,,,0,0,,0.3,0.7,0,0 -Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 -Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 -Fishery/Subsistence,3,,,,,,,,,0.3,0.7,, +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Polar bears,0,0.00052669,0.0603,4.001384,,,0,0.2,,0.3,0.7,1.84E-05,3.00E-10 +Toothed whales,0,0.01158743,0.112092,14.50402,,,0,0.2,,0.3,0.7,6.34E-05,1.00E-10 +Gray whale,0,0.1879512,0.063365,8.87285,,,0,0.2,,0.3,0.7,0,0 +Bowhead whale,0,0.3984775,0.01005,5.260121,,,0,0.2,,0.3,0.7,0.001198808,1.00E-10 +Walrus/bearded seal,0,0.09814298,0.07127273,18.19188,,,0,0.2,,0.3,0.7,0.004842258,2.00E-10 +Wintering seals,0,0.06165962,0.08586258,19.17929,,,0,0.2,,0.3,0.7,0.002269417,2.00E-10 +Procellarids,0,0.001927375,0.06674218,187.9285,,,0,0.2,,0.3,0.7,0,0 +Cormorants,0,1.47E-06,0.1625189,142.6185,,,0,0.2,,0.3,0.7,0,0 +Other seabirds,0,7.77E-05,0.1625189,374.3133,,,0,0.2,,0.3,0.7,0,0 +Larids,0,9.31E-05,0.1057225,205.6736,,,0,0.2,,0.3,0.7,0,0 +Alcids piscivorous,0,0.001155027,0.104122,178.3831,,,0,0.2,,0.3,0.7,0,0 +Alcids planktivorous,0,0.000139496,0.1404024,247.5067,,,0,0.2,,0.3,0.7,0,0 +Lg.-mouth flatfish,0,0.1114285,0.4006235,1.780206,,,0,0.2,,0.3,0.7,0,0 +Sm.-mouth flatfish,0,0.09015632,0.3078811,1.535264,,,0,0.2,,0.3,0.7,0,0 +Lg.-mouth sculpins,0,0.599852,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Other sculpins,0,0.8552857,0.4592638,2.415146,,,0,0.2,,0.3,0.7,0,0 +Eelpouts,0,0.3821929,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Pelagic forage fish,0,1.190608,0.5432349,2.919605,,,0,0.2,,0.3,0.7,0,0 +Misc. shallow fish,0,7.477481,0.41934,2.105119,,,0,0.2,,0.3,0.7,0,0 +Other demersals,0,0.2338559,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Skates,0,0.005364676,0.21,2.1,,,0,0.2,,0.3,0.7,0,0 +Walleye pollock,0,0.0005417,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0,0 +Pacific cod,0,0.000037935,0.5477087,2.802848,,,0,0.2,,0.3,0.7,0,0 +Arctic cod,0,1.044914,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0.000000001,1.00E-10 +Snow crab,0,3.169973,1,2.75,,,0,0.2,,0.1,0.9,0,0 +Bivalves,0,90.28777,0.755625,3.778125,,,0,0.4,,0.1,0.9,0,0 +Snails,0,1.384463,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 +Other crabs,0,3.067152,0.82,4.1,,,0,0.2,,0.1,0.9,0,0 +Shrimps,0,7.492234,0.576,2.409,,,0,0.2,,0.1,0.9,0,0 +Sea stars,0,2.180155,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 +Brittle stars,0,5.644247,0.485,2.425,,,0,0.4,,0.1,0.9,0,0 +Basket stars,0,0.5098612,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 +"Urchins, dollars, cucumbers",0,36.28965,0.695,3.475,,,0,0.4,,0.1,0.9,0,0 +Sponge,0,0.5271555,1,5,,,0,0.4,,0.1,0.9,0,0 +Anemones,0,0.3841269,1,5,,,0,0.2,,0.1,0.9,0,0 +Benthic urochordate,0,1.160084,3.58,17.9,,,0,0.4,,0.1,0.9,0,0 +Corals and sea pens,0,0.02567942,0.046,0.23,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid jellies,0,0.3719727,0.88,3,,,0,0.2,,0.3,0.7,0,0 +Octopods,0,0.01057694,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 +Salmon outgoing,0,0.000520686,1.28,13.56,,,0,0.2,,0.3,0.7,0,0 +Salmon returning,0,0.005206862,1.65,11.6,,,0,0.2,,0.3,0.7,0,0 +Benthic amphipods,0,20.52637,1,5,,,0,0.4,,0.1,0.9,0,0 +Polychaetes,0,27.80796,2.915733,14.57867,,,0,0.4,,0.1,0.9,0,0 +Worms etc.,0,17.03959,2.23,11.15,,,0,0.4,,0.1,0.9,0,0 +Misc. crustaceans,0,5.580986,2.008,10.04,,,0,0.4,,0.1,0.9,0,0 +Copepods,0,2.042696,6,27.74,,,0,0.2,,0.3,0.7,0,0 +Other zooplankton,0,1.225213,5.475,15.64286,,,0,0.2,,0.3,0.7,0,0 +Pelagic microbes,0,1.488708,26.25,75,,,0,0.2,,0.3,0.7,0,0 +Benthic microbes,0,22.31168,26.25,75,,,0,0.2,,0.1,0.9,0,0 +Primary production,1,27.8,75,,,,0,0,,0.3,0.7,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.3,0.7,, diff --git a/data-raw/Ecosense_ECS_diet.csv b/data-raw/Ecosense_ECS_diet.csv index 85514f75..7933cfb4 100644 --- a/data-raw/Ecosense_ECS_diet.csv +++ b/data-raw/Ecosense_ECS_diet.csv @@ -1,54 +1,54 @@ -DIETS,Polar bears,Toothed whales,Gray whale,Bowhead whale,Walrus/bearded seal,Wintering seals,Procellarids,Cormorants,Other seabirds,Larids,Alcids piscivorous,Alcids planktivorous,Lg.-mouth flatfish,Sm.-mouth flatfish,Lg.-mouth sculpins,Other sculpins,Eelpouts,Pelagic forage fish,Misc. shallow fish,Other demersals,Skates,Walleye pollock,Pacific cod,Arctic cod,Snow crab,Bivalves,Snails,Other crabs,Shrimps,Sea stars,Brittle stars,Basket stars,"Urchins, dollars, cucumbers",Sponge,Anemones,Benthic urochordate,Corals and sea pens,Scyphozoid jellies,Octopods,Salmon outgoing,Salmon returning,Benthic amphipods,Polychaetes,Worms etc.,Misc. crustaceans,Copepods,Other zooplankton,Pelagic microbes,Benthic microbes,Primary production -Polar bears,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Toothed whales,0.1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Gray whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Bowhead whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Walrus/bearded seal,0.25,,,,0.000212616,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Wintering seals,0.65,,,,0.000504327,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Procellarids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Cormorants,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other seabirds,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Larids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Alcids piscivorous,,,,,,,,,,0.004651598,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Alcids planktivorous,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Lg.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.005322316,0.02487342,,0.001472492,0.006102135,,,,,,,,,,,,,,,,,,,,,,,,,, -Sm.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.01650201,0.06433967,,0.01072673,,,,,,,,,,,,,,,,,,,,,,,,,,, -Lg.-mouth sculpins,,0.009999999,,,0.01659991,0.0410623,,,,0.001718235,0.07135769,,,,,,0.04798269,0.005778736,,0.04407414,0.02363462,,0.006649494,0.006265168,,,,,,,,,,,,,,,,,,,,,,,,,, -Other sculpins,,0.009999999,,,,0.008492618,,,,0.001718235,0.07133969,,,,0.206761,,0.000789418,0.004220617,,0.05228622,0.000336991,,0.004856593,,,,,,,,,,,,,,,,,,,,,,,,,,, -Eelpouts,,0.009999999,,,,,,,,,,,,,0.08932029,,,,,0.003859158,0.04130904,,0.004297453,0.003560629,,,,,,,,,,,,,,,,,,,,,,,,,, -Pelagic forage fish,,0.5544065,,,0.000657422,0.06911467,0.05867733,0.25,,0.3324589,0.2731979,,,,,0.03727878,,,,0.05182033,0.05281629,,,0.04948226,,,,,,,,,,,,,,,,,,,,,,,,,, -Misc. shallow fish,,0.03590742,,,0.00509502,0.3092427,,0.25,,0.0267805,0.2405652,,0.3332412,,0.2435342,,0.07879899,0.1874234,0.06125135,0.07786866,0.01548537,,0.06349141,0.002147306,,,,,,,,,,,,,,,,,,,,,,,,,, -Other demersals,,,,,,0.001981432,,,,0.007045029,0.006587705,,,,0.01485121,,0.000345366,,,0.09428567,0.005443891,,0.00277255,0.002785945,,,,,,,,,,,,,,,,,,,,,,,,,, -Skates,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Walleye pollock,,,,,,,,,,,,,,,,,,,,,,,0.000578866,,,,,,,,,,,,,,,,,,,,,,,,,,, -Pacific cod,,,,,,,,,,,,,,,,,,,,,0.001371445,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Arctic cod,,0.2796861,,,0.002410548,0.4286107,0.06969959,0.25,,0.5012766,0.2594775,,0.2409175,,,,,,,0.005050726,0.2729864,0.5366726,0.1560087,0.008183806,,,,,,,,,,,,,,,,,,,,,,,,,, -Snow crab,,,0.000256674,0.000113781,0.07158563,,,,,,,,,0.0265204,0.07528889,0.00226101,,,,0.01153278,0.2568457,,0.1453266,,,,,,,,,,,,,,,,0.25,,,,,,,,,,, -Bivalves,,,0.0433623,0.01922197,0.5941439,,,,,1.53E-06,2.65E-06,,0.00729814,0.3710207,,0.001438914,0.000389389,,0.04453,0.001736895,1.76E-05,,0.001407035,4.30E-05,0.2075,,0.5,0.25,0.15,0.5154778,0.125,,,,0.2,,,,0.25,,,,,,,,,,, -Snails,,,0.004340004,0.00192387,0.04782695,,,,,0.005283926,0.003017653,,,0.000498679,,0.006792177,,,0.000733818,,5.89E-05,,0.001507538,,0.0326,,,,,0.05159265,,,,,,,,,0.25,,,,,,,,,,, -Other crabs,,,7.88E-05,3.49E-05,0.02207871,,,,,0.005283772,0.003044799,,,0.000157228,0.1497352,0.05728141,0.002116573,0.000288189,0.005869959,0.02178959,0.06081963,,0.0525628,0.001098868,0.0411,,,,,,,,,,,,,,0.25,,,,,,,,,,, -Shrimps,,0.09993257,1.25E-05,5.55E-06,0.08408973,0.09176343,,0.25,,0.01060208,0.009951027,,0.1977302,,0.1319228,0.01229081,0.01550181,0.009836816,0.1471351,0.181513,0.1139477,0.1423735,0.2859297,0.1600893,,,,,,,,,,,,,,,,,,,,,,,,,, -Sea stars,,,0.004000351,0.001773306,,,,,,,,,,,,,,,,,,,,,0.0015,,,,,,,,,,,,,,,,,,,,,,,,, -Brittle stars,,,0.003698438,0.001639472,,,,,,,,,,0.03040408,1.92E-05,0.005426886,,,,,6.06E-06,,,,0.05895,,,,,,,,,,,,,,,,,,,,,,,,, -Basket stars,,,0.00014616,6.48E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -"Urchins, dollars, cucumbers",,,0.02290767,0.01015469,0.05747112,,,,,,,,,0.05108213,,,,,,,0.000107293,,,,0.0081,,,,,0.2723194,,,,,,,,,,,,,,,,,,,, -Sponge,,,0.000249278,0.000110502,,,,,,,,,,,,,,,,,,,,,0.00275,,,,,,,,,,,,,,,,,,,,,,,,, -Anemones,,,0.002641741,0.001171051,,,,,,,,,,,,0.06376915,,,,,1.18E-05,,,,0.00115,,,,,,,,,,,,,,,,,,,,,,,,, -Benthic urochordate,,,0.002641741,0.001171051,0.006627641,,,,,,,,,,,,,,,,0.00021469,,,,,,,,,0.03140422,,,,,,,,,,,,,,,,,,,, -Corals and sea pens,,,2.54E-06,1.13E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Scyphozoid jellies,,,,,,,,,,,,0.0192604,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Octopods,,0.000067419,,,0.007169423,0.001830349,,,,,,,,,,,,,,,6.64E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Salmon outgoing,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Salmon returning,,,,,,,,,,,,,,,,,,,,,0.02096798,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Benthic amphipods,,,0.9,0.005671234,0.03530366,0.03725448,0.002204452,,0.1,0.03446057,0.02325702,,0.0252337,0.1203165,0.0703186,0.4825385,0.2814546,0.01338544,0.4361333,0.3160916,0.03019983,0.0429575,0.137789,0.09571919,0.05525,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, -Polychaetes,,,0.01086888,0.00481804,0.03047494,,,,,0.02371788,0.008201232,,0.04969615,0.3519998,0.01052774,0.2352545,0.5376897,0.004593154,0.1107291,0.1004426,0.007359331,,0.06924623,0.004512317,0.27195,,0.3,0.25,0.15,0.1292059,0.125,,,,,,,,,,,,,,,,,,, -Worms etc.,,,0.002226611,0.000987029,0.005586154,,,,,,,,,0.008323649,,0.06003539,,,0.02272738,0.000147471,,,,,0.03125,,0.05,0.25,,,,,,,,,,,,,,,,,,,,,, -Misc. crustaceans,,,0.002566263,0.001137593,,,,,,0.00012475,,,,0.03681871,0.006913655,0.007458307,0.00088703,0.000632304,0.06850621,0.003324673,0.000133681,0.03436605,0.001507538,0.01197542,0.01425,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, -Copepods,,,,0.7125,,,0.004408904,,0.45,,,0.3485923,9.47E-06,9.85E-05,,,5.11E-07,0.3125479,0.01474068,0.000178091,0.000000209,0.1472829,,0.3724843,,,,,,,,0.25,,,,,,0.675,,0.5,0.5,,,,,,0.25,,, -Other zooplankton,,,,0.2375,,0.009084825,0.8650097,,0.45,0.02627006,0.01077462,0.6321473,0.1458736,0.002759635,0.000807251,0.02817404,0.03404389,0.4612935,0.08764321,0.01217405,0.006646099,0.0963475,0.05386934,0.2755505,0.0041,,,,,,,0.25,,,,,,0.225,,0.5,0.5,,,,,,,,, -Pelagic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.05,,,,,,,,0.5,0.15,,, -Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,0.25,,,,,,,,0.25,0.2,0.25,0.25,,,,,0.5,0.5,0.5,0.5,,,,, -Primary production,,,,,,,,,,,,,,,,,,,,,,,,,0.0039,,,,,,,,0.25,,,,,0.05,,,,,,,,0.5,0.6,0.7,, -Pelagic detritus,,,,,,,,,,0.005581916,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.3,, -Benthic detritus,,,,,,,,,,0.01302447,,,,,,,,,,,,,,,0.26565,0.75,0.05,0.25,0.4,,0.5,,0.75,0.75,0.2,0.75,0.75,,,,,0.5,0.5,0.5,0.5,,,,1, -Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +DIETS,Polar bears,Toothed whales,Gray whale,Bowhead whale,Walrus/bearded seal,Wintering seals,Procellarids,Cormorants,Other seabirds,Larids,Alcids piscivorous,Alcids planktivorous,Lg.-mouth flatfish,Sm.-mouth flatfish,Lg.-mouth sculpins,Other sculpins,Eelpouts,Pelagic forage fish,Misc. shallow fish,Other demersals,Skates,Walleye pollock,Pacific cod,Arctic cod,Snow crab,Bivalves,Snails,Other crabs,Shrimps,Sea stars,Brittle stars,Basket stars,"Urchins, dollars, cucumbers",Sponge,Anemones,Benthic urochordate,Corals and sea pens,Scyphozoid jellies,Octopods,Salmon outgoing,Salmon returning,Benthic amphipods,Polychaetes,Worms etc.,Misc. crustaceans,Copepods,Other zooplankton,Pelagic microbes,Benthic microbes,Primary production +Polar bears,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Toothed whales,0.1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bowhead whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walrus/bearded seal,0.25,,,,0.000212616,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Wintering seals,0.65,,,,0.000504327,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,,,,,,,0.004651598,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.005322316,0.02487342,,0.001472492,0.006102135,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.01650201,0.06433967,,0.01072673,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,0.009999999,,,0.01659991,0.0410623,,,,0.001718235,0.07135769,,,,,,0.04798269,0.005778736,,0.04407414,0.02363462,,0.006649494,0.006265168,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,,0.009999999,,,,0.008492618,,,,0.001718235,0.07133969,,,,0.206761,,0.000789418,0.004220617,,0.05228622,0.000336991,,0.004856593,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,,0.009999999,,,,,,,,,,,,,0.08932029,,,,,0.003859158,0.04130904,,0.004297453,0.003560629,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,,0.5544065,,,0.000657422,0.06911467,0.05867733,0.25,,0.3324589,0.2731979,,,,,0.03727878,,,,0.05182033,0.05281629,,,0.04948226,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,,0.03590742,,,0.00509502,0.3092427,,0.25,,0.0267805,0.2405652,,0.3332412,,0.2435342,,0.07879899,0.1874234,0.06125135,0.07786866,0.01548537,,0.06349141,0.002147306,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,,,,,,0.001981432,,,,0.007045029,0.006587705,,,,0.01485121,,0.000345366,,,0.09428567,0.005443891,,0.00277255,0.002785945,,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,,,,,,,,,,,,,,,,,,,,,,,0.000578866,,,,,,,,,,,,,,,,,,,,,,,,,,, +Pacific cod,,,,,,,,,,,,,,,,,,,,,0.001371445,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Arctic cod,,0.2796861,,,0.002410548,0.4286107,0.06969959,0.25,,0.5012766,0.2594775,,0.2409175,,,,,,,0.005050726,0.2729864,0.5366726,0.1560087,0.008183806,,,,,,,,,,,,,,,,,,,,,,,,,, +Snow crab,,,0.000256674,0.000113781,0.07158563,,,,,,,,,0.0265204,0.07528889,0.00226101,,,,0.01153278,0.2568457,,0.1453266,,,,,,,,,,,,,,,,0.25,,,,,,,,,,, +Bivalves,,,0.0433623,0.01922197,0.5941439,,,,,1.53E-06,2.65E-06,,0.00729814,0.3710207,,0.001438914,0.000389389,,0.04453,0.001736895,1.76E-05,,0.001407035,4.30E-05,0.2075,,0.5,0.25,0.15,0.5154778,0.125,,,,0.2,,,,0.25,,,,,,,,,,, +Snails,,,0.004340004,0.00192387,0.04782695,,,,,0.005283926,0.003017653,,,0.000498679,,0.006792177,,,0.000733818,,5.89E-05,,0.001507538,,0.0326,,,,,0.05159265,,,,,,,,,0.25,,,,,,,,,,, +Other crabs,,,7.88E-05,3.49E-05,0.02207871,,,,,0.005283772,0.003044799,,,0.000157228,0.1497352,0.05728141,0.002116573,0.000288189,0.005869959,0.02178959,0.06081963,,0.0525628,0.001098868,0.0411,,,,,,,,,,,,,,0.25,,,,,,,,,,, +Shrimps,,0.09993257,1.25E-05,5.55E-06,0.08408973,0.09176343,,0.25,,0.01060208,0.009951027,,0.1977302,,0.1319228,0.01229081,0.01550181,0.009836816,0.1471351,0.181513,0.1139477,0.1423735,0.2859297,0.1600893,,,,,,,,,,,,,,,,,,,,,,,,,, +Sea stars,,,0.004000351,0.001773306,,,,,,,,,,,,,,,,,,,,,0.0015,,,,,,,,,,,,,,,,,,,,,,,,, +Brittle stars,,,0.003698438,0.001639472,,,,,,,,,,0.03040408,1.92E-05,0.005426886,,,,,6.06E-06,,,,0.05895,,,,,,,,,,,,,,,,,,,,,,,,, +Basket stars,,,0.00014616,6.48E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +"Urchins, dollars, cucumbers",,,0.02290767,0.01015469,0.05747112,,,,,,,,,0.05108213,,,,,,,0.000107293,,,,0.0081,,,,,0.2723194,,,,,,,,,,,,,,,,,,,, +Sponge,,,0.000249278,0.000110502,,,,,,,,,,,,,,,,,,,,,0.00275,,,,,,,,,,,,,,,,,,,,,,,,, +Anemones,,,0.002641741,0.001171051,,,,,,,,,,,,0.06376915,,,,,1.18E-05,,,,0.00115,,,,,,,,,,,,,,,,,,,,,,,,, +Benthic urochordate,,,0.002641741,0.001171051,0.006627641,,,,,,,,,,,,,,,,0.00021469,,,,,,,,,0.03140422,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,,2.54E-06,1.13E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Scyphozoid jellies,,,,,,,,,,,,0.0192604,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,,0.000067419,,,0.007169423,0.001830349,,,,,,,,,,,,,,,6.64E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon returning,,,,,,,,,,,,,,,,,,,,,0.02096798,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Benthic amphipods,,,0.9,0.005671234,0.03530366,0.03725448,0.002204452,,0.1,0.03446057,0.02325702,,0.0252337,0.1203165,0.0703186,0.4825385,0.2814546,0.01338544,0.4361333,0.3160916,0.03019983,0.0429575,0.137789,0.09571919,0.05525,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,,0.01086888,0.00481804,0.03047494,,,,,0.02371788,0.008201232,,0.04969615,0.3519998,0.01052774,0.2352545,0.5376897,0.004593154,0.1107291,0.1004426,0.007359331,,0.06924623,0.004512317,0.27195,,0.3,0.25,0.15,0.1292059,0.125,,,,,,,,,,,,,,,,,,, +Worms etc.,,,0.002226611,0.000987029,0.005586154,,,,,,,,,0.008323649,,0.06003539,,,0.02272738,0.000147471,,,,,0.03125,,0.05,0.25,,,,,,,,,,,,,,,,,,,,,, +Misc. crustaceans,,,0.002566263,0.001137593,,,,,,0.00012475,,,,0.03681871,0.006913655,0.007458307,0.00088703,0.000632304,0.06850621,0.003324673,0.000133681,0.03436605,0.001507538,0.01197542,0.01425,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, +Copepods,,,,0.7125,,,0.004408904,,0.45,,,0.3485923,9.47E-06,9.85E-05,,,5.11E-07,0.3125479,0.01474068,0.000178091,0.000000209,0.1472829,,0.3724843,,,,,,,,0.25,,,,,,0.675,,0.5,0.5,,,,,,0.25,,, +Other zooplankton,,,,0.2375,,0.009084825,0.8650097,,0.45,0.02627006,0.01077462,0.6321473,0.1458736,0.002759635,0.000807251,0.02817404,0.03404389,0.4612935,0.08764321,0.01217405,0.006646099,0.0963475,0.05386934,0.2755505,0.0041,,,,,,,0.25,,,,,,0.225,,0.5,0.5,,,,,,,,, +Pelagic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.05,,,,,,,,0.5,0.15,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,0.25,,,,,,,,0.25,0.2,0.25,0.25,,,,,0.5,0.5,0.5,0.5,,,,, +Primary production,,,,,,,,,,,,,,,,,,,,,,,,,0.0039,,,,,,,,0.25,,,,,0.05,,,,,,,,0.5,0.6,0.7,, +Pelagic detritus,,,,,,,,,,0.005581916,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,0.01302447,,,,,,,,,,,,,,,0.26565,0.75,0.05,0.25,0.4,,0.5,,0.75,0.75,0.2,0.75,0.75,,,,,0.5,0.5,0.5,0.5,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/data-raw/Ecosense_ECS_pedigree.csv b/data-raw/Ecosense_ECS_pedigree.csv index 2d1148c5..9ea1607b 100644 --- a/data-raw/Ecosense_ECS_pedigree.csv +++ b/data-raw/Ecosense_ECS_pedigree.csv @@ -1,53 +1,53 @@ -Group,B,PB,QB,Diet,F_Fishery/Subsistence -Polar bears,0.8,0.5,0.6,0.8,0.8 -Toothed whales,0.5,0.6,0.6,0.7,0.5 -Gray whale,0.5,0.6,0.6,0.7,0 -Bowhead whale,0.5,0.6,0.6,0.7,0.1 -Walrus/bearded seal,0.8,0.6,0.6,0.7,0.5 -Wintering seals,0.8,0.6,0.6,0.6,0.5 -Procellarids,0.5,0.6,0.6,0.8,0 -Cormorants,0.5,0.6,0.6,0.8,0 -Other seabirds,0.5,0.6,0.6,0.8,0 -Larids,0.5,0.6,0.6,0.8,0 -Alcids piscivorous,0.5,0.6,0.6,0.8,0 -Alcids planktivorous,0.5,0.6,0.6,0.8,0 -Lg.-mouth flatfish,0.8,0.5,0.5,0.3,0 -Sm.-mouth flatfish,0.8,0.6,0.6,0.3,0 -Lg.-mouth sculpins,0.8,0.6,0.6,0.3,0 -Other sculpins,0.8,0.6,0.6,0.3,0 -Eelpouts,0.8,0.6,0.6,0.3,0 -Pelagic forage fish,0.8,0.6,0.6,0.3,0 -Misc. shallow fish,0.8,0.6,0.6,0.3,0 -Other demersals,0.8,0.6,0.6,0.3,0 -Skates,0.1,0.6,0.7,0.8,0 -Walleye pollock,0.1,0.6,0.6,0.3,0 -Pacific cod,0.1,0.6,0.6,0.8,0 -Arctic cod,0.8,0.2,0.2,0.3,0 -Snow crab,0.1,0.6,0.6,0.8,0 -Bivalves,0.1,0.5,0.7,0.8,0 -Snails,0.1,0.6,0.7,0.8,0 -Other crabs,0.1,0.6,0.7,0.8,0 -Shrimps,0.8,0.6,0.7,0.8,0 -Sea stars,0.1,0.6,0.7,0.8,0 -Brittle stars,0.1,0.6,0.7,0.8,0 -Basket stars,0.1,0.6,0.7,0.8,0 -"Urchins, dollars, cucumbers",0.1,0.5,0.7,0.8,0 -Sponge,0.1,0.6,0.7,0.8,0 -Anemones,0.1,0.6,0.7,0.8,0 -Benthic urochordate,0.1,0.6,0.7,0.8,0 -Corals and sea pens,0.1,0.6,0.7,0.8,0 -Scyphozoid jellies,0.1,0.6,0.6,0.8,0 -Octopods,0.8,0.6,0.7,0.8,0 -Salmon outgoing,0.8,0.6,0.6,0.8,0 -Salmon returning,0.8,0.6,0.6,0.8,0 -Benthic amphipods,0.8,0.6,0.7,0.8,0 -Polychaetes,0.1,0.5,0.7,0.8,0 -Worms etc.,0.1,0.6,0.7,0.8,0 -Misc. crustaceans,0.1,0.6,0.7,0.8,0 -Copepods,0.8,0.6,0.6,0.8,0 -Other zooplankton,0.8,0.6,0.7,0.8,0 -Pelagic microbes,0.8,0.7,0.7,0.8,0 -Benthic microbes,0.8,0.7,0.7,0.8,0 -Primary production,0.8,0.7,0,0.01,0 -Pelagic detritus,0,0,0,0,0 -Benthic detritus,0,0,0,0,0 +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Polar bears,0.8,0.5,0.6,0.8,0.8 +Toothed whales,0.5,0.6,0.6,0.7,0.5 +Gray whale,0.5,0.6,0.6,0.7,0 +Bowhead whale,0.5,0.6,0.6,0.7,0.1 +Walrus/bearded seal,0.8,0.6,0.6,0.7,0.5 +Wintering seals,0.8,0.6,0.6,0.6,0.5 +Procellarids,0.5,0.6,0.6,0.8,0 +Cormorants,0.5,0.6,0.6,0.8,0 +Other seabirds,0.5,0.6,0.6,0.8,0 +Larids,0.5,0.6,0.6,0.8,0 +Alcids piscivorous,0.5,0.6,0.6,0.8,0 +Alcids planktivorous,0.5,0.6,0.6,0.8,0 +Lg.-mouth flatfish,0.8,0.5,0.5,0.3,0 +Sm.-mouth flatfish,0.8,0.6,0.6,0.3,0 +Lg.-mouth sculpins,0.8,0.6,0.6,0.3,0 +Other sculpins,0.8,0.6,0.6,0.3,0 +Eelpouts,0.8,0.6,0.6,0.3,0 +Pelagic forage fish,0.8,0.6,0.6,0.3,0 +Misc. shallow fish,0.8,0.6,0.6,0.3,0 +Other demersals,0.8,0.6,0.6,0.3,0 +Skates,0.1,0.6,0.7,0.8,0 +Walleye pollock,0.1,0.6,0.6,0.3,0 +Pacific cod,0.1,0.6,0.6,0.8,0 +Arctic cod,0.8,0.2,0.2,0.3,0 +Snow crab,0.1,0.6,0.6,0.8,0 +Bivalves,0.1,0.5,0.7,0.8,0 +Snails,0.1,0.6,0.7,0.8,0 +Other crabs,0.1,0.6,0.7,0.8,0 +Shrimps,0.8,0.6,0.7,0.8,0 +Sea stars,0.1,0.6,0.7,0.8,0 +Brittle stars,0.1,0.6,0.7,0.8,0 +Basket stars,0.1,0.6,0.7,0.8,0 +"Urchins, dollars, cucumbers",0.1,0.5,0.7,0.8,0 +Sponge,0.1,0.6,0.7,0.8,0 +Anemones,0.1,0.6,0.7,0.8,0 +Benthic urochordate,0.1,0.6,0.7,0.8,0 +Corals and sea pens,0.1,0.6,0.7,0.8,0 +Scyphozoid jellies,0.1,0.6,0.6,0.8,0 +Octopods,0.8,0.6,0.7,0.8,0 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Salmon returning,0.8,0.6,0.6,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Polychaetes,0.1,0.5,0.7,0.8,0 +Worms etc.,0.1,0.6,0.7,0.8,0 +Misc. crustaceans,0.1,0.6,0.7,0.8,0 +Copepods,0.8,0.6,0.6,0.8,0 +Other zooplankton,0.8,0.6,0.7,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.8,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0,0,0,0,0 +Benthic detritus,0,0,0,0,0 diff --git a/data-raw/Ecosense_GOA_base.csv b/data-raw/Ecosense_GOA_base.csv index 4a340d95..36068a08 100644 --- a/data-raw/Ecosense_GOA_base.csv +++ b/data-raw/Ecosense_GOA_base.csv @@ -1,51 +1,51 @@ -Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery -Toothed whales,0,0.06165833,0.04713691,12.43829,,,0,0.2,,0.5,0.5,1.29E-07,8.45E-07 -Gray whale,0,0.05543134,0.063365,8.87285,,,0,0.2,,0.5,0.5,8.57E-08,0 -Other baleen,0,0.4567338,0.03134125,6.980565,,,0,0.2,,0.5,0.5,0,5.19E-05 -Other pinnipeds,0,0.03346486,0.1222834,36.81018,,,0,0.2,,0.5,0.5,0.000090749,4.04E-06 -Procellarids,0,0.001051795,0.06487884,73,,,0,0.2,,0.5,0.5,0,1.43E-06 -Alcids piscivorous,0,0.01131623,0.09528826,72.57302,,,0,0.2,,0.5,0.5,0,1.54E-05 -Larids,0,0.001458566,0.1115763,95.5601,,,0,0.2,,0.5,0.5,0,1.98E-06 -Alcids planktivorous,0,0.000299744,0.1694877,110,,,0,0.2,,0.5,0.5,0,4.07E-07 -Other seabirds,0,0.000461801,0.09378317,109.5,,,0,0.2,,0.5,0.5,0,6.27E-07 -Cormorants,0,0.000348881,0.1587271,73,,,0,0.2,,0.5,0.5,0,4.74E-07 -Sharks,0,0.142353,0.1,3.729058,,,0,0.2,,0.5,0.5,0.000176845,0.00594262 -Walleye pollock,0,6.224493,0.6538435,4.109179,,,-1.35,0.2,,0.5,0.5,0.0618452,0.281034 -Pacific cod,0,1.520393,0.5576789,2.39571,,,0,0.2,,0.5,0.5,0.1218526,0.1289747 -Pelagic forage fish,0,14.26999,0.8180392,3.676071,,,-0.11,0.2,,0.5,0.5,0.05087369,0.005135313 -Lg.-mouth flatfish,0,8.015218,0.2929934,1.443946,,,0,0.2,,0.5,0.5,0.08691967,0.07947716 -Sm.-mouth flatfish,0,2.44411,0.2152337,1.93294,,,0,0.2,,0.5,0.5,0.04497369,0.02795422 -Skates,0,0.191803,0.2,2,,,0,0.2,,0.5,0.5,0.003005425,0.01178723 -Other demersals,0,4.505964,0.1830862,2.246801,,,-0.002,0.2,,0.5,0.5,0.09719946,0.09624746 -Eelpouts,0,1.069425,0.4,2,,,0,0.2,,0.5,0.5,7.66E-06,1.66E-05 -Lg.-mouth sculpins,0,0.08888517,0.4,2,,,0,0.2,,0.5,0.5,0.000193433,0.004255149 -Other sculpins,0,0.8168654,0.4,2,,,0,0.2,,0.5,0.5,0,0 -Misc. shallow fish,0,0.8389893,0.4,2,,,0,0.2,,0.5,0.5,0.000319678,0.000919832 -Octopods,0,0.7834731,0.8,3.65,,,0,0.2,,0.5,0.5,0.000165189,0.000167874 -Squid,0,1.265454,3.2,10.67,,,0,0.2,,0.5,0.5,0.000119335,0.000225772 -Salmon returning,0,0.8566338,1.815861,11.8269,,,0,0.2,,0.5,0.5,0.29042,0.02977088 -Salmon outgoing,0,0.01713268,1.641523,14.38647,,,0,0.2,,0.5,0.5,0,0 -Other crabs,0,5.218338,0.8414152,3.966247,,,0,0.2,,0.1,0.9,0.003609303,0.000240075 -Shrimps,0,22.22855,0.576,2.41,,,0,0.2,,0.1,0.9,0.00019897,4.79E-06 -Sea stars,0,0.09551849,1.21,6.05,,,0,0.2,,0.1,0.9,0.000009245,0.003106511 -Brittle stars,0,4.544021,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 -"Urchins, dollars, cucumbers",0,1.630926,0.61,3.05,,,0,0.2,,0.1,0.9,3.51E-06,7.42E-05 -Snails,0,0.8638767,1.81,9.049999,,,0,0.2,,0.1,0.9,3.27E-07,0 -Misc. crustaceans,0,2.120289,7.4,37,,,0,0.2,,0.1,0.9,0,0 -Benthic amphipods,0,5.868869,7.4,37,,,0,0.2,,0.1,0.9,0,0 -Anemones,0,0.08886787,1,5,,,0,0.4,,0.1,0.9,4.09E-07,7.39E-05 -Corals and sea pens,0,0.005739689,0.05045965,0.2522982,,,0,0.4,,0.1,0.9,2.98E-06,2.43E-05 -Worms etc.,0,3.772863,2.195745,10.97872,,,0,0.4,,0.1,0.9,0,0 -Benthic urochordate,0,0.2448,3.58,17.9,,,0,0.4,,0.1,0.9,0,0.000006744 -Sponge,0,0.1075014,1,5,,,0,0.4,,0.1,0.9,2.65E-07,0.000020834 -Bivalves,0,13.85198,1.3,6.5,,,0,0.4,,0.1,0.9,0.000280681,0 -Polychaetes,0,3.923291,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 -Scyphozoid jellies,0,0.11,0.88,3,,,0,0.2,,0.7,0.3,0.000141226,0.000195899 -Other zooplankton,0,23.99852,5.30758,15.16452,,,0,0.2,,0.7,0.3,0,0 -Copepods,0,21.8635,6,27.74,,,0,0.2,,0.7,0.3,0,0 -Pelagic microbes,0,12.25505,36.5,104.2857,,,0,0.2,,0.7,0.3,0,0 -Benthic microbes,0,7.252296,36.5,104.2857,,,0,0.2,,0.1,0.9,0,0 -Primary production,1,40.39581,110.2083,,,,0,0,,0.5001647,0.4998353,0,0 -Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 -Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 -Fishery/Subsistence,3,,,,,,,,,0.3908825,0.6091174,, +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Toothed whales,0,0.06165833,0.04713691,12.43829,,,0,0.2,,0.5,0.5,1.29E-07,8.45E-07 +Gray whale,0,0.05543134,0.063365,8.87285,,,0,0.2,,0.5,0.5,8.57E-08,0 +Other baleen,0,0.4567338,0.03134125,6.980565,,,0,0.2,,0.5,0.5,0,5.19E-05 +Other pinnipeds,0,0.03346486,0.1222834,36.81018,,,0,0.2,,0.5,0.5,0.000090749,4.04E-06 +Procellarids,0,0.001051795,0.06487884,73,,,0,0.2,,0.5,0.5,0,1.43E-06 +Alcids piscivorous,0,0.01131623,0.09528826,72.57302,,,0,0.2,,0.5,0.5,0,1.54E-05 +Larids,0,0.001458566,0.1115763,95.5601,,,0,0.2,,0.5,0.5,0,1.98E-06 +Alcids planktivorous,0,0.000299744,0.1694877,110,,,0,0.2,,0.5,0.5,0,4.07E-07 +Other seabirds,0,0.000461801,0.09378317,109.5,,,0,0.2,,0.5,0.5,0,6.27E-07 +Cormorants,0,0.000348881,0.1587271,73,,,0,0.2,,0.5,0.5,0,4.74E-07 +Sharks,0,0.142353,0.1,3.729058,,,0,0.2,,0.5,0.5,0.000176845,0.00594262 +Walleye pollock,0,6.224493,0.6538435,4.109179,,,-1.35,0.2,,0.5,0.5,0.0618452,0.281034 +Pacific cod,0,1.520393,0.5576789,2.39571,,,0,0.2,,0.5,0.5,0.1218526,0.1289747 +Pelagic forage fish,0,14.26999,0.8180392,3.676071,,,-0.11,0.2,,0.5,0.5,0.05087369,0.005135313 +Lg.-mouth flatfish,0,8.015218,0.2929934,1.443946,,,0,0.2,,0.5,0.5,0.08691967,0.07947716 +Sm.-mouth flatfish,0,2.44411,0.2152337,1.93294,,,0,0.2,,0.5,0.5,0.04497369,0.02795422 +Skates,0,0.191803,0.2,2,,,0,0.2,,0.5,0.5,0.003005425,0.01178723 +Other demersals,0,4.505964,0.1830862,2.246801,,,-0.002,0.2,,0.5,0.5,0.09719946,0.09624746 +Eelpouts,0,1.069425,0.4,2,,,0,0.2,,0.5,0.5,7.66E-06,1.66E-05 +Lg.-mouth sculpins,0,0.08888517,0.4,2,,,0,0.2,,0.5,0.5,0.000193433,0.004255149 +Other sculpins,0,0.8168654,0.4,2,,,0,0.2,,0.5,0.5,0,0 +Misc. shallow fish,0,0.8389893,0.4,2,,,0,0.2,,0.5,0.5,0.000319678,0.000919832 +Octopods,0,0.7834731,0.8,3.65,,,0,0.2,,0.5,0.5,0.000165189,0.000167874 +Squid,0,1.265454,3.2,10.67,,,0,0.2,,0.5,0.5,0.000119335,0.000225772 +Salmon returning,0,0.8566338,1.815861,11.8269,,,0,0.2,,0.5,0.5,0.29042,0.02977088 +Salmon outgoing,0,0.01713268,1.641523,14.38647,,,0,0.2,,0.5,0.5,0,0 +Other crabs,0,5.218338,0.8414152,3.966247,,,0,0.2,,0.1,0.9,0.003609303,0.000240075 +Shrimps,0,22.22855,0.576,2.41,,,0,0.2,,0.1,0.9,0.00019897,4.79E-06 +Sea stars,0,0.09551849,1.21,6.05,,,0,0.2,,0.1,0.9,0.000009245,0.003106511 +Brittle stars,0,4.544021,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 +"Urchins, dollars, cucumbers",0,1.630926,0.61,3.05,,,0,0.2,,0.1,0.9,3.51E-06,7.42E-05 +Snails,0,0.8638767,1.81,9.049999,,,0,0.2,,0.1,0.9,3.27E-07,0 +Misc. crustaceans,0,2.120289,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Benthic amphipods,0,5.868869,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Anemones,0,0.08886787,1,5,,,0,0.4,,0.1,0.9,4.09E-07,7.39E-05 +Corals and sea pens,0,0.005739689,0.05045965,0.2522982,,,0,0.4,,0.1,0.9,2.98E-06,2.43E-05 +Worms etc.,0,3.772863,2.195745,10.97872,,,0,0.4,,0.1,0.9,0,0 +Benthic urochordate,0,0.2448,3.58,17.9,,,0,0.4,,0.1,0.9,0,0.000006744 +Sponge,0,0.1075014,1,5,,,0,0.4,,0.1,0.9,2.65E-07,0.000020834 +Bivalves,0,13.85198,1.3,6.5,,,0,0.4,,0.1,0.9,0.000280681,0 +Polychaetes,0,3.923291,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid jellies,0,0.11,0.88,3,,,0,0.2,,0.7,0.3,0.000141226,0.000195899 +Other zooplankton,0,23.99852,5.30758,15.16452,,,0,0.2,,0.7,0.3,0,0 +Copepods,0,21.8635,6,27.74,,,0,0.2,,0.7,0.3,0,0 +Pelagic microbes,0,12.25505,36.5,104.2857,,,0,0.2,,0.7,0.3,0,0 +Benthic microbes,0,7.252296,36.5,104.2857,,,0,0.2,,0.1,0.9,0,0 +Primary production,1,40.39581,110.2083,,,,0,0,,0.5001647,0.4998353,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.3908825,0.6091174,, diff --git a/data-raw/Ecosense_GOA_diet.csv b/data-raw/Ecosense_GOA_diet.csv index 90f58390..b998a553 100644 --- a/data-raw/Ecosense_GOA_diet.csv +++ b/data-raw/Ecosense_GOA_diet.csv @@ -1,51 +1,51 @@ -DIETS,Toothed whales,Gray whale,Other baleen,Other pinnipeds,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squid,Salmon returning,Salmon outgoing,Other crabs,Shrimps,Sea stars,Brittle stars,"Urchins, dollars, cucumbers",Snails,Misc. crustaceans,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production -Toothed whales,0.000053212,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Gray whale,0.000195671,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other baleen,0.00161226,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other pinnipeds,0.00011813,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Procellarids,,,,0.00001722,8.24E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Alcids piscivorous,,,,0.000185269,0.000886036,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Larids,,,,2.39E-05,0.000114203,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Alcids planktivorous,,,,4.91E-06,2.35E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other seabirds,,,,7.56E-06,0.000036158,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Cormorants,,,,5.71E-06,2.73E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Sharks,0.000161708,,,,,,,,,,0.007149246,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Walleye pollock,0.003959108,,0.01536035,0.2443831,0.1994964,0.1707221,0.1374473,0.002219961,0.019285,0.000520214,0.0642318,0.01730322,0.165236,,0.2428017,0.001732163,0.05733645,0.02243403,0.003956129,0.1298187,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, -Pacific cod,0.01370258,,,0.01315614,0.03869898,0.0953234,0.02666247,0.000430635,0.003740967,0.000100913,0.01441741,4.16E-05,4.53E-05,,0.00643942,0.000612311,0.01391214,0.000445677,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,, -Pelagic forage fish,0.1161123,,0.2332085,0.3194725,0.2109555,0.5695944,0.7290136,0.0579436,0.1867094,0.9490509,0.09923565,0.05399713,0.05462447,,0.3145934,0.002486164,0.1599201,0.01277022,0.01307451,0.08628713,,,,0.15,,,,,,,,,,,,,,,,,,0.008000001,,,,, -Lg.-mouth flatfish,0.005098103,,,0.06527214,,,,,,,0.1543446,0.000791903,0.01130468,,0.01020996,1.63E-05,0.1309565,0.000628949,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,, -Sm.-mouth flatfish,0.001552685,,,0.01064673,,,,,,,0.01475467,0.001102062,0.006265766,,0.003265063,,0.09747098,6.51E-05,7.38E-06,0.03985396,0.009723351,0.000782896,,,,,,,,,,,,,,,,,,,,,,,,, -Skates,0.001757251,,,0.002557138,,,,,,,0.006894708,,,,,,8.46E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other demersals,0.0355815,,0.000854911,0.0275689,0.000779691,0.000999022,0.000999001,0.000999028,0.000656877,0.000999001,0.1612058,4.97E-06,0.000487305,,0.01635126,,0.007544784,0.00062241,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,, -Eelpouts,0.03762805,,,0.001576726,,,,,,,,0.000384112,0.00827353,,0.01708649,0.001052443,0.06045089,1.19E-05,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,, -Lg.-mouth sculpins,,,,0.004269105,,,,,,,0.001023347,,,,0.0004592,,0.001537074,0.00074721,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other sculpins,0.0239836,,,0.001656653,,,,,,,0.008203304,0.000368221,0.03324791,,0.003973727,0.002730238,0.008991601,0.001097425,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,, -Misc. shallow fish,0.0183782,,0.01225261,0.01958377,,,,,,,0.01196223,0.000873976,0.00369463,,0.004439839,0.00072485,0.009763914,0.000227009,0.000986536,0.01898878,0.04985735,,,,,,,,,,,,,,,,,,,,,,,,,, -Octopods,,,,0.003456976,,,,,,,0.01923347,0.000801896,0.01928917,,0.004122138,5.58E-05,0.005395931,0.03390534,,0.01435831,,,,,,,,,,,,,,,,,,,,,,,,,,, -Squid,0.7395499,,0.003086945,0.0333473,0.5152936,0.03660618,0.005065987,0.000737371,0.5699574,,0.03743711,0.005250731,0.004351677,,0.002514759,,0.007717871,0.02896504,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,0.001,,,,, -Salmon returning,0.000544865,,0.01958669,0.09488117,,,,,,,0.1593205,,,,0.01610603,,0.007721416,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Salmon outgoing,1.09E-05,,0.000391734,0.001760886,,,,,0.000253304,,,,,,,,0.000154428,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Other crabs,,0.00868696,,0.07330567,,,,,,0.001637441,0.03539184,0.02547316,0.2096924,,0.05080061,0.05152845,0.004317433,0.02019694,0.1014338,0.1003206,0.05453777,,0.2,,,,0.001857261,,0.015,,,,,,,,,,,,,,,,,, -Shrimps,,0.03814375,,7.59E-05,,,,,,0.01679093,0.04296356,0.1641614,0.1930464,,0.1034172,0.1775361,0.2619857,0.2075776,0.01367033,0.1972779,0.5433435,0.06150237,,,,,,,0.01,,,,,,,,,,,,,,,,,, -Sea stars,,0.000168028,,,,,,,,,3.78E-05,0.001743829,0.001815502,,5.86E-07,0.000471179,,2.18E-06,,5.38E-05,,,,,,,0.000007134,,,,,,,,,,,,,,,,,,,, -Brittle stars,,0.007993475,,,,,,,,,0.001799504,,0.000263089,,2.68E-05,0.1307027,0.000445373,1.20E-07,0.1822525,0.000102108,0.000181826,,,,,,0.003674393,,0.03,,,,,,,,,,,,,,,,,, -"Urchins, dollars, cucumbers",,0.002868994,,0.08012424,,,,,,,0.00152771,3.39E-05,1.33E-05,,0.000167073,0.04294402,,2.75E-06,,2.12E-05,,,,,,,0.002019559,,,,,,,,,,,,,,,,,,,, -Snails,,0.001471001,,,,,,,,,0.001029396,4.63E-05,0.003873213,,0.00034488,0.002924132,,0.00091642,,0.001372771,,,0.4,,,,0.002910736,,0.005,,,,,,,,,,,,,,,,,, -Misc. crustaceans,,0.00358871,,,0.002251724,0.03868497,0.002705831,0.000634075,0.000665534,0.001579755,0.000458313,0.000930434,0.003999098,,0.000181152,0.08995359,0.002523744,0.001508952,0.005357116,0.000792121,0.01442491,,,,,,0.000473233,,,,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, -Benthic amphipods,,0.9,,,0.000155224,,0.00744352,0.001744287,0.001830829,0.004345777,0.002902649,0.05938753,0.09548885,0.00000074,0.004069764,0.03767442,0.1267503,0.02685756,0.3280453,0.05959999,0.1947338,0.00359031,,,,,0.001832292,0.3,,0.1,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, -Anemones,,0.000156329,,,,,,,,,3.52E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Corals and sea pens,,1.01E-05,,,,,,,,,,,,,,,,2.65E-07,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Worms etc.,,0.006274812,,,9.61E-05,,0.004606393,0.001079445,0.001133001,,0.006249924,6.17E-05,0.003281819,,0.000493864,0.03986195,0.0164955,0.000021125,0.02537635,0.01925321,0.03702217,,,,,,0.2279804,,0.01,,,0.2,,,,,,,,,,,,,,, -Benthic urochordate,,0.000430632,,,,,,,,,,,0.000000921,,1.83E-07,0.000503441,,0.000544108,,,,,,,,,4.46E-06,,,,,,,,,,,,,,,,,,,, -Sponge,,0.000189108,,,,,,,,,,,2.79E-05,,8.28E-07,1.27E-07,,6.28E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Bivalves,,0.02344889,,,0.000368692,,0.01768009,0.00414309,0.004348645,,0.005278854,0.000192252,0.002028014,,0.000433315,0.08457874,0.002404211,5.30E-05,0.05257818,0.000393605,,,0.4,,,,0.2544916,0.1,0.91,,,0.2,,,,,,,,,,,,,,, -Polychaetes,,0.006569219,,0.002660374,0.000103289,,0.004953088,0.001160688,0.001218275,,0.001478873,0.004868158,0.05555004,7.80E-06,0.001962562,0.2496711,0.001560155,0.001169203,0.2386699,0.10978,0.02550207,,,,,,0.2717699,,0.02,,,0.2,,,,,,,,,,,,,,, -Scyphozoid jellies,,,,,,,,,,,0.005856221,1.72E-06,,,,3.28E-08,,0.004273257,,7.51E-06,,0.000036637,,,,,,,,,,,,,,,,,,,,,,,,, -Other zooplankton,,,0.5818204,,0.01520136,0.04391786,0.02999332,0.4632186,0.1048208,0.01196193,0.08262146,0.5702611,0.07453965,0.9000154,0.1908987,0.07980518,0.005273665,0.5375271,0.001346272,0.1561293,0.01137116,0.9312431,,0.65,0.6,0.5,,0.2,,,,,,,,,,,,,,0.7400001,0.006289897,,,, -Copepods,,,0.1334379,,0.01542998,0.04415208,0.03015328,0.4656892,0.1053799,0.0130131,0.04071566,0.09128769,0.000105551,0.09997606,5.90E-05,0.002411173,,0.0915686,,2.77E-05,0.01865575,0.002844756,,0.2,0.2,0.5,,,,,,,,,,,,,,,,0.15,0.25,,,, -Pelagic microbes,,,,,,,,,,,,,,,,8.87E-07,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,0.03,0.15,0.5,,, -Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4955608,0.15,0.15,0.15,0.5,,,,,, -Primary production,,,,,,,,,,,,,1.78E-07,,5.42E-07,,,4.38E-07,,,,,,,,,,,,,0.25,0.2,,,,,,,,,,0.07000001,0.5937101,0.5,0.7,, -Pelagic detritus,,,,,,,0.003276177,,,,,,,,,,,,,,,,,,,,0.000732203,,,,,,,,,,,,,,,,,,0.3,, -Benthic detritus,,,,,,,,,,,0.01223919,0.000631227,0.04945371,,0.00477988,2.26E-05,0.009285232,0.00585382,0.00062444,0.008015925,,,,,,,0.2322469,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5012683,0.6,0.6,0.6,0.5,,,,,1, -Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +DIETS,Toothed whales,Gray whale,Other baleen,Other pinnipeds,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squid,Salmon returning,Salmon outgoing,Other crabs,Shrimps,Sea stars,Brittle stars,"Urchins, dollars, cucumbers",Snails,Misc. crustaceans,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production +Toothed whales,0.000053212,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whale,0.000195671,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other baleen,0.00161226,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other pinnipeds,0.00011813,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,0.00001722,8.24E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,0.000185269,0.000886036,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,2.39E-05,0.000114203,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,4.91E-06,2.35E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,7.56E-06,0.000036158,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,5.71E-06,2.73E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sharks,0.000161708,,,,,,,,,,0.007149246,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,0.003959108,,0.01536035,0.2443831,0.1994964,0.1707221,0.1374473,0.002219961,0.019285,0.000520214,0.0642318,0.01730322,0.165236,,0.2428017,0.001732163,0.05733645,0.02243403,0.003956129,0.1298187,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, +Pacific cod,0.01370258,,,0.01315614,0.03869898,0.0953234,0.02666247,0.000430635,0.003740967,0.000100913,0.01441741,4.16E-05,4.53E-05,,0.00643942,0.000612311,0.01391214,0.000445677,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,0.1161123,,0.2332085,0.3194725,0.2109555,0.5695944,0.7290136,0.0579436,0.1867094,0.9490509,0.09923565,0.05399713,0.05462447,,0.3145934,0.002486164,0.1599201,0.01277022,0.01307451,0.08628713,,,,0.15,,,,,,,,,,,,,,,,,,0.008000001,,,,, +Lg.-mouth flatfish,0.005098103,,,0.06527214,,,,,,,0.1543446,0.000791903,0.01130468,,0.01020996,1.63E-05,0.1309565,0.000628949,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,0.001552685,,,0.01064673,,,,,,,0.01475467,0.001102062,0.006265766,,0.003265063,,0.09747098,6.51E-05,7.38E-06,0.03985396,0.009723351,0.000782896,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,0.001757251,,,0.002557138,,,,,,,0.006894708,,,,,,8.46E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,0.0355815,,0.000854911,0.0275689,0.000779691,0.000999022,0.000999001,0.000999028,0.000656877,0.000999001,0.1612058,4.97E-06,0.000487305,,0.01635126,,0.007544784,0.00062241,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,0.03762805,,,0.001576726,,,,,,,,0.000384112,0.00827353,,0.01708649,0.001052443,0.06045089,1.19E-05,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,,,0.004269105,,,,,,,0.001023347,,,,0.0004592,,0.001537074,0.00074721,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,0.0239836,,,0.001656653,,,,,,,0.008203304,0.000368221,0.03324791,,0.003973727,0.002730238,0.008991601,0.001097425,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,0.0183782,,0.01225261,0.01958377,,,,,,,0.01196223,0.000873976,0.00369463,,0.004439839,0.00072485,0.009763914,0.000227009,0.000986536,0.01898878,0.04985735,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,,,,0.003456976,,,,,,,0.01923347,0.000801896,0.01928917,,0.004122138,5.58E-05,0.005395931,0.03390534,,0.01435831,,,,,,,,,,,,,,,,,,,,,,,,,,, +Squid,0.7395499,,0.003086945,0.0333473,0.5152936,0.03660618,0.005065987,0.000737371,0.5699574,,0.03743711,0.005250731,0.004351677,,0.002514759,,0.007717871,0.02896504,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,0.001,,,,, +Salmon returning,0.000544865,,0.01958669,0.09488117,,,,,,,0.1593205,,,,0.01610603,,0.007721416,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,1.09E-05,,0.000391734,0.001760886,,,,,0.000253304,,,,,,,,0.000154428,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other crabs,,0.00868696,,0.07330567,,,,,,0.001637441,0.03539184,0.02547316,0.2096924,,0.05080061,0.05152845,0.004317433,0.02019694,0.1014338,0.1003206,0.05453777,,0.2,,,,0.001857261,,0.015,,,,,,,,,,,,,,,,,, +Shrimps,,0.03814375,,7.59E-05,,,,,,0.01679093,0.04296356,0.1641614,0.1930464,,0.1034172,0.1775361,0.2619857,0.2075776,0.01367033,0.1972779,0.5433435,0.06150237,,,,,,,0.01,,,,,,,,,,,,,,,,,, +Sea stars,,0.000168028,,,,,,,,,3.78E-05,0.001743829,0.001815502,,5.86E-07,0.000471179,,2.18E-06,,5.38E-05,,,,,,,0.000007134,,,,,,,,,,,,,,,,,,,, +Brittle stars,,0.007993475,,,,,,,,,0.001799504,,0.000263089,,2.68E-05,0.1307027,0.000445373,1.20E-07,0.1822525,0.000102108,0.000181826,,,,,,0.003674393,,0.03,,,,,,,,,,,,,,,,,, +"Urchins, dollars, cucumbers",,0.002868994,,0.08012424,,,,,,,0.00152771,3.39E-05,1.33E-05,,0.000167073,0.04294402,,2.75E-06,,2.12E-05,,,,,,,0.002019559,,,,,,,,,,,,,,,,,,,, +Snails,,0.001471001,,,,,,,,,0.001029396,4.63E-05,0.003873213,,0.00034488,0.002924132,,0.00091642,,0.001372771,,,0.4,,,,0.002910736,,0.005,,,,,,,,,,,,,,,,,, +Misc. crustaceans,,0.00358871,,,0.002251724,0.03868497,0.002705831,0.000634075,0.000665534,0.001579755,0.000458313,0.000930434,0.003999098,,0.000181152,0.08995359,0.002523744,0.001508952,0.005357116,0.000792121,0.01442491,,,,,,0.000473233,,,,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, +Benthic amphipods,,0.9,,,0.000155224,,0.00744352,0.001744287,0.001830829,0.004345777,0.002902649,0.05938753,0.09548885,0.00000074,0.004069764,0.03767442,0.1267503,0.02685756,0.3280453,0.05959999,0.1947338,0.00359031,,,,,0.001832292,0.3,,0.1,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, +Anemones,,0.000156329,,,,,,,,,3.52E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,1.01E-05,,,,,,,,,,,,,,,,2.65E-07,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Worms etc.,,0.006274812,,,9.61E-05,,0.004606393,0.001079445,0.001133001,,0.006249924,6.17E-05,0.003281819,,0.000493864,0.03986195,0.0164955,0.000021125,0.02537635,0.01925321,0.03702217,,,,,,0.2279804,,0.01,,,0.2,,,,,,,,,,,,,,, +Benthic urochordate,,0.000430632,,,,,,,,,,,0.000000921,,1.83E-07,0.000503441,,0.000544108,,,,,,,,,4.46E-06,,,,,,,,,,,,,,,,,,,, +Sponge,,0.000189108,,,,,,,,,,,2.79E-05,,8.28E-07,1.27E-07,,6.28E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bivalves,,0.02344889,,,0.000368692,,0.01768009,0.00414309,0.004348645,,0.005278854,0.000192252,0.002028014,,0.000433315,0.08457874,0.002404211,5.30E-05,0.05257818,0.000393605,,,0.4,,,,0.2544916,0.1,0.91,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,0.006569219,,0.002660374,0.000103289,,0.004953088,0.001160688,0.001218275,,0.001478873,0.004868158,0.05555004,7.80E-06,0.001962562,0.2496711,0.001560155,0.001169203,0.2386699,0.10978,0.02550207,,,,,,0.2717699,,0.02,,,0.2,,,,,,,,,,,,,,, +Scyphozoid jellies,,,,,,,,,,,0.005856221,1.72E-06,,,,3.28E-08,,0.004273257,,7.51E-06,,0.000036637,,,,,,,,,,,,,,,,,,,,,,,,, +Other zooplankton,,,0.5818204,,0.01520136,0.04391786,0.02999332,0.4632186,0.1048208,0.01196193,0.08262146,0.5702611,0.07453965,0.9000154,0.1908987,0.07980518,0.005273665,0.5375271,0.001346272,0.1561293,0.01137116,0.9312431,,0.65,0.6,0.5,,0.2,,,,,,,,,,,,,,0.7400001,0.006289897,,,, +Copepods,,,0.1334379,,0.01542998,0.04415208,0.03015328,0.4656892,0.1053799,0.0130131,0.04071566,0.09128769,0.000105551,0.09997606,5.90E-05,0.002411173,,0.0915686,,2.77E-05,0.01865575,0.002844756,,0.2,0.2,0.5,,,,,,,,,,,,,,,,0.15,0.25,,,, +Pelagic microbes,,,,,,,,,,,,,,,,8.87E-07,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,0.03,0.15,0.5,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4955608,0.15,0.15,0.15,0.5,,,,,, +Primary production,,,,,,,,,,,,,1.78E-07,,5.42E-07,,,4.38E-07,,,,,,,,,,,,,0.25,0.2,,,,,,,,,,0.07000001,0.5937101,0.5,0.7,, +Pelagic detritus,,,,,,,0.003276177,,,,,,,,,,,,,,,,,,,,0.000732203,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,,0.01223919,0.000631227,0.04945371,,0.00477988,2.26E-05,0.009285232,0.00585382,0.00062444,0.008015925,,,,,,,0.2322469,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5012683,0.6,0.6,0.6,0.5,,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/data-raw/Ecosense_GOA_pedigree.csv b/data-raw/Ecosense_GOA_pedigree.csv index 8d072f57..670ec91d 100644 --- a/data-raw/Ecosense_GOA_pedigree.csv +++ b/data-raw/Ecosense_GOA_pedigree.csv @@ -1,50 +1,50 @@ -Group,B,PB,QB,Diet,F_Fishery/Subsistence -Toothed whales,0.8,0.6,0.6,0.8,0.3 -Gray whale,0.5,0.6,0.6,0.8,0.3 -Other baleen,0.8,0.6,0.6,0.8,0.1 -Other pinnipeds,0.5,0.6,0.8,0.8,0.3 -Procellarids,0.8,0.6,0.6,0.8,0.5 -Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 -Larids,0.5,0.6,0.6,0.8,0.5 -Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 -Other seabirds,0.8,0.6,0.6,0.8,0.5 -Cormorants,0.5,0.6,0.6,0.8,0.5 -Sharks,0.8,0.7,0.7,0.8,0.7 -Walleye pollock,0.8,0.4,0.4,0.1,0.3 -Pacific cod,0.8,0.4,0.4,0.1,0.7 -Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 -Lg.-mouth flatfish,0.5,0.4,0.4,0.1,0.7 -Sm.-mouth flatfish,0.8,0.6,0.6,0.7,0.3 -Skates,0.5,0.7,0.7,0.8,0.7 -Other demersals,0.8,0.7,0.8,0.8,0.8 -Eelpouts,0.8,0.7,0.7,0.8,0.7 -Lg.-mouth sculpins,0.1,0.7,0.7,0.8,0.8 -Other sculpins,0.8,0.7,0.7,0.8,0 -Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 -Octopods,0.8,0.7,0.7,0.8,0.4 -Squid,0.8,0.7,0.7,0.8,0.4 -Salmon returning,0.8,0.5,0.8,0.7,0.3 -Salmon outgoing,0.8,0.6,0.6,0.8,0 -Other crabs,0.8,0.6,0.8,0.8,0.5 -Shrimps,0.8,0.6,0.8,0.8,0.5 -Sea stars,0.5,0.6,0.7,0.8,0.8 -Brittle stars,0.5,0.6,0.7,0.8,0 -"Urchins, dollars, cucumbers",0.5,0.6,0.7,0.8,0.5 -Snails,0.8,0.6,0.7,0.8,0.3 -Misc. crustaceans,0.8,0.6,0.7,0.8,0 -Benthic amphipods,0.8,0.6,0.7,0.8,0 -Anemones,0.5,0.6,0.7,0.8,0.5 -Corals and sea pens,0.1,0.6,0.7,0.8,0.5 -Worms etc.,0.8,0.6,0.7,0.8,0 -Benthic urochordate,0.8,0.6,0.7,0.8,0.5 -Sponge,0.5,0.6,0.7,0.8,0.5 -Bivalves,0.8,0.6,0.7,0.8,0.3 -Polychaetes,0.8,0.6,0.7,0.8,0 -Scyphozoid jellies,0.5,0.6,0.6,0.8,0.5 -Other zooplankton,0.8,0.7,0.7,0.8,0 -Copepods,0.8,0.7,0.6,0.8,0 -Pelagic microbes,0.8,0.7,0.7,0.8,0 -Benthic microbes,0.8,0.7,0.7,0.1,0 -Primary production,0.8,0.7,0,0.01,0 -Pelagic detritus,0.8,0,0,0,0 -Benthic detritus,0.8,0,0,0,0 +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Toothed whales,0.8,0.6,0.6,0.8,0.3 +Gray whale,0.5,0.6,0.6,0.8,0.3 +Other baleen,0.8,0.6,0.6,0.8,0.1 +Other pinnipeds,0.5,0.6,0.8,0.8,0.3 +Procellarids,0.8,0.6,0.6,0.8,0.5 +Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 +Larids,0.5,0.6,0.6,0.8,0.5 +Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 +Other seabirds,0.8,0.6,0.6,0.8,0.5 +Cormorants,0.5,0.6,0.6,0.8,0.5 +Sharks,0.8,0.7,0.7,0.8,0.7 +Walleye pollock,0.8,0.4,0.4,0.1,0.3 +Pacific cod,0.8,0.4,0.4,0.1,0.7 +Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 +Lg.-mouth flatfish,0.5,0.4,0.4,0.1,0.7 +Sm.-mouth flatfish,0.8,0.6,0.6,0.7,0.3 +Skates,0.5,0.7,0.7,0.8,0.7 +Other demersals,0.8,0.7,0.8,0.8,0.8 +Eelpouts,0.8,0.7,0.7,0.8,0.7 +Lg.-mouth sculpins,0.1,0.7,0.7,0.8,0.8 +Other sculpins,0.8,0.7,0.7,0.8,0 +Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 +Octopods,0.8,0.7,0.7,0.8,0.4 +Squid,0.8,0.7,0.7,0.8,0.4 +Salmon returning,0.8,0.5,0.8,0.7,0.3 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Other crabs,0.8,0.6,0.8,0.8,0.5 +Shrimps,0.8,0.6,0.8,0.8,0.5 +Sea stars,0.5,0.6,0.7,0.8,0.8 +Brittle stars,0.5,0.6,0.7,0.8,0 +"Urchins, dollars, cucumbers",0.5,0.6,0.7,0.8,0.5 +Snails,0.8,0.6,0.7,0.8,0.3 +Misc. crustaceans,0.8,0.6,0.7,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Anemones,0.5,0.6,0.7,0.8,0.5 +Corals and sea pens,0.1,0.6,0.7,0.8,0.5 +Worms etc.,0.8,0.6,0.7,0.8,0 +Benthic urochordate,0.8,0.6,0.7,0.8,0.5 +Sponge,0.5,0.6,0.7,0.8,0.5 +Bivalves,0.8,0.6,0.7,0.8,0.3 +Polychaetes,0.8,0.6,0.7,0.8,0 +Scyphozoid jellies,0.5,0.6,0.6,0.8,0.5 +Other zooplankton,0.8,0.7,0.7,0.8,0 +Copepods,0.8,0.7,0.6,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.1,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0.8,0,0,0,0 +Benthic detritus,0.8,0,0,0,0 diff --git a/data-raw/REcosystem.R b/data-raw/REcosystem.R new file mode 100644 index 00000000..f1f011f0 --- /dev/null +++ b/data-raw/REcosystem.R @@ -0,0 +1,142 @@ +#R Ecosystem +#Tutorial ecosystem for teaching Rpath + +#' +#' Script that creates REco.params example model file +#' +#' @param REco.params Rpath parameters +#' + +library(Rpath); library(data.table); library(here); library(qpdf) + +#Groups and types for the R Ecosystem---- + +groups <- c('Seabirds', 'Whales', 'Seals', 'JuvRoundfish1', 'AduRoundfish1', + 'JuvRoundfish2', 'AduRoundfish2', 'JuvFlatfish1', 'AduFlatfish1', + 'JuvFlatfish2', 'AduFlatfish2', 'OtherGroundfish', 'Foragefish1', + 'Foragefish2', 'OtherForagefish', 'Megabenthos', 'Shellfish', + 'Macrobenthos', 'Zooplankton', 'Phytoplankton', 'Detritus', + 'Discards', 'Trawlers', 'Midwater', 'Dredgers') +stgroups <- c(rep(NA, 3), rep('Roundfish1', 2), rep('Roundfish2', 2), + rep('Flatfish1', 2), rep('Flatfish2', 2), rep(NA, 14)) + +types <- c(rep(0, 19), 1, rep(2, 2), rep(3, 3)) + +#Model---- +#Create Model File +REco.params <- create.rpath.params(group = groups, type = types, stgroup = stgroups) + +biomass <- c(0.0149, 0.454, NA, NA, 1.39, NA, 5.553, NA, 5.766, NA, + 0.739, 7.4, 5.1, 4.7, 5.1, NA, 7, 17.4, 23, 10, rep(NA, 5)) + +pb <- c(0.098, 0.031, 0.100, 2.026, 0.42, 2.1, 0.425, 1.5, 0.26, 1.1, 0.18, 0.6, + 0.61, 0.65, 1.5, 0.9, 1.3, 7, 39, 240, rep(NA, 5)) + +qb <- c(76.750, 6.976, 34.455, NA, 2.19, NA, 3.78, NA, 1.44, NA, 1.69, + 1.764, 3.52, 5.65, 3.6, 2.984, rep (NA, 9)) + +REco.params$model[, Biomass := biomass] +REco.params$model[, PB := pb] +REco.params$model[, QB := qb] + +#EE for groups w/o biomass +REco.params$model[Group %in% c('Seals', 'Megabenthos'), EE := 0.8] + +#Production to Consumption for those groups without a QB +REco.params$model[Group %in% c('Shellfish', 'Zooplankton'), ProdCons:= 0.25] +REco.params$model[Group == 'Macrobenthos', ProdCons := 0.35] + +#Biomass accumulation and unassimilated production +REco.params$model[, BioAcc := c(rep(0, 22), rep(NA, 3))] +REco.params$model[, Unassim := c(rep(0.2, 18), 0.4, rep(0, 3), rep(NA, 3))] + +#Detrital Fate +REco.params$model[, Detritus := c(rep(1, 20), rep(0, 5))] +REco.params$model[, Discards := c(rep(0, 22), rep(1, 3))] + +#Fisheries +#Landings +trawl <- c(rep(0, 4), 0.08, 0, 0.32, 0, 0.09, 0, 0.05, 0.2, rep(0, 10), rep(NA, 3)) +mid <- c(rep(0, 12), 0.3, 0.08, 0.02, rep(0, 7), rep(NA, 3)) +dredge <- c(rep(0, 15), 0.1, 0.5, rep(0, 5), rep(NA, 3)) +REco.params$model[, Trawlers := trawl] +REco.params$model[, Midwater := mid] +REco.params$model[, Dredgers := dredge] + +#Discards +trawl.d <- c(1e-5, 1e-7, 0.001, 0.001, 0.005, 0.001, 0.009, 0.001, 0.04, 0.001, + 0.01, 0.08, 0.001, 0.001, 0.001, rep(0, 7), rep(NA, 3)) +mid.d <- c(rep(0, 2), 0.001, 0.001, 0.01, 0.001, 0.01, rep(0, 4), 0.05, 0.05, + 0.01, 0.01, rep(0, 7), rep(NA, 3)) +dredge.d <- c(rep(0, 3), 0.001, 0.05, 0.001, 0.05, 0.001, 0.05, 0.001, 0.01, 0.05, + rep(0, 3), 0.09, 0.01, 1e-4, rep(0, 4), rep(NA, 3)) +REco.params$model[, Trawlers.disc := trawl.d] +REco.params$model[, Midwater.disc := mid.d] +REco.params$model[, Dredgers.disc := dredge.d] + +#Stanzas---- +#Calculate the multistanza biomass/consumption +#Group parameters +REco.params$stanzas$stgroups[, VBGF_Ksp := c(0.145, 0.295, 0.0761, 0.112)] +#REco.params$stanzas$stgroups[, Wmat := c(0.0769, 0.561, 0.117, 0.321)] +REco.params$stanzas$stgroups[, Wmat := c(0.0577, 0.421, 0.088, 0.241)] + + +#Individual stanza parameters +REco.params$stanzas$stindiv[, First := c(rep(c(0, 24), 3), 0, 48)] +REco.params$stanzas$stindiv[, Last := c(rep(c(23, 400), 3), 47, 400)] +REco.params$stanzas$stindiv[, Z := c(2.026, 0.42, 2.1, 0.425, 1.5, + 0.26, 1.1, 0.18)] +REco.params$stanzas$stindiv[, Leading := rep(c(F, T), 4)] + +REco.params <- rpath.stanzas(REco.params) + +#Diet File---- +REco.params$diet[, Seabirds := c(rep(NA, 11), 0.1, 0.25, 0.2, 0.15, + rep(NA, 6), 0.3, NA)] +REco.params$diet[, Whales := c(rep(NA, 3), 0.01, NA, 0.01, NA, 0.01, + NA, 0.01, rep(NA, 4), 0.1, rep(NA, 3), + 0.86, rep(NA, 4))] +REco.params$diet[, Seals := c(rep(NA, 3), 0.05, 0.1, 0.05, 0.2, 0.005, + 0.05, 0.005, 0.01, 0.24, rep(0.05, 4), + 0.09, rep(NA, 6))] +REco.params$diet[, JuvRoundfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, + rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, + 0.1, 0.05, NA, NA)] +REco.params$diet[, AduRoundfish1 := c(rep(NA, 5), 1e-3, 0.01, 1e-3, 0.05, 1e-3, + 0.01, 0.29, 0.1, 0.1, 0.347, 0.03, NA, + 0.05, 0.01, rep(NA, 4))] +REco.params$diet[, JuvRoundfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, + rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, + 0.1, .05, NA, NA)] +REco.params$diet[, AduRoundfish2 := c(rep(NA, 3), 1e-4, NA, 1e-4, NA, rep(1e-4, 4), + 0.1, rep(0.05, 3), 0.2684, 0.01, 0.37, 0.001, + NA, 0.1, NA, NA)] +REco.params$diet[, JuvFlatfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), + rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, + NA, NA)] +REco.params$diet[, AduFlatfish1 := c(rep(NA, 7), rep(1e-4, 5), rep(NA, 2), 0.001, + 0.05, 0.001, 0.6, 0.2475, NA, 0.1, NA, NA)] +REco.params$diet[, JuvFlatfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), + rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, + NA, NA)] +REco.params$diet[, AduFlatfish2 := c(rep(NA, 7), 1e-4, NA, 1e-4, rep(NA, 4), + rep(1e-4, 3), 0.44, 0.3895, NA, 0.17, + NA, NA)] +REco.params$diet[, OtherGroundfish := c(rep(NA, 3), rep(1e-4, 8), 0.05, 0.08, 0.0992, + 0.3, 0.15, 0.01, 0.3, 0.01, rep(NA, 4))] +REco.params$diet[, Foragefish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, Foragefish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, OtherForagefish := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, Megabenthos := c(rep(NA, 15), 0.1, 0.03, 0.55, rep(NA, 2), 0.32, + NA, NA)] +REco.params$diet[, Shellfish := c(rep(NA, 18), 0.3, 0.5, 0.2, NA, NA)] +REco.params$diet[, Macrobenthos := c(rep(NA, 16), 0.01, rep(0.2, 2), NA, 0.59, + NA, NA)] +REco.params$diet[, Zooplankton := c(rep(NA, 18), 0.2, 0.6, 0.2, NA, NA)] + +#usethis::use_data(REco.params, overwrite = T) + diff --git a/data/AB.params.rda b/data/AB.params.rda new file mode 100644 index 00000000..a7f85fa9 Binary files /dev/null and b/data/AB.params.rda differ diff --git a/data/REco.params.rda b/data/REco.params.rda new file mode 100644 index 00000000..074a4bef Binary files /dev/null and b/data/REco.params.rda differ diff --git a/man/AB.params.Rd b/man/AB.params.Rd new file mode 100644 index 00000000..6342ccbb --- /dev/null +++ b/man/AB.params.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{AB.params} +\alias{AB.params} +\title{AB.params} +\format{ +An Rpath balanced model object that contains: +\describe{ + \item{model}{A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).} + \item{diet}{A data.table containing the Ecopath model's diet matrix.} + \item{stanzas}{Parameters for multistanza groups.} + \item{pedigree}{A data.table containing the data quality (pedigree) for the Ecopath model.} + ... +} +} +\usage{ +AB.params +} +\description{ +A tutorial ecosystem for teaching Rpath +} +\keyword{datasets} diff --git a/man/MTI.Rd b/man/MTI.Rd index 190390af..109e2c27 100644 --- a/man/MTI.Rd +++ b/man/MTI.Rd @@ -29,9 +29,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/REco.params.Rd b/man/REco.params.Rd new file mode 100644 index 00000000..a1e3a20c --- /dev/null +++ b/man/REco.params.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{REco.params} +\alias{REco.params} +\title{REco.params} +\format{ +An Rpath balanced model object that contains: +\describe{ + \item{model}{A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).} + \item{diet}{A data.table containing the Ecopath model's diet matrix.} + \item{stanzas}{Parameters for multistanza groups.} + \item{pedigree}{A data.table containing the data quality (pedigree) for the Ecopath model.} + ... +} +} +\usage{ +REco.params +} +\description{ +A sample ecosystem for Rpath - Anchovy Bay. +} +\keyword{datasets} diff --git a/man/Rpath-package.Rd b/man/Rpath-package.Rd index f78818cb..45fe760b 100644 --- a/man/Rpath-package.Rd +++ b/man/Rpath-package.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/Rpath_pkg.R \docType{package} \name{Rpath-package} +\alias{Rpath} \alias{Rpath-package} \title{Rpath: A package implementating mass balance algorithms designed to work with fisheries data sources.} @@ -16,3 +17,21 @@ system. This is done by solving a series of linear equations for unknown biomas or ecotrophic efficiency. } +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/NOAA-EDAB/Rpath} + \item Report bugs at \url{https://github.com/NOAA-EDAB/Rpath/issues} +} + +} +\author{ +\strong{Maintainer}: Sean Lucey \email{Sean.Lucey@NOAA.gov} + +Authors: +\itemize{ + \item Kerim Aydin \email{Kerim.Aydin@NOAA.gov} + \item Sarah Gaichas \email{Sarah.Gaichas@NOAA.gov} +} + +} diff --git a/man/adjust.forcing.Rd b/man/adjust.forcing.Rd index 4fdc1e6f..7f96119d 100644 --- a/man/adjust.forcing.Rd +++ b/man/adjust.forcing.Rd @@ -46,9 +46,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/check.rpath.params.Rd b/man/check.rpath.params.Rd index 222b4b8b..f10da911 100644 --- a/man/check.rpath.params.Rd +++ b/man/check.rpath.params.Rd @@ -28,9 +28,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/create.rpath.params.Rd b/man/create.rpath.params.Rd index 6c87d3c8..7fd060c6 100644 --- a/man/create.rpath.params.Rd +++ b/man/create.rpath.params.Rd @@ -34,9 +34,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/extract.node.Rd b/man/extract.node.Rd index 0bbcb997..11a38ec1 100644 --- a/man/extract.node.Rd +++ b/man/extract.node.Rd @@ -26,9 +26,9 @@ Other Rpath functions: \code{\link{create.rpath.params}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/frate.table.Rd b/man/frate.table.Rd index 4e80c0e4..4082453c 100644 --- a/man/frate.table.Rd +++ b/man/frate.table.Rd @@ -26,9 +26,9 @@ Other Rpath functions: \code{\link{create.rpath.params}()}, \code{\link{extract.node}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/read.rpath.params.Rd b/man/read.rpath.params.Rd index e5b1f661..2fd2ebb0 100644 --- a/man/read.rpath.params.Rd +++ b/man/read.rpath.params.Rd @@ -44,9 +44,9 @@ Other Rpath functions: \code{\link{create.rpath.params}()}, \code{\link{extract.node}()}, \code{\link{frate.table}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/rpath.groups.Rd b/man/rpath.groups.Rd index 272fd502..abb26a3c 100644 --- a/man/rpath.groups.Rd +++ b/man/rpath.groups.Rd @@ -48,8 +48,8 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, -\code{\link{rpath.stanzas}()}, \code{\link{rpath}()}, +\code{\link{rpath.stanzas}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/rpath.stanzas.Rd b/man/rpath.stanzas.Rd index 0d7c7e02..5f14d2f1 100644 --- a/man/rpath.stanzas.Rd +++ b/man/rpath.stanzas.Rd @@ -28,8 +28,8 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, -\code{\link{rpath.groups}()}, \code{\link{rpath}()}, +\code{\link{rpath.groups}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/stanzaplot.Rd b/man/stanzaplot.Rd index 67799ce4..29b0ac7d 100644 --- a/man/stanzaplot.Rd +++ b/man/stanzaplot.Rd @@ -35,9 +35,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, \code{\link{write.Rsim}()}, diff --git a/man/webplot.Rd b/man/webplot.Rd index 76e254f9..2984fd08 100644 --- a/man/webplot.Rd +++ b/man/webplot.Rd @@ -66,9 +66,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{write.Rpath}()}, \code{\link{write.Rsim}()}, diff --git a/man/write.Rpath.Rd b/man/write.Rpath.Rd index cae380f7..c4772866 100644 --- a/man/write.Rpath.Rd +++ b/man/write.Rpath.Rd @@ -29,9 +29,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rsim}()}, diff --git a/man/write.Rsim.Rd b/man/write.Rsim.Rd index 04841cd7..3b989c6c 100644 --- a/man/write.Rsim.Rd +++ b/man/write.Rsim.Rd @@ -28,9 +28,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/man/write.rpath.params.Rd b/man/write.rpath.params.Rd index 8d2f485f..e125367a 100644 --- a/man/write.rpath.params.Rd +++ b/man/write.rpath.params.Rd @@ -32,9 +32,9 @@ Other Rpath functions: \code{\link{extract.node}()}, \code{\link{frate.table}()}, \code{\link{read.rpath.params}()}, +\code{\link{rpath}()}, \code{\link{rpath.groups}()}, \code{\link{rpath.stanzas}()}, -\code{\link{rpath}()}, \code{\link{stanzaplot}()}, \code{\link{webplot}()}, \code{\link{write.Rpath}()}, diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index c6f2024b..088cad9d 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -1,107 +1,107 @@ -// Generated by using Rcpp::compileAttributes() -> do not edit by hand -// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - -#include - -using namespace Rcpp; - -#ifdef RCPP_USE_GLOBAL_ROSTREAM -Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); -Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); -#endif - -// rk4_run -List rk4_run(List params, List instate, List forcing, List fishing, List stanzas, int StartYear, int EndYear); -RcppExport SEXP _Rpath_rk4_run(SEXP paramsSEXP, SEXP instateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP StartYearSEXP, SEXP EndYearSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< List >::type params(paramsSEXP); - Rcpp::traits::input_parameter< List >::type instate(instateSEXP); - Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); - Rcpp::traits::input_parameter< List >::type fishing(fishingSEXP); - Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); - Rcpp::traits::input_parameter< int >::type StartYear(StartYearSEXP); - Rcpp::traits::input_parameter< int >::type EndYear(EndYearSEXP); - rcpp_result_gen = Rcpp::wrap(rk4_run(params, instate, forcing, fishing, stanzas, StartYear, EndYear)); - return rcpp_result_gen; -END_RCPP -} -// Adams_run -List Adams_run(List params, List instate, List forcing, List fishing, List stanzas, int StartYear, int EndYear, List InitDeriv); -RcppExport SEXP _Rpath_Adams_run(SEXP paramsSEXP, SEXP instateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP StartYearSEXP, SEXP EndYearSEXP, SEXP InitDerivSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< List >::type params(paramsSEXP); - Rcpp::traits::input_parameter< List >::type instate(instateSEXP); - Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); - Rcpp::traits::input_parameter< List >::type fishing(fishingSEXP); - Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); - Rcpp::traits::input_parameter< int >::type StartYear(StartYearSEXP); - Rcpp::traits::input_parameter< int >::type EndYear(EndYearSEXP); - Rcpp::traits::input_parameter< List >::type InitDeriv(InitDerivSEXP); - rcpp_result_gen = Rcpp::wrap(Adams_run(params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv)); - return rcpp_result_gen; -END_RCPP -} -// deriv_vector -List deriv_vector(List params, List state, List forcing, List fishing, List stanzas, int inyear, int m, double tt); -RcppExport SEXP _Rpath_deriv_vector(SEXP paramsSEXP, SEXP stateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP inyearSEXP, SEXP mSEXP, SEXP ttSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< List >::type params(paramsSEXP); - Rcpp::traits::input_parameter< List >::type state(stateSEXP); - Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); - Rcpp::traits::input_parameter< List >::type fishing(fishingSEXP); - Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); - Rcpp::traits::input_parameter< int >::type inyear(inyearSEXP); - Rcpp::traits::input_parameter< int >::type m(mSEXP); - Rcpp::traits::input_parameter< double >::type tt(ttSEXP); - rcpp_result_gen = Rcpp::wrap(deriv_vector(params, state, forcing, fishing, stanzas, inyear, m, tt)); - return rcpp_result_gen; -END_RCPP -} -// SplitSetPred -int SplitSetPred(List stanzas, List state); -RcppExport SEXP _Rpath_SplitSetPred(SEXP stanzasSEXP, SEXP stateSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); - Rcpp::traits::input_parameter< List >::type state(stateSEXP); - rcpp_result_gen = Rcpp::wrap(SplitSetPred(stanzas, state)); - return rcpp_result_gen; -END_RCPP -} -// SplitUpdate -int SplitUpdate(List stanzas, List state, List forcing, List deriv, int yr, int mon); -RcppExport SEXP _Rpath_SplitUpdate(SEXP stanzasSEXP, SEXP stateSEXP, SEXP forcingSEXP, SEXP derivSEXP, SEXP yrSEXP, SEXP monSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); - Rcpp::traits::input_parameter< List >::type state(stateSEXP); - Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); - Rcpp::traits::input_parameter< List >::type deriv(derivSEXP); - Rcpp::traits::input_parameter< int >::type yr(yrSEXP); - Rcpp::traits::input_parameter< int >::type mon(monSEXP); - rcpp_result_gen = Rcpp::wrap(SplitUpdate(stanzas, state, forcing, deriv, yr, mon)); - return rcpp_result_gen; -END_RCPP -} - -static const R_CallMethodDef CallEntries[] = { - {"_Rpath_rk4_run", (DL_FUNC) &_Rpath_rk4_run, 7}, - {"_Rpath_Adams_run", (DL_FUNC) &_Rpath_Adams_run, 8}, - {"_Rpath_deriv_vector", (DL_FUNC) &_Rpath_deriv_vector, 8}, - {"_Rpath_SplitSetPred", (DL_FUNC) &_Rpath_SplitSetPred, 2}, - {"_Rpath_SplitUpdate", (DL_FUNC) &_Rpath_SplitUpdate, 6}, - {NULL, NULL, 0} -}; - -RcppExport void R_init_Rpath(DllInfo *dll) { - R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); - R_useDynamicSymbols(dll, FALSE); -} +// Generated by using Rcpp::compileAttributes() -> do not edit by hand +// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 + +#include + +using namespace Rcpp; + +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + +// rk4_run +List rk4_run(List params, List instate, List forcing, List fishing, List stanzas, int StartYear, int EndYear); +RcppExport SEXP _Rpath_rk4_run(SEXP paramsSEXP, SEXP instateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP StartYearSEXP, SEXP EndYearSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< List >::type params(paramsSEXP); + Rcpp::traits::input_parameter< List >::type instate(instateSEXP); + Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); + Rcpp::traits::input_parameter< List >::type fishing(fishingSEXP); + Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); + Rcpp::traits::input_parameter< int >::type StartYear(StartYearSEXP); + Rcpp::traits::input_parameter< int >::type EndYear(EndYearSEXP); + rcpp_result_gen = Rcpp::wrap(rk4_run(params, instate, forcing, fishing, stanzas, StartYear, EndYear)); + return rcpp_result_gen; +END_RCPP +} +// Adams_run +List Adams_run(List params, List instate, List forcing, List fishing, List stanzas, int StartYear, int EndYear, List InitDeriv); +RcppExport SEXP _Rpath_Adams_run(SEXP paramsSEXP, SEXP instateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP StartYearSEXP, SEXP EndYearSEXP, SEXP InitDerivSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< List >::type params(paramsSEXP); + Rcpp::traits::input_parameter< List >::type instate(instateSEXP); + Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); + Rcpp::traits::input_parameter< List >::type fishing(fishingSEXP); + Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); + Rcpp::traits::input_parameter< int >::type StartYear(StartYearSEXP); + Rcpp::traits::input_parameter< int >::type EndYear(EndYearSEXP); + Rcpp::traits::input_parameter< List >::type InitDeriv(InitDerivSEXP); + rcpp_result_gen = Rcpp::wrap(Adams_run(params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv)); + return rcpp_result_gen; +END_RCPP +} +// deriv_vector +List deriv_vector(List params, List state, List forcing, List fishing, List stanzas, int inyear, int m, double tt); +RcppExport SEXP _Rpath_deriv_vector(SEXP paramsSEXP, SEXP stateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP inyearSEXP, SEXP mSEXP, SEXP ttSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< List >::type params(paramsSEXP); + Rcpp::traits::input_parameter< List >::type state(stateSEXP); + Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); + Rcpp::traits::input_parameter< List >::type fishing(fishingSEXP); + Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); + Rcpp::traits::input_parameter< int >::type inyear(inyearSEXP); + Rcpp::traits::input_parameter< int >::type m(mSEXP); + Rcpp::traits::input_parameter< double >::type tt(ttSEXP); + rcpp_result_gen = Rcpp::wrap(deriv_vector(params, state, forcing, fishing, stanzas, inyear, m, tt)); + return rcpp_result_gen; +END_RCPP +} +// SplitSetPred +int SplitSetPred(List stanzas, List state); +RcppExport SEXP _Rpath_SplitSetPred(SEXP stanzasSEXP, SEXP stateSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); + Rcpp::traits::input_parameter< List >::type state(stateSEXP); + rcpp_result_gen = Rcpp::wrap(SplitSetPred(stanzas, state)); + return rcpp_result_gen; +END_RCPP +} +// SplitUpdate +int SplitUpdate(List stanzas, List state, List forcing, List deriv, int yr, int mon); +RcppExport SEXP _Rpath_SplitUpdate(SEXP stanzasSEXP, SEXP stateSEXP, SEXP forcingSEXP, SEXP derivSEXP, SEXP yrSEXP, SEXP monSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< List >::type stanzas(stanzasSEXP); + Rcpp::traits::input_parameter< List >::type state(stateSEXP); + Rcpp::traits::input_parameter< List >::type forcing(forcingSEXP); + Rcpp::traits::input_parameter< List >::type deriv(derivSEXP); + Rcpp::traits::input_parameter< int >::type yr(yrSEXP); + Rcpp::traits::input_parameter< int >::type mon(monSEXP); + rcpp_result_gen = Rcpp::wrap(SplitUpdate(stanzas, state, forcing, deriv, yr, mon)); + return rcpp_result_gen; +END_RCPP +} + +static const R_CallMethodDef CallEntries[] = { + {"_Rpath_rk4_run", (DL_FUNC) &_Rpath_rk4_run, 7}, + {"_Rpath_Adams_run", (DL_FUNC) &_Rpath_Adams_run, 8}, + {"_Rpath_deriv_vector", (DL_FUNC) &_Rpath_deriv_vector, 8}, + {"_Rpath_SplitSetPred", (DL_FUNC) &_Rpath_SplitSetPred, 2}, + {"_Rpath_SplitUpdate", (DL_FUNC) &_Rpath_SplitUpdate, 6}, + {NULL, NULL, 0} +}; + +RcppExport void R_init_Rpath(DllInfo *dll) { + R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); + R_useDynamicSymbols(dll, FALSE); +} diff --git a/src/ecosim.cpp b/src/ecosim.cpp index d4fc87c3..81a84ced 100644 --- a/src/ecosim.cpp +++ b/src/ecosim.cpp @@ -60,6 +60,9 @@ List rk4_run (List params, List instate, List forcing, List fishing, List stanza // Accumulator for monthly catch values NumericVector cum_Catch(NUM_BIO+1); NumericVector cum_Gear_Catch(NumFishingLinks +1); + + // RSK - added for force by biomass + NumericMatrix force_bybio = as(forcing["ForcedBio"]); //SML // Update sums of split groups to total biomass for derivative calcs @@ -150,6 +153,10 @@ List rk4_run (List params, List instate, List forcing, List fishing, List stanza // Make a copy of the current state for bounds testing NumericVector cur_Biomass = as(state["Biomass"]); + // RSK added forced biomass logic + NumericVector bforce = force_bybio((y-1) * STEPS_PER_YEAR + m, _); + cur_Biomass = ifelse(bforce>B_BaseRef * EPSILON, bforce, cur_Biomass); + // KYA 8/9/17 one of the NA or NaN flags is reading back as a negative integer (-2^32) // Not sure why. This sets any negative biomass (assuming this means NaN) to NA_REAL cur_Biomass = ifelse((cur_Biomass<0),NA_REAL,cur_Biomass); @@ -164,7 +171,7 @@ List rk4_run (List params, List instate, List forcing, List fishing, List stanza // If biomass goes crazy or hits NA, exit loop with crash signal. Note it // should still write the NA or INF values back to the output. - if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) { + if (bool(any(is_na(cur_Biomass))) || bool(any(is_infinite(cur_Biomass))) || bool(any(is_nan(cur_Biomass)))) { CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR; } @@ -375,7 +382,7 @@ int y, m, dd; // should still write the NA or INF values back to the output. //NOJUV make sure crash tests work for juveniles. - if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) { + if (bool(any(is_na(cur_Biomass))) || bool(any(is_infinite(cur_Biomass))) || bool(any(is_nan(cur_Biomass)))) { CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR; } @@ -613,7 +620,7 @@ int sp, links, prey, pred, gr, egr, dest, isp, ist, ieco; ActiveRespLoss = FoodGain * ActiveRespFrac * force_byactresp(dd,_); MzeroLoss = MzeroMort * state_Biomass; - + // Add mortality forcing for (int i=1; i<=NUM_DEAD+NUM_LIVING; i++){ FoodLoss[i] *= force_bymort(dd, i); @@ -701,6 +708,7 @@ int sp, links, prey, pred, gr, egr, dest, isp, ist, ieco; NumericVector FORCE_F = (NumericVector)FORCED_FRATE(y,_); // Special "CLEAN" fisheries assuming q=1, so specified input is Frate for (sp=1; sp<=NUM_LIVING+NUM_DEAD; sp++){ + caught = FORCED_CATCH(y, sp) + FORCE_F[sp] * state_Biomass[sp]; // KYA Aug 2011 removed terminal effort option to allow negative fishing pressure // if (caught <= -EPSILON) {caught = TerminalF[sp] * state_Biomass[sp];} @@ -744,6 +752,18 @@ int sp, links, prey, pred, gr, egr, dest, isp, ist, ieco; for (sp=NUM_LIVING+1; sp<=NUM_LIVING+NUM_DEAD; sp++){ MzeroLoss[sp] = 0.0; } + +// Add mortality forcing + for (int i=1; i<=NUM_DEAD+NUM_LIVING; i++){ + FoodLoss[i] *= force_bymort(dd, i); + MzeroLoss[i] *= force_bymort(dd, i); + } + +// Add migration forcing + MigrateLoss = clone(state_Biomass); + for (int i=1; i<=NUM_DEAD+NUM_LIVING; i++){ + MigrateLoss[i] *= force_bymigrate(dd, i); + } // Sum up derivitive parts (vector sums) diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 00000000..d68b6799 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,12 @@ +# This file is part of the standard setup for testthat. +# It is recommended that you do not modify it. +# +# Where should you do additional test configuration? +# Learn more about the roles of various files in: +# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview +# * https://testthat.r-lib.org/articles/special-files.html + +library(testthat) +library(Rpath) + +test_check("Rpath") diff --git a/tests/testthat/data/input/.gitignore b/tests/testthat/data/input/.gitignore new file mode 100644 index 00000000..467bf3d8 --- /dev/null +++ b/tests/testthat/data/input/.gitignore @@ -0,0 +1,68 @@ +REcosystem_Current_AB_ForcedBio_OutBiomass_Stepped.rds +REcosystem_Current_AB_ForcedBio_OutCatch_Jitter.rds +REcosystem_Current_AB_ForcedBio_OutCatch_Stepped.rds +REcosystem_Current_AB_ForcedBio_OutGearCatch_Jitter.rds +REcosystem_Current_AB_ForcedBio_OutGearCatch_Stepped.rds +REcosystem_Current_AB_ForcedCat_OutBiomass_Jitter.rds +REcosystem_Current_AB_ForcedCat_OutBiomass_Stepped.rds +REcosystem_Current_AB_ForcedCat_OutCatch_Jitter.rds +REcosystem_Current_AB_ForcedCat_OutCatch_Stepped.rds +REcosystem_Current_AB_ForcedCat_OutGearCatch_Jitter.rds +REcosystem_Current_AB_ForcedCat_OutGearCatch_Stepped.rds +REcosystem_Current_AB_ForcedEff_OutBiomass_Jitter.rds +REcosystem_Current_AB_ForcedEff_OutBiomass_Stepped.rds +REcosystem_Current_AB_ForcedEff_OutCatch_Jitter.rds +REcosystem_Current_AB_ForcedEff_OutCatch_Stepped.rds +REcosystem_Current_AB_ForcedEff_OutGearCatch_Jitter.rds +REcosystem_Current_AB_ForcedEff_OutGearCatch_Stepped.rds +REcosystem_Current_AB_ForcedFRa_OutBiomass_Jitter.rds +REcosystem_Current_AB_ForcedFRa_OutBiomass_Stepped.rds +REcosystem_Current_RK4_ForcedCat_OutGearCatch_Stepped.rds +REcosystem_Current_RK4_ForcedEff_OutBiomass_Jitter.rds +REcosystem_Current_RK4_ForcedEff_OutBiomass_Stepped.rds +REcosystem_Current_RK4_ForcedEff_OutCatch_Jitter.rds +REcosystem_Current_RK4_ForcedEff_OutCatch_Stepped.rds +REcosystem_Current_RK4_ForcedEff_OutGearCatch_Jitter.rds +REcosystem_Current_RK4_ForcedEff_OutGearCatch_Stepped.rds +REcosystem_Current_RK4_ForcedFRa_OutBiomass_Jitter.rds +REcosystem_Current_RK4_ForcedFRa_OutBiomass_Stepped.rds +REcosystem_Current_RK4_ForcedFRa_OutCatch_Jitter.rds +REcosystem_Current_RK4_ForcedFRa_OutCatch_Stepped.rds +REcosystem_Current_RK4_ForcedFRa_OutGearCatch_Jitter.rds +REcosystem_Current_RK4_ForcedFRa_OutGearCatch_Stepped.rds +REcosystem_Current_RK4_ForcedMig_OutBiomass_Jitter.rds +REcosystem_Current_RK4_ForcedMig_OutBiomass_Stepped.rds +REcosystem_Current_RK4_ForcedMig_OutCatch_Jitter.rds +REcosystem_Current_RK4_ForcedMig_OutCatch_Stepped.rds +REcosystem_Current_RK4_ForcedMig_OutGearCatch_Jitter.rds +REcosystem_Current_RK4_ForcedMig_OutGearCatch_Stepped.rds +REcosystem_Current_RK4_OutBiomass.rds +REcosystem_Current_RK4_OutCatch.rds +REcosystem_Current_RK4_OutGearCatch.rds +REcosystem_Current_RpathObj_Summary.rds +REcosystem_Current_RpathObj_TopLevel.rds +REcosystem_Current_AB_ForcedFRa_OutCatch_Jitter.rds +REcosystem_Current_AB_ForcedFRa_OutCatch_Stepped.rds +REcosystem_Current_AB_ForcedFRa_OutGearCatch_Jitter.rds +REcosystem_Current_AB_ForcedFRa_OutGearCatch_Stepped.rds +REcosystem_Current_AB_ForcedMig_OutBiomass_Jitter.rds +REcosystem_Current_AB_ForcedMig_OutBiomass_Stepped.rds +REcosystem_Current_AB_ForcedMig_OutCatch_Jitter.rds +REcosystem_Current_AB_ForcedMig_OutCatch_Stepped.rds +REcosystem_Current_AB_ForcedMig_OutGearCatch_Jitter.rds +REcosystem_Current_AB_ForcedMig_OutGearCatch_Stepped.rds +REcosystem_Current_AB_OutBiomass.rds +REcosystem_Current_AB_OutCatch.rds +REcosystem_Current_AB_OutGearCatch.rds +REcosystem_Current_RK4_ForcedBio_OutBiomass_Jitter.rds +REcosystem_Current_RK4_ForcedBio_OutBiomass_Stepped.rds +REcosystem_Current_RK4_ForcedBio_OutCatch_Jitter.rds +REcosystem_Current_RK4_ForcedBio_OutCatch_Stepped.rds +REcosystem_Current_RK4_ForcedBio_OutGearCatch_Jitter.rds +REcosystem_Current_RK4_ForcedBio_OutGearCatch_Stepped.rds +REcosystem_Current_RK4_ForcedCat_OutBiomass_Jitter.rds +REcosystem_Current_RK4_ForcedCat_OutBiomass_Stepped.rds +REcosystem_Current_RK4_ForcedCat_OutCatch_Jitter.rds +REcosystem_Current_RK4_ForcedCat_OutCatch_Stepped.rds +REcosystem_Current_RK4_ForcedCat_OutGearCatch_Jitter.rds +REcosystem_Current_AB_ForcedBio_OutBiomass_Jitter.rds diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB.csv b/tests/testthat/data/input/REcosystem_Baseline_AB.csv new file mode 100644 index 00000000..908f371e --- /dev/null +++ b/tests/testthat/data/input/REcosystem_Baseline_AB.csv @@ -0,0 +1,27 @@ +"","Group","StartBio","EndBio","BioES","StartCatch","EndCatch","CatchES" +"Outside","Outside",1,1,1,0,0,NA +"Seabirds","Seabirds",0.0149,0.0149000421028323,1.00000282569344,1e-05,1.00000282111218e-05,1.00000282111218 +"Whales","Whales",0.454,0.454000210323487,1.00000046326759,1e-07,1.00000046237396e-07,1.00000046237396 +"Seals","Seals",0.0249999999999768,0.0250002188221547,1.00000875288712,0.00200000000413891,0.00200001748905377,1.00000874245741 +"JuvRoundfish1","JuvRoundfish1",0.130430485118969,0.130433508003186,1.00002317620926,0.003,0.00300006953210249,1.0000231773675 +"AduRoundfish1","AduRoundfish1",1.39,1.39005295588256,1.00003809775723,0.145000203632079,0.145005524262072,1.00003669394842 +"JuvRoundfish2","JuvRoundfish2",1.23260830921837,1.23259936869507,0.999992746663134,0.003,0.00299997823997373,0.999992746657911 +"AduRoundfish2","AduRoundfish2",5.553,5.55298124848836,0.999996623174565,0.389000250489473,0.388998687520253,0.999995982086855 +"JuvFlatfish1","JuvFlatfish1",0.0698844163992366,0.069886978091586,1.00003665613139,0.00199999999999999,0.00200007328635009,1.00003664317505 +"AduFlatfish1","AduFlatfish1",5.766,5.7663115410512,1.00005403070607,0.180000208050261,0.18000972133386,1.00005285151446 +"JuvFlatfish2","JuvFlatfish2",0.0962887696620608,0.0962884894227813,0.999997089595386,0.002,0.00199999420098716,0.999997100493582 +"AduFlatfish2","AduFlatfish2",0.739,0.739000130647185,1.00000017678915,0.0700000310249589,0.0700000137421689,0.99999975310311 +"OtherGroundfish","OtherGroundfish",7.4,7.39994608057543,0.999992713591274,0.379999997272581,0.379997231062158,0.999992720498835 +"Foragefish1","Foragefish1",5.1,5.09999811993404,0.999999631359616,0.350999998399263,0.350999870540218,0.999999635729215 +"Foragefish2","Foragefish2",4.7,4.70000128223247,1.00000027281542,0.0909999995496744,0.091000024798586,1.00000027746057 +"OtherForagefish","OtherForagefish",5.1,5.09999705474727,0.999999422499466,0.0309999997462498,0.0309999820895149,0.9999994304279 +"Megabenthos","Megabenthos",19.7653839645524,19.7653695454297,0.999999270486081,0.189999999090599,0.189999861429517,0.99999927546799 +"Shellfish","Shellfish",7,7.00000501432484,1.00000071633212,0.509999999758437,0.51000036523584,1.00000071662236 +"Macrobenthos","Macrobenthos",17.4,17.3999776424533,0.999998715083521,9.99999987659068e-05,9.99998715476867e-05,0.999998727817784 +"Zooplankton","Zooplankton",23,23.000000629589,1.00000002737344,0,0,NA +"Phytoplankton","Phytoplankton",10,9.99999972809651,0.999999972809651,0,0,NA +"Detritus","Detritus",3636.66711075279,3636.66738830137,1.00000007631949,0,0,NA +"Discards","Discards",1.2182202,1.21823092208953,1.00000880143798,0,0,NA +"Trawlers","Trawlers",0,0,NA,0,0,NA +"Midwater","Midwater",0,0,NA,0,0,NA +"Dredgers","Dredgers",0,0,NA,0,0,NA diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutBiomass_Jitter.rds new file mode 100644 index 00000000..c3232e56 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutBiomass_Stepped.rds new file mode 100644 index 00000000..c2f0dfa1 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutCatch_Jitter.rds new file mode 100644 index 00000000..7cbcfe77 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutCatch_Stepped.rds new file mode 100644 index 00000000..84756ce0 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..37036843 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..84574681 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutBiomass_Jitter.rds new file mode 100644 index 00000000..913c3d95 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutBiomass_Stepped.rds new file mode 100644 index 00000000..056fe9a5 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutCatch_Jitter.rds new file mode 100644 index 00000000..bf561be6 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutCatch_Stepped.rds new file mode 100644 index 00000000..efaa9287 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..33649d9e Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..827f6819 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutBiomass_Jitter.rds new file mode 100644 index 00000000..5544ad09 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped.rds new file mode 100644 index 00000000..8280adef Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutCatch_Jitter.rds new file mode 100644 index 00000000..98d55340 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped.rds new file mode 100644 index 00000000..d6f4fc6f Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..02a83f48 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..154328b2 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Jitter.rds new file mode 100644 index 00000000..c0b288a5 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Stepped.rds new file mode 100644 index 00000000..056fe9a5 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutCatch_Jitter.rds new file mode 100644 index 00000000..4dcf7d94 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutCatch_Stepped.rds new file mode 100644 index 00000000..efaa9287 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..eb295a34 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..827f6819 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutBiomass_Jitter.rds new file mode 100644 index 00000000..ea49d452 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutBiomass_Stepped.rds new file mode 100644 index 00000000..d9c5a5ab Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutCatch_Jitter.rds new file mode 100644 index 00000000..6e261c06 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutCatch_Stepped.rds new file mode 100644 index 00000000..f718236e Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..047b8b02 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..1be2f8ad Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_OutBiomass.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_OutBiomass.rds new file mode 100644 index 00000000..056fe9a5 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_OutBiomass.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_OutCatch.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_OutCatch.rds new file mode 100644 index 00000000..efaa9287 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_OutCatch.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_AB_OutGearCatch.rds b/tests/testthat/data/input/REcosystem_Baseline_AB_OutGearCatch.rds new file mode 100644 index 00000000..827f6819 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_AB_OutGearCatch.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4.csv b/tests/testthat/data/input/REcosystem_Baseline_RK4.csv new file mode 100644 index 00000000..80ac236c --- /dev/null +++ b/tests/testthat/data/input/REcosystem_Baseline_RK4.csv @@ -0,0 +1,27 @@ +"","Group","StartBio","EndBio","BioES","StartCatch","EndCatch","CatchES" +"Outside","Outside",1,1,1,0,0,NA +"Seabirds","Seabirds",0.0149,0.0149000414705204,1.0000027832564,9.99999999999475e-06,1.00000277870874e-05,1.00000277870926 +"Whales","Whales",0.454,0.454000203549876,1.00000044834774,9.99999999999199e-08,1.00000044748892e-07,1.00000044748972 +"Seals","Seals",0.0249999999999768,0.0250002151253278,1.00000860501404,0.00200000000272359,0.00200001719370312,1.00000859548975 +"JuvRoundfish1","JuvRoundfish1",0.130430485118969,0.130433509907425,1.00002319080891,0.00299999999941577,0.00300006722470225,1.00002240842883 +"AduRoundfish1","AduRoundfish1",1.39,1.39005296991359,1.00003810785151,0.145000201253226,0.145005476873002,1.00003638353416 +"JuvRoundfish2","JuvRoundfish2",1.23260830921836,1.23259937159164,0.999992749013083,0.00299999999971644,0.00299997893978355,0.999992980022369 +"AduRoundfish2","AduRoundfish2",5.553,5.55298128970031,0.999996630596131,0.389000247694946,0.38899868773676,0.999995989827268 +"JuvFlatfish1","JuvFlatfish1",0.0698844163992366,0.0698869785490991,1.0000366626781,0.00199999999751021,0.00200007140577219,1.00003570413104 +"AduFlatfish1","AduFlatfish1",5.766,5.76631158759191,1.00005403877765,0.180000206280042,0.180009663891871,1.00005254222773 +"JuvFlatfish2","JuvFlatfish2",0.0962887696620608,0.0962884904713736,0.999997100485466,0.00199999999817096,0.00199999422811608,0.999997114972557 +"AduFlatfish2","AduFlatfish2",0.739000000000001,0.73900014211518,1.00000019230741,0.070000030823538,0.0700000121018677,0.999999732547685 +"OtherGroundfish","OtherGroundfish",7.4,7.39994606118274,0.999992710970641,0.37999999816591,0.379997230076929,0.999992715555277 +"Foragefish1","Foragefish1",5.1,5.09999812442395,0.999999632239989,0.3509999989451,0.350999870850303,0.999999635057559 +"Foragefish2","Foragefish2",4.7,4.70000128354904,1.00000027309554,0.0909999997037419,0.0910000248242102,1.0000002760491 +"OtherForagefish","OtherForagefish",5.1,5.09999704663009,0.999999420907861,0.0309999998356158,0.0309999820405005,0.999999425964018 +"Megabenthos","Megabenthos",19.7653839645524,19.7653694849667,0.99999926742705,0.189999999383839,0.189999860847279,0.999999270860211 +"Shellfish","Shellfish",7,7.00000502602804,1.00000071800401,0.509999999875786,0.510000366087145,1.00000071806149 +"Macrobenthos","Macrobenthos",17.4,17.3999776323995,0.999998714505716,9.99999992742293e-05,9.9999871489169e-05,0.999998722149387 +"Zooplankton","Zooplankton",23,23.000000626978,1.00000002725991,0,0,NA +"Phytoplankton","Phytoplankton",10,9.99999972903497,0.999999972903497,0,0,NA +"Detritus","Detritus",3636.66711075279,3636.66738627725,1.0000000757629,0,0,NA +"Discards","Discards",1.2182202,1.21823082510862,1.00000872182929,0,0,NA +"Trawlers","Trawlers",0,0,NA,0,0,NA +"Midwater","Midwater",0,0,NA,0,0,NA +"Dredgers","Dredgers",0,0,NA,0,0,NA diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Jitter.rds new file mode 100644 index 00000000..91bf00e9 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Stepped.rds new file mode 100644 index 00000000..e23bcdcb Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutCatch_Jitter.rds new file mode 100644 index 00000000..e3a1f831 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutCatch_Stepped.rds new file mode 100644 index 00000000..b475dbb7 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..d7a3f087 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..0e6ca28a Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Jitter.rds new file mode 100644 index 00000000..84504bb3 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Stepped.rds new file mode 100644 index 00000000..a535f406 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutCatch_Jitter.rds new file mode 100644 index 00000000..fb13cce3 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutCatch_Stepped.rds new file mode 100644 index 00000000..2f75f630 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..59d35cf8 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..ebdcfd73 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Jitter.rds new file mode 100644 index 00000000..1aae2685 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped.rds new file mode 100644 index 00000000..566d64be Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutCatch_Jitter.rds new file mode 100644 index 00000000..cbf302fb Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped.rds new file mode 100644 index 00000000..9bffd6a9 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..85c9e274 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..9b1a4ec8 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Jitter.rds new file mode 100644 index 00000000..6861b470 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Stepped.rds new file mode 100644 index 00000000..a535f406 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Jitter.rds new file mode 100644 index 00000000..b671ce1e Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Stepped.rds new file mode 100644 index 00000000..2f75f630 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..5b440c71 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..ebdcfd73 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Jitter.rds new file mode 100644 index 00000000..a15792b0 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Stepped.rds new file mode 100644 index 00000000..89ee936b Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutCatch_Jitter.rds new file mode 100644 index 00000000..a7c2e9a9 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutCatch_Stepped.rds new file mode 100644 index 00000000..31bd8dea Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Jitter.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Jitter.rds new file mode 100644 index 00000000..2599f7fc Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Jitter.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Stepped.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Stepped.rds new file mode 100644 index 00000000..60e33b07 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Stepped.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_OutBiomass.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_OutBiomass.rds new file mode 100644 index 00000000..a535f406 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_OutBiomass.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_OutCatch.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_OutCatch.rds new file mode 100644 index 00000000..2f75f630 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_OutCatch.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RK4_OutGearCatch.rds b/tests/testthat/data/input/REcosystem_Baseline_RK4_OutGearCatch.rds new file mode 100644 index 00000000..ebdcfd73 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RK4_OutGearCatch.rds differ diff --git a/tests/testthat/data/input/REcosystem_Baseline_RpathObj_Summary.rds b/tests/testthat/data/input/REcosystem_Baseline_RpathObj_Summary.rds new file mode 100644 index 00000000..b6396ec1 --- /dev/null +++ b/tests/testthat/data/input/REcosystem_Baseline_RpathObj_Summary.rds @@ -0,0 +1,13 @@ +Rpath model: R Ecosystem + Status: Balanced + +Summary Statistics: + NumGroups NumLiving NumDetritus NumFleets TotBiomass TotLandings +1 25 20 2 3 104.9365 1.74 + +Rpath model also includes: + [1] "NUM_GROUPS" "NUM_LIVING" "NUM_DEAD" "NUM_GEARS" "Group" + [6] "type" "TL" "Biomass" "PB" "QB" +[11] "EE" "BA" "Unassim" "GE" "DC" +[16] "DetFate" "Landings" "Discards" +NUM_GROUPS NUM_LIVING NUM_DEAD NUM_GEARS Group type TL Biomass PB QB EE BA Unassim GE DC DetFate Landings Discards \ No newline at end of file diff --git a/tests/testthat/data/input/REcosystem_Baseline_RpathObj_TopLevel.rds b/tests/testthat/data/input/REcosystem_Baseline_RpathObj_TopLevel.rds new file mode 100644 index 00000000..5ae015c6 Binary files /dev/null and b/tests/testthat/data/input/REcosystem_Baseline_RpathObj_TopLevel.rds differ diff --git a/tests/testthat/test-constants.R b/tests/testthat/test-constants.R new file mode 100644 index 00000000..7d0cbdbc --- /dev/null +++ b/tests/testthat/test-constants.R @@ -0,0 +1,30 @@ +# ---- Modify this toggle to TRUE to generate the baseline files. ---- +# ---- Reset it back to FALSE to run the tests. ---------------------- +# CREATE_BASELINE_FILES <- TRUE +CREATE_BASELINE_FILES <- FALSE + +NUMBER_OF_STEPS <- 5 # should be an odd multiple of nrows=600 (i.e., 5,15,30) +FACTOR_VALUE <- 5 +SEED_VALUE <- 7 +TOLERANCE_VALUE <- 1e-5 +RUN_QUIET <- TRUE +YLIMIT_DIFFERENCE_PLOTS <- 0.05 +FORCED_MIGRATION_SCALE_FACTOR_JITTER <- 1000 +FORCED_MIGRATION_SCALE_FACTOR_STEPIFY <- 100 +PLOT_TYPE <- 1 # 1 = Baseline and Current superimposed, 2 = difference of (Current-Baseline) +PLOT_SHOW <- 1 # 1 - All Plots, 2 = Only plots reflecting test errors # Not sure if can be implemented +# INPUT_DATA_DIR_BASELINE <- 'data/input/baseline' +INPUT_DATA_DIR_CURRENT <- here::here('tests/testthat/data/input') +INPUT_DATA_DIR_BASELINE <- INPUT_DATA_DIR_CURRENT +OUTPUT_DATA_DIR <- here::here('tests/testthat/data/output') +FORCED_BIOMASS <- "Forced Bio" +FORCED_MIGRATION <- "Forced Migrate" +FORCED_EFFORT <- "Forced Effort" +FORCED_FRATE <- 'Forced FRate' +FORCED_CATCH <- 'Forced Catch' +JITTERED <- "Jittered" +STEPPED <- "Stepped" +JITTER_AMOUNT_PCT <- 0.01 # This is 1% jitter +FORCED_MIGRATION_BIOMASS_PCT <- 0.1 # This is a 10% jitter for the initial value +POSITIVE_ONLY <- TRUE +POSITIVE_AND_NEGATIVE <- FALSE diff --git a/tests/testthat/test-rpath.R b/tests/testthat/test-rpath.R new file mode 100644 index 00000000..ccc13fa9 --- /dev/null +++ b/tests/testthat/test-rpath.R @@ -0,0 +1,867 @@ +library(Rpath) +library(qpdf) +library(testthat) +library(stringr) +library(distillery) +library(ggplot2) +library(ggpubr) +library(rlist) + +options(precision=50) + +source("test-constants.R") +source("test-utils.R") +source("test-utils-stepify.R") +source("test-utils-jitter.R") +source("test-utils-plot.R") + +print(paste0("here::here: ", here::here() )) +print(paste0("OUTPUT_DATA_DIR: ", OUTPUT_DATA_DIR)) #RSK +print(paste0("INPUT_DATA_DIR_BASELINE: ", INPUT_DATA_DIR_BASELINE)) #RSK +print(paste0("INPUT_DATA_DIR_CURRENT: ", INPUT_DATA_DIR_CURRENT)) #RSK + +# Set the seed here so that all runs will be deterministic. +set.seed(SEED_VALUE) + +# Create the current and output directories if they don't already exist. +if (! dir.exists(INPUT_DATA_DIR_CURRENT)) { + dir.create(INPUT_DATA_DIR_CURRENT,recursive=TRUE) +} +if (! dir.exists(OUTPUT_DATA_DIR)) { + dir.create(OUTPUT_DATA_DIR,recursive=TRUE) +} + +#' This test tests for equality between two objects +#' +#' This function tests to see if the two data tables are equal within a tolerance value +#' +#' @param runNum : The run number +#' @param tableName : Temp arg, used to skip over out_Gear_Catch tables as there's currently a bug with their header names +#' @param desc : The description of the run +#' @param baselineTable : The baseline table +#' @param currentTable : The current generated table +#' +#' @return No return value +#' +runTestEqual <- function(runNum,tableName,desc,baselineTable,currentTable) { + if (tableName == 'out_Gear_Catch') { + if (! RUN_QUIET) { + print('Test Skipped: The out_Gear_Catch tables are currently missing column headings...so this test will be skipped for now.') + } + return() + } + paddedRunNum <- str_pad(runNum,3,pad="0") + if (! RUN_QUIET) { + print(paste0("Test #",paddedRunNum,": ",desc)) + } + testthat::expect_equal(baselineTable,currentTable,tolerance=TOLERANCE_VALUE) +} + +#' The test for running silent test function +#' +#' This function tests to see if the current Rpath run runs silently +#' +#' @param runNum : The run number +#' @param desc : The description of the run +#' @param params : Parameters associated with, and passed to, the Rpath run +#' @param name : The ecosystem name of the run that's passed to Rpath +#' +#' @return No return value +#' +runTestSilent <- function(runNum,desc,params,name) { + paddedRunNum <- str_pad(runNum,3,pad="0") + if (! RUN_QUIET) { + print(paste0("Test #",paddedRunNum,": ",desc)) + } + testthat::expect_silent(rpath(params,eco.name=name)) +} + +#' The main test run function +#' +#' This function prints the appropriate baseline and current forced data and then runs the testthat::expect_equal test. +#' +#' @param tableName : Name of output table to plot (i.e., out_Biomass, out_Catch) +#' @param forcedData : The data that's being forced (i.e., Biomass, Catch) +#' @param forcedType : The type of forcing being done (.e., Random (Jitter) or Stepped) +#' @param baseAlg : The baseline algorithm used (currently AB or RK4) +#' @param currAlg : The current algorithm used (currently AB or RK4) +#' @param baselineTable : table that represents the baseline run's data +#' @param currentDataFrame : The data frame that contains the current run's data +#' @param currentFilename : The name of the file that contains the current run's data +#' @param species : A vector of fish species +#' +#' @return No return value +#' +runTestRDS <- function(runNum,tableName,forcedData,forcedType,baseAlg,currAlg,baselineDataFrame,currentFilename,species) { + + # N.B. Remove this if statement once missing column headings issue is fixed + if (tableName == 'out_Gear_Catch') { + if (! RUN_QUIET) { + print('Test Skipped: The out_Gear_Catch tables are currently missing column headings...so this test will be skipped for now.') + } + return() + } + + paddedRunNum <- str_pad(runNum,3,pad="0") + if (! RUN_QUIET) { + print(paste0("Test #",paddedRunNum,": Is Baseline ",baseAlg," ",tableName," equivalent to Current ",currAlg," ",tableName," using ",forcedType," ",forcedData,"?")) + } + + currentDataFrame <- readDataFile(currentFilename) + + if (tableName == 'out_Biomass' || tableName == 'out_Catch') { # || tableName == 'out_Gear_Catch') { + if (PLOT_TYPE == 1) { + plotResultsSuperimposed(baselineDataFrame, currentDataFrame, baseAlg, currAlg, tableName, forcedData, forcedType, species) + } else { + plotResultsDifference(baselineDataFrame, currentDataFrame, baseAlg, currAlg, tableName, forcedData, forcedType, species) + } + } + + # Write out the difference table (current-baseline) + # diffTable <- abs(currentDataFrame-baselineDataFrame) + # diffTable <- currentDataFrame + numRows <- nrow(currentDataFrame) + numCols <- ncol(currentDataFrame) + diffTable <- matrix(nrow=numRows,ncol=numCols) + # diffTable[TRUE] <- 0 + for (i in 1:nrow(currentDataFrame)) { + for (j in 1:ncol(currentDataFrame)) { + diffTable[i,j] <- abs(currentDataFrame[i,j] - baselineDataFrame[i,j]) + if (diffTable[i,j] <= TOLERANCE_VALUE) { + diffTable[i,j] <- 0 + } + # else { + # print(paste0("-> diffTable[",i,",",j,"]: ",diffTable[i,j])) + # } + } + } + + # Set all values <= TOLERANCE_VALUE to 0 because we're going to next compare this to a zero table + # diffTable[diffTable <= TOLERANCE_VALUE] <- 0 + + # Create the zero table + zeroTable <- matrix(0,nrow=numRows,ncol=numCols) + + sumDiffTable <- 0 + sumColsCurr = colSums(currentDataFrame) + sumColsBase = colSums(baselineDataFrame) + for (i in 1:ncol(currentDataFrame)) { + sumDiffTable <- sumDiffTable + abs(sumColsCurr[i]-sumColsBase[i]) + } +#print(paste0("***sumDiffTable: ",sumDiffTable)) +#print(paste0("SUM of currentDataFrame: ", sum(currentDataFrame))) # ok +#print(paste0("SUM of baselineDataFrame: ", sum(baselineDataFrame))) # ok +#print("Comparing if sumDiffTable/sum(currentDataFrame) <= TOLERANCE_VALUE") +#print(paste0("Is ",sumDiffTable,"/",sum(currentDataFrame)," <= ",TOLERANCE_VALUE," ?")) +areIdentical <- (sumDiffTable/ sum(currentDataFrame) <= TOLERANCE_VALUE) +#print(paste0("areIdentical: ",areIdentical)) + +# print(paste0("SUM of currentDataFrame: ", sum(currentDataFrame))) # ok +# print(paste0("SUM of baselineDataFrame: ",sum(baselineDataFrame))) # ok +#print(paste0("SUM of diffTable: ",sum(diffTable))) # not ok +#print(paste0("SUM of zeroTable: ",sum(zeroTable))) # ok +# print(paste0("Col sums currentDataFrame: ",colSums(currentDataFrame))) # ok +# print(paste0("Col sums baselineDataFrame: ",colSums(baselineDataFrame))) # ok +#print(paste0("Col sums diffTable: ",colSums(diffTable))) # not ok +# print(paste0("Sum currentDataFrame col=17: ", sum(currentDataFrame[,17]))) # ok +# print(paste0("Sum baselineDataFrame col=17: ", sum(baselineDataFrame[,17]))) # ok +#print(paste0("Sum diffTable col=17: ", sum(diffTable[,17]))) # not ok +# areIdentical <- identical(diffTable,zeroTable) # not ok +#print(paste0("*** Are they identical diffTable and zeroTable: ",identical(diffTable,zeroTable))) + + testthat::expect_true(areIdentical) + + write.table(diffTable, file=file.path(OUTPUT_DATA_DIR,paste0("diff_",paddedRunNum,".dat"))) + write.table(zeroTable, file=file.path(OUTPUT_DATA_DIR,paste0("zero_",paddedRunNum,".dat"))) +} + + +testthat::test_that("Rpath Unit Tests", { + BaselineJitterTables <- list() + BaselineJitterFiles <- list() + CurrentJitterFiles <- list() + BaselineSteppedTables <- list() + BaselineSteppedFiles <- list() + CurrentSteppedFiles <- list() + fleets <- c('Trawlers','Midwater','Dredgers') + species <- c('OtherGroundfish','Megabenthos','Seals','JuvRoundfish1','AduRoundfish1') + modNum <- 1 + runNum <- 0 + + # ---------- Set up initial file paths ---------- + # N.B. The Baseline and Current AB and RK4 files are .csv files since they were produced by + # the write.rsim() function and not the more generic write.table() function. + BaselineRpathObjTopLevel <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RpathObj_TopLevel.rds') + BaselineRpathObjSummary <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RpathObj_Summary.rds') + BaselineAB <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB.csv') + BaselineRK4 <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4.csv') + BaselineABOutBiomass <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_OutBiomass.rds') + BaselineRK4OutBiomass <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_OutBiomass.rds') + BaselineABOutCatch <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_OutCatch.rds') + BaselineRK4OutCatch <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_OutCatch.rds') + BaselineABOutGearCatch <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_OutGearCatch.rds') + BaselineRK4OutGearCatch <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_OutGearCatch.rds') + BaselineABForcedBioOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedBio_OutBiomass_Stepped.rds') + BaselineRK4ForcedBioOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Stepped.rds') + BaselineABForcedBioOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedBio_OutCatch_Stepped.rds') + BaselineRK4ForcedBioOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedBio_OutCatch_Stepped.rds') + BaselineABForcedBioOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Stepped.rds') + BaselineRK4ForcedBioOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Stepped.rds') + BaselineABForcedBioOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedBio_OutBiomass_Jitter.rds') + BaselineRK4ForcedBioOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Jitter.rds') + BaselineABForcedBioOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedBio_OutCatch_Jitter.rds') + BaselineRK4ForcedBioOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedBio_OutCatch_Jitter.rds') + BaselineABForcedBioOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Jitter.rds') + BaselineRK4ForcedBioOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Jitter.rds') + BaselineABForcedMigOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedMig_OutBiomass_Stepped.rds') + BaselineRK4ForcedMigOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Stepped.rds') + BaselineABForcedMigOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedMig_OutCatch_Stepped.rds') + BaselineRK4ForcedMigOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedMig_OutCatch_Stepped.rds') + BaselineABForcedMigOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Stepped.rds') + BaselineRK4ForcedMigOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Stepped.rds') + BaselineABForcedMigOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedMig_OutBiomass_Jitter.rds') + BaselineRK4ForcedMigOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Jitter.rds') + BaselineABForcedMigOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedMig_OutCatch_Jitter.rds') + BaselineRK4ForcedMigOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedMig_OutCatch_Jitter.rds') + BaselineABForcedMigOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Jitter.rds') + BaselineRK4ForcedMigOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Jitter.rds') + BaselineABForcedEffOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped.rds') + BaselineABForcedEffOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped.rds') + BaselineABForcedEffOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped.rds') + BaselineABForcedEffOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedEff_OutBiomass_Jitter.rds') + BaselineABForcedEffOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedEff_OutCatch_Jitter.rds') + BaselineABForcedEffOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Jitter.rds') + BaselineABForcedFRaOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Stepped.rds') + BaselineABForcedFRaOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedFRa_OutCatch_Stepped.rds') + BaselineABForcedFRaOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Stepped.rds') + BaselineABForcedFRaOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Jitter.rds') + BaselineABForcedFRaOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedFRa_OutCatch_Jitter.rds') + BaselineABForcedFRaOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Jitter.rds') + BaselineABForcedCatOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedCat_OutBiomass_Stepped.rds') + BaselineABForcedCatOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedCat_OutCatch_Stepped.rds') + BaselineABForcedCatOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Stepped.rds') + BaselineABForcedCatOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedCat_OutBiomass_Jitter.rds') + BaselineABForcedCatOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedCat_OutCatch_Jitter.rds') + BaselineABForcedCatOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Jitter.rds') + BaselineRK4ForcedEffOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped.rds') + BaselineRK4ForcedEffOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped.rds') + BaselineRK4ForcedEffOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped.rds') + BaselineRK4ForcedEffOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Jitter.rds') + BaselineRK4ForcedEffOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedEff_OutCatch_Jitter.rds') + BaselineRK4ForcedEffOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Jitter.rds') + BaselineRK4ForcedFRaOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Stepped.rds') + BaselineRK4ForcedFRaOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Stepped.rds') + BaselineRK4ForcedFRaOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Stepped.rds') + BaselineRK4ForcedFRaOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Jitter.rds') + BaselineRK4ForcedFRaOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Jitter.rds') + BaselineRK4ForcedFRaOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Jitter.rds') + BaselineRK4ForcedCatOutBiomassStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Stepped.rds') + BaselineRK4ForcedCatOutCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedCat_OutCatch_Stepped.rds') + BaselineRK4ForcedCatOutGearCatchStepped <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Stepped.rds') + BaselineRK4ForcedCatOutBiomassJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Jitter.rds') + BaselineRK4ForcedCatOutCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedCat_OutCatch_Jitter.rds') + BaselineRK4ForcedCatOutGearCatchJitter <- file.path(INPUT_DATA_DIR_BASELINE,'REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Jitter.rds') + # + CurrentRpathObjTopLevel <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RpathObj_TopLevel.rds') + CurrentRpathObjSummary <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RpathObj_Summary.rds') + CurrentAB <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB.csv') + CurrentRK4 <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4.csv') + CurrentABOutBiomass <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_OutBiomass.rds') + CurrentRK4OutBiomass <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_OutBiomass.rds') + CurrentABOutCatch <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_OutCatch.rds') + CurrentRK4OutCatch <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_OutCatch.rds') + CurrentABOutGearCatch <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_OutGearCatch.rds') + CurrentRK4OutGearCatch <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_OutGearCatch.rds') + CurrentABForcedBioOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedBio_OutBiomass_Stepped.rds') + CurrentRK4ForcedBioOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedBio_OutBiomass_Stepped.rds') + CurrentABForcedBioOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedBio_OutCatch_Stepped.rds') + CurrentRK4ForcedBioOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedBio_OutCatch_Stepped.rds') + CurrentABForcedBioOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedBio_OutGearCatch_Stepped.rds') + CurrentRK4ForcedBioOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedBio_OutGearCatch_Stepped.rds') + CurrentABForcedBioOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedBio_OutBiomass_Jitter.rds') + CurrentABForcedBioOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedBio_OutCatch_Jitter.rds') + CurrentABForcedBioOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedBio_OutGearCatch_Jitter.rds') + CurrentRK4ForcedBioOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedBio_OutBiomass_Jitter.rds') + CurrentRK4ForcedBioOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedBio_OutCatch_Jitter.rds') + CurrentRK4ForcedBioOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedBio_OutGearCatch_Jitter.rds') + CurrentABForcedMigOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedMig_OutBiomass_Stepped.rds') + CurrentRK4ForcedMigOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedMig_OutBiomass_Stepped.rds') + CurrentABForcedMigOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedMig_OutCatch_Stepped.rds') + CurrentRK4ForcedMigOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedMig_OutCatch_Stepped.rds') + CurrentABForcedMigOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedMig_OutGearCatch_Stepped.rds') + CurrentRK4ForcedMigOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedMig_OutGearCatch_Stepped.rds') + CurrentABForcedMigOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedMig_OutBiomass_Jitter.rds') + CurrentABForcedMigOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedMig_OutCatch_Jitter.rds') + CurrentABForcedMigOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedMig_OutGearCatch_Jitter.rds') + CurrentRK4ForcedMigOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedMig_OutBiomass_Jitter.rds') + CurrentRK4ForcedMigOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedMig_OutCatch_Jitter.rds') + CurrentRK4ForcedMigOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedMig_OutGearCatch_Jitter.rds') + CurrentABForcedEffOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedEff_OutBiomass_Stepped.rds') + CurrentRK4ForcedEffOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedEff_OutBiomass_Stepped.rds') + CurrentABForcedEffOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedEff_OutCatch_Stepped.rds') + CurrentRK4ForcedEffOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedEff_OutCatch_Stepped.rds') + CurrentABForcedEffOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedEff_OutGearCatch_Stepped.rds') + CurrentRK4ForcedEffOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedEff_OutGearCatch_Stepped.rds') + CurrentABForcedFRaOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedFRa_OutBiomass_Stepped.rds') + CurrentRK4ForcedFRaOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedFRa_OutBiomass_Stepped.rds') + CurrentABForcedFRaOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedFRa_OutCatch_Stepped.rds') + CurrentRK4ForcedFRaOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedFRa_OutCatch_Stepped.rds') + CurrentABForcedFRaOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedFRa_OutGearCatch_Stepped.rds') + CurrentRK4ForcedFRaOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedFRa_OutGearCatch_Stepped.rds') + CurrentABForcedCatOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedCat_OutBiomass_Stepped.rds') + CurrentRK4ForcedCatOutBiomassStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedCat_OutBiomass_Stepped.rds') + CurrentABForcedCatOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedCat_OutCatch_Stepped.rds') + CurrentRK4ForcedCatOutCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedCat_OutCatch_Stepped.rds') + CurrentABForcedCatOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedCat_OutGearCatch_Stepped.rds') + CurrentRK4ForcedCatOutGearCatchStepped <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedCat_OutGearCatch_Stepped.rds') + CurrentABForcedEffOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedEff_OutBiomass_Jitter.rds') + CurrentABForcedEffOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedEff_OutCatch_Jitter.rds') + CurrentABForcedEffOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedEff_OutGearCatch_Jitter.rds') + CurrentRK4ForcedEffOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedEff_OutBiomass_Jitter.rds') + CurrentRK4ForcedEffOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedEff_OutCatch_Jitter.rds') + CurrentRK4ForcedEffOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedEff_OutGearCatch_Jitter.rds') + CurrentABForcedFRaOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedFRa_OutBiomass_Jitter.rds') + CurrentABForcedFRaOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedFRa_OutCatch_Jitter.rds') + CurrentABForcedFRaOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedFRa_OutGearCatch_Jitter.rds') + CurrentRK4ForcedFRaOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedFRa_OutBiomass_Jitter.rds') + CurrentRK4ForcedFRaOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedFRa_OutCatch_Jitter.rds') + CurrentRK4ForcedFRaOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedFRa_OutGearCatch_Jitter.rds') + CurrentABForcedCatOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedCat_OutBiomass_Jitter.rds') + CurrentABForcedCatOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedCat_OutCatch_Jitter.rds') + CurrentABForcedCatOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_AB_ForcedCat_OutGearCatch_Jitter.rds') + CurrentRK4ForcedCatOutBiomassJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedCat_OutBiomass_Jitter.rds') + CurrentRK4ForcedCatOutCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedCat_OutCatch_Jitter.rds') + CurrentRK4ForcedCatOutGearCatchJitter <- file.path(INPUT_DATA_DIR_CURRENT,'REcosystem_Current_RK4_ForcedCat_OutGearCatch_Jitter.rds') + + # Initialize baseline and current paths + REcosystemBaseline <- NULL + REcosystemBaselineSummary <- NULL + REcosystem_Baseline_AB <- NULL + REcosystem_Baseline_RK4 <- NULL + REcosystem_Baseline_AB_OutBiomass <- NULL + REcosystem_Baseline_AB_OutCatch <- NULL + REcosystem_Baseline_AB_OutGearCatch <- NULL + REcosystem_Baseline_RK4_OutBiomass <- NULL + REcosystem_Baseline_RK4_OutCatch <- NULL + REcosystem_Baseline_RK4_OutGearCatch <- NULL + REcosystem_Baseline_AB_ForcedBio_OutBiomass_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Stepped <- NULL + REcosystem_Baseline_AB_ForcedBio_OutCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedBio_OutCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedBio_OutBiomass_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Jitter <- NULL + REcosystem_Baseline_AB_ForcedBio_OutCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedBio_OutCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedMig_OutBiomass_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Stepped <- NULL + REcosystem_Baseline_AB_ForcedMig_OutCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedMig_OutCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedMig_OutBiomass_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Jitter <- NULL + REcosystem_Baseline_AB_ForcedMig_OutCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedMig_OutCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped <- NULL + REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedEff_OutBiomass_Jitter <- NULL + REcosystem_Baseline_AB_ForcedEff_OutCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Jitter <- NULL + REcosystem_Baseline_AB_ForcedFRa_OutCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedCat_OutBiomass_Jitter <- NULL + REcosystem_Baseline_AB_ForcedCat_OutCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedCat_OutCatch_Jitter <- NULL + REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Jitter <- NULL + REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped <- NULL + REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Stepped <- NULL + REcosystem_Baseline_AB_ForcedFRa_OutCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedCat_OutBiomass_Stepped <- NULL + REcosystem_Baseline_AB_ForcedCat_OutCatch_Stepped <- NULL + REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedCat_OutCatch_Stepped <- NULL + REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Stepped <- NULL + if (! CREATE_BASELINE_FILES) { + REcosystemBaseline <- readDataFile(BaselineRpathObjTopLevel) #, fill = TRUE, sep = " ") + REcosystemBaselineSummary <- read.table(BaselineRpathObjSummary, fill = TRUE) + REcosystem_Baseline_AB <- read.csv(BaselineAB) + REcosystem_Baseline_RK4 <- read.csv(BaselineRK4) + REcosystem_Baseline_AB_OutBiomass <- readDataFile(BaselineABOutBiomass) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_OutCatch <- readDataFile(BaselineABOutCatch) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_OutGearCatch <- readDataFile(BaselineABOutGearCatch) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_OutBiomass <- readDataFile(BaselineRK4OutBiomass) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_OutCatch <- readDataFile(BaselineRK4OutCatch) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_OutGearCatch <- readDataFile(BaselineRK4OutGearCatch) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedBio_OutBiomass_Stepped <- readDataFile(BaselineABForcedBioOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Stepped <- readDataFile(BaselineRK4ForcedBioOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedBio_OutCatch_Stepped <- readDataFile(BaselineABForcedBioOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedBio_OutCatch_Stepped <- readDataFile(BaselineRK4ForcedBioOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Stepped <- readDataFile(BaselineABForcedBioOutGearCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Stepped <- readDataFile(BaselineRK4ForcedBioOutGearCatchStepped) #,fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedBio_OutBiomass_Jitter <- readDataFile(BaselineABForcedBioOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Jitter <- readDataFile(BaselineRK4ForcedBioOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedBio_OutCatch_Jitter <- readDataFile(BaselineABForcedBioOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedBio_OutCatch_Jitter <- readDataFile(BaselineRK4ForcedBioOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Jitter <- readDataFile(BaselineABForcedBioOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Jitter <- readDataFile(BaselineRK4ForcedBioOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedMig_OutBiomass_Stepped <- readDataFile(BaselineABForcedMigOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Stepped <- readDataFile(BaselineRK4ForcedMigOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedMig_OutCatch_Stepped <- readDataFile(BaselineABForcedMigOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedMig_OutCatch_Stepped <- readDataFile(BaselineRK4ForcedMigOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Stepped <- readDataFile(BaselineABForcedMigOutGearCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Stepped <- readDataFile(BaselineRK4ForcedMigOutGearCatchStepped) #,fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedMig_OutBiomass_Jitter <- readDataFile(BaselineABForcedMigOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Jitter <- readDataFile(BaselineRK4ForcedMigOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedMig_OutCatch_Jitter <- readDataFile(BaselineABForcedMigOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedMig_OutCatch_Jitter <- readDataFile(BaselineRK4ForcedMigOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Jitter <- readDataFile(BaselineABForcedMigOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Jitter <- readDataFile(BaselineRK4ForcedMigOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped <- readDataFile(BaselineABForcedEffOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped <- readDataFile(BaselineRK4ForcedEffOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped <- readDataFile(BaselineABForcedEffOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped <- readDataFile(BaselineRK4ForcedEffOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped <- readDataFile(BaselineABForcedEffOutGearCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped <- readDataFile(BaselineRK4ForcedEffOutGearCatchStepped) #,fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutBiomass_Jitter <- readDataFile(BaselineABForcedEffOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutCatch_Jitter <- readDataFile(BaselineABForcedEffOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Jitter <- readDataFile(BaselineABForcedEffOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Jitter <- readDataFile(BaselineRK4ForcedEffOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutCatch_Jitter <- readDataFile(BaselineRK4ForcedEffOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Jitter <- readDataFile(BaselineRK4ForcedEffOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Jitter <- readDataFile(BaselineABForcedFRaOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedFRa_OutCatch_Jitter <- readDataFile(BaselineABForcedFRaOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Jitter <- readDataFile(BaselineABForcedFRaOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Jitter <- readDataFile(BaselineRK4ForcedFRaOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Jitter <- readDataFile(BaselineRK4ForcedFRaOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Jitter <- readDataFile(BaselineRK4ForcedFRaOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedCat_OutBiomass_Jitter <- readDataFile(BaselineABForcedCatOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedCat_OutCatch_Jitter <- readDataFile(BaselineABForcedCatOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Jitter <- readDataFile(BaselineABForcedCatOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Jitter <- readDataFile(BaselineRK4ForcedCatOutBiomassJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedCat_OutCatch_Jitter <- readDataFile(BaselineRK4ForcedCatOutCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Jitter <- readDataFile(BaselineRK4ForcedCatOutGearCatchJitter) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped <- readDataFile(BaselineABForcedEffOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped <- readDataFile(BaselineABForcedEffOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped <- readDataFile(BaselineABForcedEffOutGearCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped <- readDataFile(BaselineRK4ForcedEffOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped <- readDataFile(BaselineRK4ForcedEffOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped <- readDataFile(BaselineRK4ForcedEffOutGearCatchStepped) #,fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Stepped <- readDataFile(BaselineABForcedFRaOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedFRa_OutCatch_Stepped <- readDataFile(BaselineABForcedFRaOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Stepped <- readDataFile(BaselineABForcedFRaOutGearCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Stepped <- readDataFile(BaselineRK4ForcedFRaOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Stepped <- readDataFile(BaselineRK4ForcedFRaOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Stepped <- readDataFile(BaselineRK4ForcedFRaOutGearCatchStepped) #,fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedCat_OutBiomass_Stepped <- readDataFile(BaselineABForcedCatOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedCat_OutCatch_Stepped <- readDataFile(BaselineABForcedCatOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Stepped <- readDataFile(BaselineABForcedCatOutGearCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Stepped <- readDataFile(BaselineRK4ForcedCatOutBiomassStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedCat_OutCatch_Stepped <- readDataFile(BaselineRK4ForcedCatOutCatchStepped) #, fill = TRUE, sep = " ") + REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Stepped <- readDataFile(BaselineRK4ForcedCatOutGearCatchStepped) #,fill = TRUE, sep = " ") + } + + # # + # # Save current Rpath run data + REco <- rpath(REco.params, eco.name = 'R Ecosystem') # an Rpath object + RpathObjTopLevel <- if (CREATE_BASELINE_FILES) BaselineRpathObjTopLevel else CurrentRpathObjTopLevel + writeDataFile(REco,RpathObjTopLevel) + # sink(RpathObjTopLevel) + # print(REco) + # sink() + + # Save current Rpath run summary data + RpathObjSummary <- if (CREATE_BASELINE_FILES) BaselineRpathObjSummary else CurrentRpathObjSummary + # writeDataFile(summary(REco),RpathObjSummary) + sink(RpathObjSummary) + cat(summary(REco)) + sink() + + # Save current Rpath sim run data for AB and RK4 + REcosystem_scenario <- rsim.scenario(REco, REco.params, 1:50) + REcosystem_Current_AB_from_Sim <- rsim.run(REcosystem_scenario,method='AB', years=1:50) + REcosystem_Current_RK4_from_Sim <- rsim.run(REcosystem_scenario,method='RK4',years=1:50) + if (CREATE_BASELINE_FILES) { + write.Rsim(REcosystem_Current_AB_from_Sim, BaselineAB) + write.Rsim(REcosystem_Current_RK4_from_Sim,BaselineRK4) + } else { + write.Rsim(REcosystem_Current_AB_from_Sim, CurrentAB) + write.Rsim(REcosystem_Current_RK4_from_Sim,CurrentRK4) + } + + # ------------------------------------------ + # ------------------------------------------ + # --------------- Run tests ---------------- + # ------------------------------------------ + # ------------------------------------------ + + print("------------------ Rpath Object Tests ------------------") + if (! CREATE_BASELINE_FILES) { + # Remove existing output data files + cwd <- getwd() + files <- dir(path=file.path(cwd,OUTPUT_DATA_DIR),pattern='diff_*') + file.remove(file.path(OUTPUT_DATA_DIR,files)) + files <- dir(path=file.path(cwd,OUTPUT_DATA_DIR),pattern='zero_*') + file.remove(file.path(OUTPUT_DATA_DIR,files)) + + # Test 1 - Test if Balanced (i.e., "Status: Balanced" is the 2nd line of the Summary file) + headerSummaryLines <- readLines(CurrentRpathObjSummary,n=2) + parts <- unlist(strsplit(str_trim(headerSummaryLines[2]),split=" ")) + runTestEqual(inc(runNum),"","Is model balanced?",parts[2],"Balanced") + + # Test 2 - Test if function runs silently (i.e., no messages, warnings, or print statements) + runTestSilent(inc(runNum),"Does model run without any terminal output (i.e., warnings, errors)?",REco.params,'R Ecosystem') + + # Test 3 - Test that the REcosystem object is the same as the saved original REcosystem object + REcosystemCurrent <- readDataFile(CurrentRpathObjTopLevel)#,fill = TRUE, sep = " ") + runTestEqual(inc(runNum),"","Is the baseline Rpath object equivalent to the current Rpath object (toplevel data)?",REcosystemBaseline,REcosystemCurrent) + + # Test 4 - Test that the REcosystem Summary is the same as the saved original REcosystem Summary + REcosystemSummaryCurrent <- read.table(CurrentRpathObjSummary,fill = TRUE) + runTestEqual(inc(runNum),"","Is the baseline Rpath run Summary the same as the current Rpath Summary?",REcosystemBaselineSummary,REcosystemSummaryCurrent) + + REcosystem_Current_AB <- read.csv(CurrentAB) + REcosystem_Current_RK4 <- read.csv(CurrentRK4) + } + + # Tests 5-16 - Test that REcosystem AB object is same as RK4 object with no perturbations + if (CREATE_BASELINE_FILES) { + writeDataFile(REcosystem_Current_AB_from_Sim$out_Biomass, BaselineABOutBiomass) + writeDataFile(REcosystem_Current_RK4_from_Sim$out_Biomass, BaselineRK4OutBiomass) + writeDataFile(REcosystem_Current_AB_from_Sim$out_Catch, BaselineABOutCatch) + writeDataFile(REcosystem_Current_RK4_from_Sim$out_Catch, BaselineRK4OutCatch) + writeDataFile(REcosystem_Current_AB_from_Sim$out_Gear_Catch, BaselineABOutGearCatch) + writeDataFile(REcosystem_Current_RK4_from_Sim$out_Gear_Catch,BaselineRK4OutGearCatch) + } + else { + writeDataFile(REcosystem_Current_AB_from_Sim$out_Biomass, CurrentABOutBiomass) + writeDataFile(REcosystem_Current_RK4_from_Sim$out_Biomass, CurrentRK4OutBiomass) + writeDataFile(REcosystem_Current_AB_from_Sim$out_Catch, CurrentABOutCatch) + writeDataFile(REcosystem_Current_RK4_from_Sim$out_Catch, CurrentRK4OutCatch) + writeDataFile(REcosystem_Current_AB_from_Sim$out_Gear_Catch, CurrentABOutGearCatch) + writeDataFile(REcosystem_Current_RK4_from_Sim$out_Gear_Catch,CurrentRK4OutGearCatch) + REcosystem_Current_AB_OutBiomass <- readDataFile(CurrentABOutBiomass) #, fill=TRUE,sep=" ") + REcosystem_Current_RK4_OutBiomass <- readDataFile(CurrentRK4OutBiomass) #, fill=TRUE,sep=" ") + REcosystem_Current_AB_OutCatch <- readDataFile(CurrentABOutCatch) #, fill=TRUE,sep=" ") + REcosystem_Current_RK4_OutCatch <- readDataFile(CurrentRK4OutCatch) #, fill=TRUE,sep=" ") + REcosystem_Current_AB_OutGearCatch <- readDataFile(CurrentABOutGearCatch) #, fill=TRUE,sep=" ") + REcosystem_Current_RK4_OutGearCatch <- readDataFile(CurrentRK4OutGearCatch) #,fill=TRUE,sep=" ") + runTestEqual(inc(runNum),"", "Compare baseline AB to Current AB", REcosystem_Baseline_AB, REcosystem_Current_AB) + runTestEqual(inc(runNum),"out_Biomass", "Compare baseline AB to Current AB for OutBiomass", REcosystem_Baseline_AB_OutBiomass, REcosystem_Current_AB_OutBiomass) + runTestEqual(inc(runNum),"out_Catch", "Compare baseline AB to Current AB for OutCatch", REcosystem_Baseline_AB_OutCatch, REcosystem_Current_AB_OutCatch) + runTestEqual(inc(runNum),"out_Gear_Catch","Compare baseline AB to Current AB for OutGearCatch", REcosystem_Baseline_AB_OutGearCatch, REcosystem_Current_AB_OutGearCatch) + runTestEqual(inc(runNum),"", "Compare baseline RK4 to Current RK4", REcosystem_Baseline_RK4, REcosystem_Current_RK4) + runTestEqual(inc(runNum),"out_Biomass", "Compare baseline RK4 to Current RK4 for OutputBiomass",REcosystem_Baseline_RK4_OutBiomass, REcosystem_Current_RK4_OutBiomass) + runTestEqual(inc(runNum),"out_Catch", "Compare baseline RK4 to Current RK4 for OutCatch", REcosystem_Baseline_RK4_OutCatch, REcosystem_Current_RK4_OutCatch) + runTestEqual(inc(runNum),"out_Gear_Catch","Compare baseline RK4 to Current RK4 for OutGearCatch", REcosystem_Baseline_RK4_OutGearCatch,REcosystem_Current_RK4_OutGearCatch) + runTestEqual(inc(runNum),"", "Compare baseline AB to Current RK4", REcosystem_Baseline_AB, REcosystem_Current_RK4) + runTestEqual(inc(runNum),"out_Biomass", "Compare baseline AB to Current RK4 for OutBiomass", REcosystem_Baseline_AB_OutBiomass, REcosystem_Current_RK4_OutBiomass) + runTestEqual(inc(runNum),"out_Catch", "Compare baseline AB to Current RK4 for OutCatch", REcosystem_Baseline_AB_OutCatch, REcosystem_Current_RK4_OutCatch) + runTestEqual(inc(runNum),"out_Gear_Catch","Compare baseline AB to Current RK4 for OutGearCatch", REcosystem_Baseline_AB_OutGearCatch, REcosystem_Current_RK4_OutGearCatch) + } + + print("------------------ Forced Biomass Tests (Jitter) ------------------") + typeData <- list(FORCED_BIOMASS,FORCED_MIGRATION) + numMonths <- nrow(REcosystem_scenario$forcing$ForcedBio) + for (typeNum in 1:length(typeData)) { + REco <- rpath(REco.params, eco.name = 'R Ecosystem') # an Rpath object + REcosystem_scenario <- rsim.scenario(REco, REco.params, 1:50) + REcosystem_scenario_jitter <- REcosystem_scenario + theTypeData <- typeData[[typeNum]] + modNum <- modNum + 1 + if (theTypeData == FORCED_BIOMASS) { + BaselineJitterDataFrames <- list(REcosystem_Baseline_AB_ForcedBio_OutBiomass_Jitter, REcosystem_Baseline_AB_ForcedBio_OutCatch_Jitter, REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Jitter, + REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Jitter, REcosystem_Baseline_RK4_ForcedBio_OutCatch_Jitter, REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Jitter) + BaselineJitterFilenames <- list(BaselineABForcedBioOutBiomassJitter, BaselineABForcedBioOutCatchJitter, BaselineABForcedBioOutGearCatchJitter, + BaselineRK4ForcedBioOutBiomassJitter, BaselineRK4ForcedBioOutCatchJitter, BaselineRK4ForcedBioOutGearCatchJitter) + CurrentJitterFilenames <- list(CurrentABForcedBioOutBiomassJitter, CurrentABForcedBioOutCatchJitter, CurrentABForcedBioOutGearCatchJitter, + CurrentRK4ForcedBioOutBiomassJitter, CurrentRK4ForcedBioOutCatchJitter, CurrentRK4ForcedBioOutGearCatchJitter) + # RSK - These (original) lines don't work in git actions + REcosystem_scenario_jitter$forcing$ForcedBio <- modifyForcingMatrix(modNum, species, JITTERED, theTypeData, + REcosystem_scenario_jitter$forcing$ForcedBio, + REcosystem_scenario_jitter, + POSITIVE_ONLY) + + # A couple different ways to jitter. Trying to determine why some tests fail in git actions when run + # in the tests.yml file but don't fail when run via R-CMD-Check.yml. + # + # This line doesn't fail in git actions (it's just not the exact logic I need) + # REcosystem_scenario_jitter$forcing$ForcedBio <- jitter(REcosystem_scenario_jitter$forcing$ForcedBio,factor=FACTOR_VALUE) + # + # Another way to jitter + #numMonths <- nrow(REcosystem_scenario_jitter$forcing$ForcedBio) + #numSpecies <- length(species) + #speciesNum <- 0 + #totSpeciesBiomass <- 0 + #totRandVal <- 0 + #for (aSpecies in species) { + # jitterVector <- c() + # speciesBiomass <- REcosystem_scenario_jitter$start_state$Biomass[aSpecies] + # totSpeciesBiomass <- totSpeciesBiomass + speciesBiomass + # for (month in 1:numMonths) { + # randVal <- ... + # jitteredValue <- speciesBiomass * (1.0 + randVal) + # totRandVal <- totRandVal + randVal + # jitterVector <- append(jitterVector,jitteredValue) + # } + # speciesNum <- speciesNum + 1 + # REcosystem_scenario_jitter$forcing$ForcedBio[,aSpecies] <- jitterVector # RSK problematic line here + #} + # REcosystem_scenario_jitter$forcing$ForcedBio <- jitterMatrixColumns(REcosystem_scenario_jitter$forcing$ForcedBio,REcosystem_scenario_jitter$start_state$Biomass,species) + } + else if (theTypeData == FORCED_MIGRATION) { + BaselineJitterDataFrames <- list(REcosystem_Baseline_AB_ForcedMig_OutBiomass_Jitter, REcosystem_Baseline_AB_ForcedMig_OutCatch_Jitter, REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Jitter, + REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Jitter, REcosystem_Baseline_RK4_ForcedMig_OutCatch_Jitter, REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Jitter) + BaselineJitterFilenames <- list(BaselineABForcedMigOutBiomassJitter, BaselineABForcedMigOutCatchJitter, BaselineABForcedMigOutGearCatchJitter, + BaselineRK4ForcedMigOutBiomassJitter, BaselineRK4ForcedMigOutCatchJitter, BaselineRK4ForcedMigOutGearCatchJitter) + CurrentJitterFilenames <- list(CurrentABForcedMigOutBiomassJitter, CurrentABForcedMigOutCatchJitter, CurrentABForcedMigOutGearCatchJitter, + CurrentRK4ForcedMigOutBiomassJitter, CurrentRK4ForcedMigOutCatchJitter, CurrentRK4ForcedMigOutGearCatchJitter) + REcosystem_scenario_jitter$forcing$ForcedMigrate <- modifyForcingMatrix(modNum,species,JITTERED,theTypeData, + REcosystem_scenario_jitter$forcing$ForcedMigrate, + REcosystem_scenario_jitter, + POSITIVE_ONLY) + } else { + print(paste0("Error: Unknown data type: ",theTypeData)) + return() + } + + REcosystem_AB_Current_Jitter <- rsim.run(REcosystem_scenario_jitter,method='AB', years=1:50) + REcosystem_RK4_Current_Jitter <- rsim.run(REcosystem_scenario_jitter,method='RK4',years=1:50) + if (CREATE_BASELINE_FILES) { + writeDataFile(REcosystem_AB_Current_Jitter$out_Biomass, BaselineJitterFilenames[[1]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Catch, BaselineJitterFilenames[[2]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Gear_Catch, BaselineJitterFilenames[[3]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Biomass, BaselineJitterFilenames[[4]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Catch, BaselineJitterFilenames[[5]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Gear_Catch, BaselineJitterFilenames[[6]]) + } else { + writeDataFile(REcosystem_AB_Current_Jitter$out_Biomass, CurrentJitterFilenames[[1]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Catch, CurrentJitterFilenames[[2]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Gear_Catch, CurrentJitterFilenames[[3]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Biomass, CurrentJitterFilenames[[4]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Catch, CurrentJitterFilenames[[5]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Gear_Catch, CurrentJitterFilenames[[6]]) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Random", "AB", "AB", BaselineJitterDataFrames[[1]], CurrentJitterFilenames[[1]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Random", "AB", "AB", BaselineJitterDataFrames[[2]], CurrentJitterFilenames[[2]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Random", "AB", "AB", BaselineJitterDataFrames[[3]], CurrentJitterFilenames[[3]], species) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Random", "RK4", "RK4", BaselineJitterDataFrames[[4]], CurrentJitterFilenames[[4]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Random", "RK4", "RK4", BaselineJitterDataFrames[[5]], CurrentJitterFilenames[[5]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Random", "RK4", "RK4", BaselineJitterDataFrames[[6]], CurrentJitterFilenames[[6]], species) + } + } + +# if (CREATE_BASELINE_FILES == FALSE) { +# return() +# } + + print("------------------ Forced Biomass Tests (Stepped) ------------------") + REcosystem_scenario_stepped <- REcosystem_scenario + typeData <- list(FORCED_BIOMASS,FORCED_MIGRATION) + numMonths <- nrow(REcosystem_scenario_stepped$forcing$ForcedBio) + for (i in 1:length(typeData)) { + REcosystem_scenario <- rsim.scenario(REco, REco.params, 1:50) + REcosystem_scenario_stepped <- copy(REcosystem_scenario) + theTypeData <- typeData[[i]] + modNum <- modNum + 1 + if (theTypeData == FORCED_BIOMASS) { + REcosystem_scenario_stepped$forcing$ForcedBio <- modifyForcingMatrix(modNum,species,STEPPED,theTypeData, + REcosystem_scenario_stepped$forcing$ForcedBio, + REcosystem_scenario_stepped, + POSITIVE_ONLY) + BaselineSteppedTables <- list(REcosystem_Baseline_AB_ForcedBio_OutBiomass_Stepped, REcosystem_Baseline_AB_ForcedBio_OutCatch_Stepped, REcosystem_Baseline_AB_ForcedBio_OutGearCatch_Stepped, + REcosystem_Baseline_RK4_ForcedBio_OutBiomass_Stepped, REcosystem_Baseline_RK4_ForcedBio_OutCatch_Stepped, REcosystem_Baseline_RK4_ForcedBio_OutGearCatch_Stepped) + BaselineSteppedFiles <- list(BaselineABForcedBioOutBiomassStepped, BaselineABForcedBioOutCatchStepped, BaselineABForcedBioOutGearCatchStepped, + BaselineRK4ForcedBioOutBiomassStepped, BaselineRK4ForcedBioOutCatchStepped, BaselineRK4ForcedBioOutGearCatchStepped) + CurrentSteppedFiles <- list(CurrentABForcedBioOutBiomassStepped, CurrentABForcedBioOutCatchStepped, CurrentABForcedBioOutGearCatchStepped, + CurrentRK4ForcedBioOutBiomassStepped, CurrentRK4ForcedBioOutCatchStepped, CurrentRK4ForcedBioOutGearCatchStepped) + } else if (theTypeData == FORCED_MIGRATION) { + REcosystem_scenario_stepped$forcing$ForcedMigrate <- modifyForcingMatrix(modNum,species,STEPPED,theTypeData, + REcosystem_scenario_stepped$forcing$ForcedMigrate, + REcosystem_scenario_stepped, + POSITIVE_ONLY) + BaselineSteppedTables <- list(REcosystem_Baseline_AB_ForcedMig_OutBiomass_Stepped, REcosystem_Baseline_AB_ForcedMig_OutCatch_Stepped, REcosystem_Baseline_AB_ForcedMig_OutGearCatch_Stepped, + REcosystem_Baseline_RK4_ForcedMig_OutBiomass_Stepped, REcosystem_Baseline_RK4_ForcedMig_OutCatch_Stepped, REcosystem_Baseline_RK4_ForcedMig_OutGearCatch_Stepped) + BaselineSteppedFiles <- list(BaselineABForcedMigOutBiomassStepped, BaselineABForcedMigOutCatchStepped, BaselineABForcedMigOutGearCatchStepped, + BaselineRK4ForcedMigOutBiomassStepped, BaselineRK4ForcedMigOutCatchStepped, BaselineRK4ForcedMigOutGearCatchStepped) + CurrentSteppedFiles <- list(CurrentABForcedMigOutBiomassStepped, CurrentABForcedMigOutCatchStepped, CurrentABForcedMigOutGearCatchStepped, + CurrentRK4ForcedMigOutBiomassStepped, CurrentRK4ForcedMigOutCatchStepped, CurrentRK4ForcedMigOutGearCatchStepped) + } + REcosystem_AB_Current_Stepped <- rsim.run(REcosystem_scenario_stepped,method='AB', years=1:50) + REcosystem_RK4_Current_Stepped <- rsim.run(REcosystem_scenario_stepped,method='RK4',years=1:50) + if (CREATE_BASELINE_FILES) { + writeDataFile(REcosystem_AB_Current_Stepped$out_Biomass, BaselineSteppedFiles[[1]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Catch, BaselineSteppedFiles[[2]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Gear_Catch, BaselineSteppedFiles[[3]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Biomass, BaselineSteppedFiles[[4]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Catch, BaselineSteppedFiles[[5]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Gear_Catch, BaselineSteppedFiles[[6]]) + } else { + writeDataFile(REcosystem_AB_Current_Stepped$out_Biomass, CurrentSteppedFiles[[1]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Catch, CurrentSteppedFiles[[2]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Gear_Catch, CurrentSteppedFiles[[3]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Biomass, CurrentSteppedFiles[[4]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Catch, CurrentSteppedFiles[[5]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Gear_Catch, CurrentSteppedFiles[[6]]) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Stepped", "AB", "AB", BaselineSteppedTables[[1]], CurrentSteppedFiles[[1]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Stepped", "AB", "AB", BaselineSteppedTables[[2]], CurrentSteppedFiles[[2]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Stepped", "AB", "AB", BaselineSteppedTables[[3]], CurrentSteppedFiles[[3]], species) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Stepped", "RK4","RK4",BaselineSteppedTables[[4]], CurrentSteppedFiles[[4]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Stepped", "RK4","RK4",BaselineSteppedTables[[5]], CurrentSteppedFiles[[5]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Stepped", "RK4","RK4",BaselineSteppedTables[[6]], CurrentSteppedFiles[[6]], species) + } + } + + print("------------------ Forced Effort Tests (Jitter) ------------------") + numMonths <- nrow(REcosystem_scenario$fishing$ForcedEffort) + REcosystem_scenario_jitter <- REcosystem_scenario + fishingOriginalData <- list(REcosystem_scenario$fishing$ForcedEffort, REcosystem_scenario$fishing$ForcedFRate, REcosystem_scenario$fishing$ForcedCatch) + typeData <- list(FORCED_EFFORT, FORCED_FRATE, FORCED_CATCH) + for (i in 1:length(fishingOriginalData)) { + theTypeData <- typeData[[i]] + modNum <- modNum + 1 + if (theTypeData == FORCED_EFFORT) { + ForcedMatrix <- modifyFishingMatrix(modNum,species,fleets,theTypeData,fishingOriginalData[[i]], + REco.params$model,POSITIVE_AND_NEGATIVE) + REcosystem_scenario_jitter$fishing$ForcedEffort <- ForcedMatrix + BaselineJitterTables <- list(REcosystem_Baseline_AB_ForcedEff_OutBiomass_Jitter, REcosystem_Baseline_AB_ForcedEff_OutCatch_Jitter, REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Jitter, + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Jitter,REcosystem_Baseline_RK4_ForcedEff_OutCatch_Jitter,REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Jitter) + BaselineJitterFiles <- list(BaselineABForcedEffOutBiomassJitter, BaselineABForcedEffOutCatchJitter, BaselineABForcedEffOutGearCatchJitter, + BaselineRK4ForcedEffOutBiomassJitter,BaselineRK4ForcedEffOutCatchJitter,BaselineRK4ForcedEffOutGearCatchJitter) + CurrentJitterFiles <- list(CurrentABForcedEffOutBiomassJitter, CurrentABForcedEffOutCatchJitter, CurrentABForcedEffOutGearCatchJitter, + CurrentRK4ForcedEffOutBiomassJitter, CurrentRK4ForcedEffOutCatchJitter, CurrentRK4ForcedEffOutGearCatchJitter) + } else if (theTypeData == FORCED_FRATE) { + ForcedMatrix <- modifyFishingMatrix(modNum,species,fleets,theTypeData,fishingOriginalData[[i]], + REco.params$model,POSITIVE_ONLY) + REcosystem_scenario_jitter$fishing$ForcedFRate <- ForcedMatrix + BaselineJitterTables <- list(REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Jitter, REcosystem_Baseline_AB_ForcedFRa_OutCatch_Jitter, REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Jitter, + REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Jitter,REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Jitter,REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Jitter) + BaselineJitterFiles <- list(BaselineABForcedFRaOutBiomassJitter, BaselineABForcedFRaOutCatchJitter, BaselineABForcedFRaOutGearCatchJitter, + BaselineRK4ForcedFRaOutBiomassJitter,BaselineRK4ForcedFRaOutCatchJitter,BaselineRK4ForcedFRaOutGearCatchJitter) + CurrentJitterFiles <- list(CurrentABForcedFRaOutBiomassJitter, CurrentABForcedFRaOutCatchJitter, CurrentABForcedFRaOutGearCatchJitter, + CurrentRK4ForcedFRaOutBiomassJitter, CurrentRK4ForcedFRaOutCatchJitter, CurrentRK4ForcedFRaOutGearCatchJitter) + } else if (theTypeData == FORCED_CATCH) { + REcosystem_scenario_jitter$fishing$ForcedCatch <- ForcedMatrix + BaselineJitterTables <- list(REcosystem_Baseline_AB_ForcedCat_OutBiomass_Jitter, REcosystem_Baseline_AB_ForcedCat_OutCatch_Jitter, REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Jitter, + REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Jitter,REcosystem_Baseline_RK4_ForcedCat_OutCatch_Jitter,REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Jitter) + BaselineJitterFiles <- list(BaselineABForcedCatOutBiomassJitter, BaselineABForcedCatOutCatchJitter, BaselineABForcedCatOutGearCatchJitter, + BaselineRK4ForcedCatOutBiomassJitter,BaselineRK4ForcedCatOutCatchJitter,BaselineRK4ForcedCatOutGearCatchJitter) + CurrentJitterFiles <- list(CurrentABForcedCatOutBiomassJitter, CurrentABForcedCatOutCatchJitter, CurrentABForcedCatOutGearCatchJitter, + CurrentRK4ForcedCatOutBiomassJitter, CurrentRK4ForcedCatOutCatchJitter, CurrentRK4ForcedCatOutGearCatchJitter) + } + REcosystem_AB_Current_Jitter <- rsim.run(REcosystem_scenario_jitter,method='AB', years=1:50) + REcosystem_RK4_Current_Jitter <- rsim.run(REcosystem_scenario_jitter,method='RK4',years=1:50) + if (CREATE_BASELINE_FILES) { + writeDataFile(REcosystem_AB_Current_Jitter$out_Biomass, BaselineJitterFiles[[1]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Catch, BaselineJitterFiles[[2]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Gear_Catch, BaselineJitterFiles[[3]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Biomass, BaselineJitterFiles[[4]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Catch, BaselineJitterFiles[[5]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Gear_Catch, BaselineJitterFiles[[6]]) + } else { + writeDataFile(REcosystem_AB_Current_Jitter$out_Biomass, CurrentJitterFiles[[1]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Catch, CurrentJitterFiles[[2]]) + writeDataFile(REcosystem_AB_Current_Jitter$out_Gear_Catch, CurrentJitterFiles[[3]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Biomass, CurrentJitterFiles[[4]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Catch, CurrentJitterFiles[[5]]) + writeDataFile(REcosystem_RK4_Current_Jitter$out_Gear_Catch, CurrentJitterFiles[[6]]) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Random", "AB", "AB", BaselineJitterTables[[1]], CurrentJitterFiles[[1]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Random", "AB", "AB", BaselineJitterTables[[2]], CurrentJitterFiles[[2]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Random", "AB", "AB", BaselineJitterTables[[3]], CurrentJitterFiles[[3]], species) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Random", "RK4","RK4", BaselineJitterTables[[4]], CurrentJitterFiles[[4]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Random", "RK4","RK4", BaselineJitterTables[[5]], CurrentJitterFiles[[5]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Random", "RK4","RK4", BaselineJitterTables[[6]], CurrentJitterFiles[[6]], species) + } + } + + + print("------------------ Forced Effort Tests (Stepped) ------------------") + numMonths <- nrow(REcosystem_scenario$fishing$ForcedEffort) + REcosystem_scenario_stepped <- REcosystem_scenario + fishingOriginalData <- list(REcosystem_scenario$fishing$ForcedEffort, REcosystem_scenario$fishing$ForcedFRate, REcosystem_scenario$fishing$ForcedCatch) + typeData <- list(FORCED_EFFORT,FORCED_FRATE,FORCED_CATCH) + for (i in 1:length(fishingOriginalData)) { + theTypeData <- typeData[[i]] + REcosystem_scenario_stepped <- REcosystem_scenario + if (theTypeData == FORCED_EFFORT) { + REcosystem_scenario_stepped$fishing$ForcedEffort <- stepifyMatrix(fishingOriginalData[[i]],fleets,0.1) + BaselineSteppedTables <- list(REcosystem_Baseline_AB_ForcedEff_OutBiomass_Stepped, REcosystem_Baseline_AB_ForcedEff_OutCatch_Stepped, REcosystem_Baseline_AB_ForcedEff_OutGearCatch_Stepped, + REcosystem_Baseline_RK4_ForcedEff_OutBiomass_Stepped, REcosystem_Baseline_RK4_ForcedEff_OutCatch_Stepped, REcosystem_Baseline_RK4_ForcedEff_OutGearCatch_Stepped) + BaselineSteppedFiles <- list(BaselineABForcedEffOutBiomassStepped, BaselineABForcedEffOutCatchStepped, BaselineABForcedEffOutGearCatchStepped, + BaselineRK4ForcedEffOutBiomassStepped,BaselineRK4ForcedEffOutCatchStepped,BaselineRK4ForcedEffOutGearCatchStepped) + CurrentSteppedFiles <- list(CurrentABForcedEffOutBiomassStepped, CurrentABForcedEffOutCatchStepped, CurrentABForcedEffOutGearCatchStepped, + CurrentRK4ForcedEffOutBiomassStepped, CurrentRK4ForcedEffOutCatchStepped, CurrentRK4ForcedEffOutGearCatchStepped) + } else if (theTypeData == FORCED_FRATE) { + REcosystem_scenario_stepped$fishing$ForcedFRate <- stepifyMatrix(fishingOriginalData[[i]],species,0.01) + BaselineSteppedTables <- list(REcosystem_Baseline_AB_ForcedFRa_OutBiomass_Stepped, REcosystem_Baseline_AB_ForcedFRa_OutCatch_Stepped, REcosystem_Baseline_AB_ForcedFRa_OutGearCatch_Stepped, + REcosystem_Baseline_RK4_ForcedFRa_OutBiomass_Stepped, REcosystem_Baseline_RK4_ForcedFRa_OutCatch_Stepped, REcosystem_Baseline_RK4_ForcedFRa_OutGearCatch_Stepped) + BaselineSteppedFiles <- list(BaselineABForcedFRaOutBiomassStepped, BaselineABForcedFRaOutCatchStepped, BaselineABForcedFRaOutGearCatchStepped, + BaselineRK4ForcedFRaOutBiomassStepped,BaselineRK4ForcedFRaOutCatchStepped,BaselineRK4ForcedFRaOutGearCatchStepped) + CurrentSteppedFiles <- list(CurrentABForcedFRaOutBiomassStepped, CurrentABForcedFRaOutCatchStepped, CurrentABForcedFRaOutGearCatchStepped, + CurrentRK4ForcedFRaOutBiomassStepped, CurrentRK4ForcedFRaOutCatchStepped, CurrentRK4ForcedFRaOutGearCatchStepped) + } else if (theTypeData == FORCED_CATCH) { + REcosystem_scenario_stepped$fishing$ForcedCatch <- stepifyMatrix(fishingOriginalData[[i]],species,0.01) + BaselineSteppedTables <- list(REcosystem_Baseline_AB_ForcedCat_OutBiomass_Stepped, REcosystem_Baseline_AB_ForcedCat_OutCatch_Stepped, REcosystem_Baseline_AB_ForcedCat_OutGearCatch_Stepped, + REcosystem_Baseline_RK4_ForcedCat_OutBiomass_Stepped, REcosystem_Baseline_RK4_ForcedCat_OutCatch_Stepped, REcosystem_Baseline_RK4_ForcedCat_OutGearCatch_Stepped) + BaselineSteppedFiles <- list(BaselineABForcedCatOutBiomassStepped, BaselineABForcedCatOutCatchStepped, BaselineABForcedCatOutGearCatchStepped, + BaselineRK4ForcedCatOutBiomassStepped,BaselineRK4ForcedCatOutCatchStepped,BaselineRK4ForcedCatOutGearCatchStepped) + CurrentSteppedFiles <- list(CurrentABForcedCatOutBiomassStepped, CurrentABForcedCatOutCatchStepped, CurrentABForcedCatOutGearCatchStepped, + CurrentRK4ForcedCatOutBiomassStepped, CurrentRK4ForcedCatOutCatchStepped, CurrentRK4ForcedCatOutGearCatchStepped) + } + REcosystem_AB_Current_Stepped <- rsim.run(REcosystem_scenario_stepped,method='AB', years=1:50) + REcosystem_RK4_Current_Stepped <- rsim.run(REcosystem_scenario_stepped,method='RK4',years=1:50) + if (CREATE_BASELINE_FILES) { + writeDataFile(REcosystem_AB_Current_Stepped$out_Biomass, BaselineSteppedFiles[[1]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Catch, BaselineSteppedFiles[[2]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Gear_Catch, BaselineSteppedFiles[[3]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Biomass, BaselineSteppedFiles[[4]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Catch, BaselineSteppedFiles[[5]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Gear_Catch, BaselineSteppedFiles[[6]]) + } else { + writeDataFile(REcosystem_AB_Current_Stepped$out_Biomass, CurrentSteppedFiles[[1]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Catch, CurrentSteppedFiles[[2]]) + writeDataFile(REcosystem_AB_Current_Stepped$out_Gear_Catch, CurrentSteppedFiles[[3]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Biomass, CurrentSteppedFiles[[4]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Catch, CurrentSteppedFiles[[5]]) + writeDataFile(REcosystem_RK4_Current_Stepped$out_Gear_Catch, CurrentSteppedFiles[[6]]) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Stepped", "AB", "AB", BaselineSteppedTables[[1]], CurrentSteppedFiles[[1]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Stepped", "AB", "AB", BaselineSteppedTables[[2]], CurrentSteppedFiles[[2]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Stepped", "AB", "AB", BaselineSteppedTables[[3]], CurrentSteppedFiles[[3]], species) + runTestRDS(inc(runNum),"out_Biomass", theTypeData, "Stepped", "RK4", "RK4", BaselineSteppedTables[[4]], CurrentSteppedFiles[[4]], species) + runTestRDS(inc(runNum),"out_Catch", theTypeData, "Stepped", "RK4", "RK4", BaselineSteppedTables[[5]], CurrentSteppedFiles[[5]], species) + runTestRDS(inc(runNum),"out_Gear_Catch", theTypeData, "Stepped", "RK4", "RK4", BaselineSteppedTables[[6]], CurrentSteppedFiles[[6]], species) + } + } + + if (! CREATE_BASELINE_FILES) { + print(paste0("Completed ",inc(runNum)," test(s).")) + } + +}) diff --git a/tests/testthat/test-utils-jitter.R b/tests/testthat/test-utils-jitter.R new file mode 100644 index 00000000..09fcbfd8 --- /dev/null +++ b/tests/testthat/test-utils-jitter.R @@ -0,0 +1,54 @@ +source("test-constants.R") + +#' Add Jitter (i.e., random noise) +#' +#' Adds random noise to the specified matrix. +#' +#' @param matrix : data matrix to be jittered +#' @param factor : the R jitter factor (the larger the number the greater the jitter amount) +#' @param xlabel : x axis label for plot +#' @param ylabel : y axis label for plot +#' @param title : main title for plot +#' +#' @return Returns the jittered matrix +#' +addJitter <- function(matrix,xlabel,ylabel,title) { + # From jitter() doc: If amount == 0, jitter returns factor * z/50, where + # z = max(x0) - min(x), aka the range. So if factor=5 and amount=0, jitter() + # returns a random value within a tenth of the range. + + jitteredMatrix <- jitter(matrix,factor=FACTOR_VALUE,amount=NULL) + if (xlabel != '' && ylabel != '' & title != '') { + # plot(jitteredMatrix,type='l',lwd=5,xlab=xlabel,ylab=ylabel,main=title) + } + return(jitteredMatrix) +} + +#' Create a jittered vector +#' +#' Used for jittering a matrix column. +#' +#' @param typeData : the type of data to be jittered +#' @param value : value to add jitter to +#' @param numElements : number of elements in vector +#' @param xlabel : x axis label for plot +#' @param ylabel : y axis label for plot +#' @param title : main title for plot +#' @param title : the type of random number (positive only or any) +#' +#' @return Returns the column-jittered matrix +#' +createJitterVectorFromValue <- function(typeData,value,numElements,xlabel,ylabel,title,randomNumberType) { + jitterVector <- c() + migrationScaleFactor <- 1 + if (typeData == FORCED_MIGRATION) { + migrationScaleFactor = FORCED_MIGRATION_SCALE_FACTOR_JITTER # = 1000 + } + for (i in 1:numElements) { + randVal <- randomNumber(migrationScaleFactor*JITTER_AMOUNT_PCT,randomNumberType) + jitteredValue <- value * (1.0 + randVal) + jitterVector <- append(jitterVector,jitteredValue) + } + # plot(jitterVector,type='l',lwd=5,xlab=xlabel,ylab=ylabel,main=title) + return(jitterVector) +} \ No newline at end of file diff --git a/tests/testthat/test-utils-plot.R b/tests/testthat/test-utils-plot.R new file mode 100644 index 00000000..6f905402 --- /dev/null +++ b/tests/testthat/test-utils-plot.R @@ -0,0 +1,116 @@ +source("test-constants.R") + +#' Plot test results superimposed on the same plot +#' +#' Plot specific columns from that passed in matrices and plot them as groups of plots per page. +#' The plots will be of the baseline run and the current run plot superimposed on the same plot. +#' +#' @param BaseData : Baseline data to compare current data to +#' @param CurrData : Current data to compare against pre-run baseline data +#' @param baseAlg : The baseline algorithm used (currently AB or RK4) +#' @param currAlg : The current algorithm used (currently AB or RK4) +#' @param tableName : Table name used for the plot's title +#' @param forcedData : The data that's being forced (i.e., Biomass, Catch) +#' @param forcedType : The type of forcing being done (.e., Random (Jitter) or Stair-Stepped) +#' @param species : A vector of fish species +#' +#' @return Returns the final, combined plot +#' +plotResultsSuperimposed <- function(BaseData,CurrData,baseAlg,currAlg,tableName,forcedData,forcedType,species) { + plots <- list() + group <- species + yLabel <- "Biomass (mt/km\U00B2)" + currDf <- data.frame() + baseDf <- data.frame() + + for (member in group) { + xvalues <- c(1:length(CurrData[,member])) + numMonths <- length(CurrData[,member]) + currYvalues <- CurrData[,member] + baseYvalues <- BaseData[,member] + currDf <- data.frame(Legend=replicate(numMonths,paste0('Current ', currAlg)), xvalues,currYvalues) + baseDf <- data.frame(Legend=replicate(numMonths,paste0('Baseline ',baseAlg)), xvalues,baseYvalues) + + aPlot <- ggplot() + + geom_line(data=baseDf, aes(x=xvalues, y=baseYvalues, color=Legend)) + + geom_line(data=currDf, aes(x=xvalues, y=currYvalues, color=Legend)) + + labs(x="Months",y=yLabel, + title=paste0('Sim Run (',forcedData,' w/ ',forcedType,' Noise) - ',member), + subtitle=paste0("Dataset: ",tableName)) + + scale_color_manual(name="Legend:",values=c('red','darkblue')) + + theme( plot.title = element_text(hjust=0.5,size=7,face="bold"), + plot.subtitle = element_text(hjust=0.5,size=7), + axis.text = element_text(size=8), + axis.title = element_text(size=8), + legend.text = element_text(size=8), + legend.title = element_text(size=10), + legend.position='bottom', + legend.spacing.y = unit(0.0,'cm'), + legend.background = element_rect(fill='#f7f7f7'), + # legend.box.background = element_rect(color = 'black'), + plot.background = element_rect(color='black',fill=NA,linewidth=1) + ) + plots <- list.append(plots,aPlot) + + } + combinedPlot <- ggarrange(plotlist=plots,nrow=3,ncol=2) + # annotate_figure(combinedPlot, top = text_grob("Sample main title here", color = "red", face = "bold", size = 14)) + # saveWidget(ggplotly(combinedPlot), file = "Rplots.html"); + # print(ggplotly(combinedPlot)) + print(combinedPlot) +} + +#' Plot the difference of the two runs +#' +#' Plot specific columns from that passed in matrices and plot them as groups of plots per page. +#' The plots will be of the current run - baseline run. So if there's a perfect match, the plot should +#' be all zeros. +#' +#' @param BaseData : Baseline data to compare current data to +#' @param CurrData : Current data to compare against pre-run baseline data +#' @param baseAlg : The baseline algorithm used (currently AB or RK4) +#' @param currAlg : The current algorithm used (currently AB or RK4) +#' @param tableName : Table name used for the plot's title +#' @param forcedData : The data that's being forced (i.e., Biomass, Catch) +#' @param forcedType : The type of forcing being done (.e., Random (Jitter) or Stair-Stepped) +#' @param species : A vector of fish species +#' +#' @return Returns the final, combined plot +#' +plotResultsDifference <- function(BaseData,CurrData,baseAlg,currAlg,tableName,forcedData,forcedType,species) { + plots <- list() + group <- species + yLabel <- "Biomass (mt/km\U00B2)" + diffDf <- data.frame() + + for (member in group) { + xvalues <- c(1:length(CurrData[,member])) + numMonths <- length(CurrData[,member]) + currYvalues <- CurrData[,member] + baseYvalues <- BaseData[,member] + diffDf <- data.frame(Legend=replicate(numMonths,paste0('Current(',currAlg,')-Baseline(',baseAlg,') ')), xvalues,currYvalues-baseYvalues) + aPlot <- ggplot() + + geom_line(data=diffDf, aes(x=xvalues, y=currYvalues-baseYvalues, color=Legend)) + + labs(x="Months",y=yLabel, + title=paste0('Sim Run using ',forcedData,' with ',forcedType,' Noise - ',member), + subtitle=paste0("Dataset: ",tableName)) + + scale_color_manual(name="Legend:",values=c('darkblue')) + + coord_cartesian(ylim = c(-YLIMIT_DIFFERENCE_PLOTS, YLIMIT_DIFFERENCE_PLOTS)) + # RSK + theme( plot.title = element_text(hjust=0.5,size=7,face="bold"), + plot.subtitle = element_text(hjust=0.5,size=7), + axis.text = element_text(size=8), + axis.title = element_text(size=8), + legend.text = element_text(size=8), + legend.title = element_text(size=10), + legend.position='bottom', + legend.spacing.y = unit(0.0,'cm'), + legend.background = element_rect(fill='#f7f7f7'), + # legend.box.background = element_rect(color = 'black'), + plot.background = element_rect(color='black',fill=NA,linewidth=1) + ) + plots <- list.append(plots,aPlot) + } + combinedPlot <- ggarrange(plotlist=plots,ncol=1) + # annotate_figure(combinedPlot, top = text_grob("Sample main title here", color = "red", face = "bold", size = 14)) + print(combinedPlot) +} \ No newline at end of file diff --git a/tests/testthat/test-utils-stepify.R b/tests/testthat/test-utils-stepify.R new file mode 100644 index 00000000..4575f04b --- /dev/null +++ b/tests/testthat/test-utils-stepify.R @@ -0,0 +1,118 @@ +source("test-constants.R") + +#' Get stepification steps +#' +#' This function returns the step offsets in order to give a function a stair-stepped pattern. +#' +#' @param type : The type of stair-stepped pattern. There are currently 3 types: 1 (mountain pattern), 2 (valley pattern), and 3 (mix of mountain and valley pattern) +#' +#' @return Returns a vector of stair-stepped offsets +#' +getSteps <- function(type=1) { + STEPS_WIDTH <- 0.1 # approx. +/- 10% of initial value + steps = c() + tog <- -1 + min <- 1.0 + # max <- if (type == 2 || type == 3) 0.5 else 2.0 + max <- if (type == 2 || type == 3) (1.0-STEPS_WIDTH) else (1.0+STEPS_WIDTH) + if (is.even(NUMBER_OF_STEPS)) { + NUMBER_OF_STEPS <- NUMBER_OF_STEPS + 1 + } + halfway <- NUMBER_OF_STEPS %/% 2 + increment <- (max-min)/halfway + + for (i in 1:NUMBER_OF_STEPS) { + if (i <= halfway+1) { + inc <- increment + start <- min + ii <- i-1 + } else { + inc <- -increment + start <- max-inc + ii <- i-halfway + } + tog <- if (type == 3) -tog else 1.0 + steps[i] <- abs(start + tog*ii*inc) + } + return(steps) +} + +#' Stepify Effort +#' +#' This function stepifies a vector of effort data. Stepification consists of modifying (i.e., multiplying) the +#' vector data in question by a series of constant values (i.e., steps). Plotting these steps +#' shows a stair-stepped function of various forms based upon the passed type. Type 1 = mountain +#' shape, Type 2 = valley shape, Type 3 = mixed shape. +#' +#' @param effort : vector effort data +#' @param type : type of "stepification" +#' +#' @return Returns the "stepped" vector data +#' +stepifyVector <- function(vectorData,type=1, stepFactor) { + steps <- getSteps(type) + numMonths <- length(vectorData) + incMonths <- numMonths/ NUMBER_OF_STEPS; + inc <- 0 + for (i in 1:NUMBER_OF_STEPS) { + start <- inc + 1 + start <- if (start == 0) 1 else start + end <- inc+incMonths + vectorData[start:end] <- vectorData[start:end] * steps[i] * stepFactor + inc <- inc + incMonths + } + return(vectorData) +} + +#' Stepify a Matrix +#' +#' This function sequences through the appropriately named columns and calls stepifyVector +#' to stepify those columns. +#' +#' @family Rpath functions +#' +#' @param forcedEffortMatrix : matrix in which specific columns will be "stepified" +#' @param memberNames : vector of either species or fleet names +#' +#' @return Returns the updated forced effort matrix +#' +stepifyMatrix <- function(forcedEffortMatrix,memberNames,stepFactor) { + ForcedMatrix <- forcedEffortMatrix + for (i in 1:length(memberNames)) { + memberName <- memberNames[i] + memberCol <- ForcedMatrix[,memberName] + memberStepped <- stepifyVector(memberCol,i,stepFactor) + ForcedMatrix[,memberName] <- memberStepped + # plot(memberStepped,type='l',lwd=5,xlab="Months",ylab="Effort",main=paste0("Forced Effort with Stepped Noise - ",memberName)) + } + return(ForcedMatrix) +} + +#' Stepify Biomass +#' +#' Takes as input a biomass value and stepifies the value by dividing the number of months +#' by the number of steps desired and multiplying each interval by a different step value. +#' +#' @param value : value to stepify across months +#' @param numMonths : number of months in model +#' @param type : type of stepification desired (1, 2, or 3) +#' @param xlabel : x axis label for plot +#' @param ylabel : y axis label for plot +#' @param title : title for plot +#' +#' @return Returns the vector of stepified segments +#' +stepifyBiomass <- function(typeData, value,numMonths,type=1,xlabel,ylabel,title, scaleFactor) { + steps <- getSteps(type) + incMonths <- numMonths / NUMBER_OF_STEPS; + parts <- c() + if (typeData == FORCED_MIGRATION) { + value <- scaleFactor*value + } + for (i in 1:NUMBER_OF_STEPS) { + part <- replicate(incMonths, steps[i]*value) + parts <- c(parts,part) + } + # plot(parts,type='l',lwd=5,xlab=xlabel,ylab=ylabel,main=title) + return(parts) +} \ No newline at end of file diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R new file mode 100644 index 00000000..86e0f9eb --- /dev/null +++ b/tests/testthat/test-utils.R @@ -0,0 +1,189 @@ +source("test-constants.R") + +#' Random number generator +#' +#' This function returns a random number from a uniform distribution between +#' a min and max value. +#' +#' @param pctToJitter : the percent to jitter (value=0.5 means 50%) +#' @param positiveOnly : boolean that signifies random number returned is limited to non-negative numbers +#' +#' @return Returns the random value +#' +randomNumber <- function(pctToJitter,positiveOnly) { + minJitter <- -pctToJitter + maxJitter <- pctToJitter + if (positiveOnly) { + minJitter <- 0 + } + rval <- runif(1,min=minJitter,max=maxJitter) # [1] + # print(paste0("rval: ",rval)) + return(rval) +} + +#' An increment function +#' +#' This function increments a number by 1 +#' +#' @param value : the number to increment by 1 +#' +#' @return Returns the incremented value +#' +inc <- function(value) eval.parent(substitute(value <- value + 1)) + +#' Read the passed data file +#' +#' This function reads a data file (either a data table or an rds file) +#' +#' @param filename : the file to read in +#' @param fill : boolean to fill blanks with 0's +#' @param sep : the separator used in the file +#' +#' @return Returns the read in file +#' +readDataFile <- function(filename,fill=TRUE,sep="") { + readRDS(filename) + # read.table(filename,fill=fill,sep=sep) +} + +#' Write out the passed data file +#' +#' This function writes out a data file (either a data table or an rds file) +#' +#' @param object : the object to write out (i.e., serialize) +#' @param filename : the name of the output file to write +#' +#' @return None +#' +writeDataFile <- function(object,filename) { + saveRDS(object,file=filename,version=2) + # write.table(object,file=filename) +} + +#' Print scenario statistics +#' +#' Print some statistics from the current scenario +#' +#' @param msg : message header +#' @param scenario : object resulting from current Rpath run +#' +#' @return None +#' +printStatsScenario <- function(msg,scenario) { + print("- - -") + print(paste0(msg,", forcing$ForcedBio: ",sum(scenario$forcing$ForcedBio))) + print(paste0(msg,", forcing$ForcedMigrate: ",sum(scenario$forcing$ForcedMigrate))) + print(paste0(msg,", start_state$Biomass: ",sum(scenario$start_state$Biomass))) +} + +#' Print simulation statistics +#' +#' Print some statistics from the current simulation +#' +#' @param msg : message header +#' @param sim : object resulting from last Rpath simulation run +#' +#' @return None +#' +printStatsSimulation <- function(msg,sim) { + print("- - -") + print(paste0(msg,", sim$out_Biomass: ",sum(sim$out_Biomass))) + print(paste0(msg,", sim$out_Catch: ",sum(sim$out_Catch))) + print(paste0(msg,", sim$out_Gear_Catch: ",sum(sim$out_Gear_Catch))) +} + +#' Modify a scenario$fishing matrix +#' +#' Modifies the appropriate columns from a scenario$fishing matrix. +#' +#' @param species : A vector of fish species +#' @param fleets : A vector of fleets +#' @param typeData : The type of forced data (i.e., Forced Effort, Forced FRate, Forced Catch) +#' @param forcingData : The forced data matrix +#' +#' @return Returns a matrix that's been updated withe the forced data +#' +modifyFishingMatrix <- function(modNum,species,fleets,typeData,forcingData,model,randomNumberType) { + group <- model$Group + pb <- model$PB + ForcedMatrix <- forcingData + speciesOrFleets <- c() + const1 <- 1 + const2 <- 1 + upperLimit <- 0.5 + usePBValue <- FALSE + scaleFactorPB <- 0.0001 # Needed this to add enough randomness to the plots, else they'd be fairly smooth + if (typeData == "Forced Effort") { + speciesOrFleets <- fleets + } else if (typeData == "Forced FRate" || typeData == "Forced Catch") { + speciesOrFleets <- species + const1 <- 0 + usePBValue <- TRUE + } else { + print(paste0("Error: Found invalid typeData of: ",typeData)) + return(ForcedMatrix) + } + index <- match(speciesOrFleets,group) + if (usePBValue) { + const2 <- scaleFactorPB*pb[index] + } + + j <- 0 + for (i in 1:length(speciesOrFleets)) { + item <- speciesOrFleets[i] + vectorData <- ForcedMatrix[,item] + newVectorWithJitter <- c() + for (value in vectorData) { + j <- j + 1 + # Not sure why I need the [1] index here, this should always be just a single value but sometimes it's a list + jitteredValue <- (const1+const2*randomNumber(upperLimit,randomNumberType))[1] + newVectorWithJitter = append(newVectorWithJitter,jitteredValue) + } + ForcedMatrix[,item] <- newVectorWithJitter + } + return(ForcedMatrix) +} + +#' Modify a scenario$forcing matrix +#' +#' Modifies the appropriate columns from a scenario$forcing matrix. +#' +#' @param species : A vector of fish species +#' @param modifyType : The type of modification (i.e., Jittered or Stepped) +#' @param typeData : The type of forced data (i.e., Forced Bio, Forced Migrate) +#' @param forcingData : The forced data matrix +#' @param scenario : The REcosystem_scenario object +#' +#' @return Returns a matrix that's been updated withe the forced data +#' +modifyForcingMatrix <- function (modNum,species,modifyType,typeData,forcingData,scenario,randomNumberType) { + ForcedMatrix <- forcingData + numMonths <- nrow(ForcedMatrix) + scaleFactors <- c(100,50,200,300,10000) + scaleFactors <- c(.6,.6,.6,.6,.6) + if ((typeData == FORCED_BIOMASS) || (typeData == FORCED_MIGRATION)) { + for (i in 1:length(species)) { + aSpecies <- species[[i]] + speciesBiomass <- scenario$start_state$Biomass[aSpecies] + startValue <- speciesBiomass + if (typeData == FORCED_MIGRATION) { + # rval <- (randomNumber(FORCED_MIGRATION_BIOMASS_PCT)+FORCED_MIGRATION_BIOMASS_PCT)/2.0 + rval <- randomNumber(FORCED_MIGRATION_BIOMASS_PCT,randomNumberType) + startValue <- rval + # print(paste0("species: ",aSpecies,", biomass: ",speciesBiomass,", randomNum: ",rval,", startValue: ",startValue)) + } + if (modifyType == JITTERED) { + # print(paste0("start value: ",i,", ",startValue)) + ForcedMatrix[,aSpecies] <- createJitterVectorFromValue(typeData, startValue, numMonths, + "Months","Biomass (mt/km\U00B2)", + paste0(typeData,' with ',modifyType,' Noise - ',aSpecies), + POSITIVE_AND_NEGATIVE) + } else { + stepType <- ((i-1)%%3)+1 # Only current step types are 1, 2, or 3 + ForcedMatrix[,aSpecies] <- stepifyBiomass(typeData, startValue, numMonths, stepType, "Months","Biomass (mt/km\U00B2)", + paste0(typeData,' with ',modifyType,' Noise - ',aSpecies), scaleFactors[i]) + } + } + } + return(ForcedMatrix) +} diff --git a/testthat b/testthat new file mode 120000 index 00000000..4e01ea1f --- /dev/null +++ b/testthat @@ -0,0 +1 @@ +tests/testthat \ No newline at end of file diff --git a/vignettes/ModelSetup.Rmd b/vignettes/ModelSetup.Rmd new file mode 100644 index 00000000..b710ef19 --- /dev/null +++ b/vignettes/ModelSetup.Rmd @@ -0,0 +1,297 @@ +--- +title: "Set up a food web model" +author: "Vignette Author" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Set up a food web model} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + + +## Setting up a food web model + +First, install Rpath as instructed in [Getting Started](). R package `data.table` is also required to run the code in this article. + +```{r rpath load} +library(Rpath); library(data.table) +``` + + +### Parameter file generation +Unlike the GUI based EwE software package, Rpath relies on a parameter input file. +This file is actually a list of several different parameter files: model, diet, +stanzas, and pedigree. Parameter files can be created outside of R and read in using +the `read.rpath.params` function. This function will merge several different flat +files into an R object of the list type. A preferred alternative is to generate +the list file and populate it completely within R. The function +`create.rpath.params` will generate an Rpath.param. This ensures that all +of the correct columns are present in the parameter file. + +The parameter file contains all of the information you would normally enter in the +input data tabs in EwE. There are 2 necessary pieces of information to generate +the parameter file: the group names and their corresponding type. The types are: +living = 0, primary producer = 1, detritus = 2, and fleet = 3. If your model +contains multi-stanza groups then you need 2 additional pieces of information: +stanza group names (include NA for those groups not in a stanza) and the number of +stanzas per stanza group. + +```{r groups} +#Groups and types for the R Ecosystem + +groups <- c('Seabirds', 'Whales', 'Seals', 'JuvRoundfish1', 'AduRoundfish1', + 'JuvRoundfish2', 'AduRoundfish2', 'JuvFlatfish1', 'AduFlatfish1', + 'JuvFlatfish2', 'AduFlatfish2', 'OtherGroundfish', 'Foragefish1', + 'Foragefish2', 'OtherForagefish', 'Megabenthos', 'Shellfish', + 'Macrobenthos', 'Zooplankton', 'Phytoplankton', 'Detritus', + 'Discards', 'Trawlers', 'Midwater', 'Dredgers') + +types <- c(rep(0, 19), 1, rep(2, 2), rep(3, 3)) + +stgroups <- c(rep(NA, 3), rep('Roundfish1', 2), rep('Roundfish2', 2), + rep('Flatfish1', 2), rep('Flatfish2', 2), rep(NA, 14)) + +REco.params <- create.rpath.params(group = groups, type = types, stgroup = stgroups) +``` + +REco.params now contains a list of 4 objects: model, diet, stanzas, and pedigree. +The majority of the parameters are populated with NA save those that have logical +default vaules (i.e 0.66667 for VBGF_d). + +### Model parameters +The model parameter list contains the biomass, production to biomass, consumption to +biomass, etc. parameters as well as the detrital fate parameters and fleet landings and +discards. + +```{r blank modfile table, echo=FALSE, results='asis'} +knitr::kable(REco.params$model, caption = 'Example of the model list created using the + `create.rpath.param` function') +``` + +Each of the parameter lists are data tables (With the exception of the stanzas list +which is itself a list of an integer and two data tables). Data tables are an +extension of the classic data frame class. Advantages of data tables include +simplified indexing which eases the process of populating the parameters. For example +you can add data to a specific slot or fill an entire column. + +```{r How to fill} +#Example of filling specific slots +REco.params$model[Group %in% c('Seals', 'Megabenthos'), EE := 0.8] + +#Example of filling an entire column +biomass <- c(0.0149, 0.454, NA, NA, 1.39, NA, 5.553, NA, 5.766, NA, + 0.739, 7.4, 5.1, 4.7, 5.1, NA, 7, 17.4, 23, 10, rep(NA, 5)) +REco.params$model[, Biomass := biomass] + +``` + +Note the use of the operator ':=' to assign values. This is unique to data tables. + +```{r Model Table partial, echo = F} +knitr::kable(REco.params$model[, list(Group, Type, Biomass, EE)], + caption = 'Example of assigning a specific slot or a whole column') + +``` + +Here are the rest of the columns for the model list. +```{r Model Table sans stanzas} +#Model +biomass <- c(0.0149, 0.454, NA, NA, 1.39, NA, 5.553, NA, 5.766, NA, + 0.739, 7.4, 5.1, 4.7, 5.1, NA, 7, 17.4, 23, 10, rep(NA, 5)) + +pb <- c(0.098, 0.031, 0.100, 2.026, 0.42, 2.1, 0.425, 1.5, 0.26, 1.1, 0.18, 0.6, + 0.61, 0.65, 1.5, 0.9, 1.3, 7, 39, 240, rep(NA, 5)) + +qb <- c(76.750, 6.976, 34.455, NA, 2.19, NA, 3.78, NA, 1.44, NA, 1.69, + 1.764, 3.52, 5.65, 3.6, 2.984, rep (NA, 9)) + +REco.params$model[, Biomass := biomass] +REco.params$model[, PB := pb] +REco.params$model[, QB := qb] + +#EE for groups w/o biomass +REco.params$model[Group %in% c('Seals', 'Megabenthos'), EE := 0.8] + +#Production to Consumption for those groups without a QB +REco.params$model[Group %in% c('Shellfish', 'Zooplankton'), ProdCons:= 0.25] +REco.params$model[Group == 'Macrobenthos', ProdCons := 0.35] + +#Biomass accumulation and unassimilated consumption +REco.params$model[, BioAcc := c(rep(0, 22), rep(NA, 3))] +REco.params$model[, Unassim := c(rep(0.2, 18), 0.4, rep(0, 3), rep(NA, 3))] + +#Detrital Fate +REco.params$model[, Detritus := c(rep(1, 20), rep(0, 5))] +REco.params$model[, Discards := c(rep(0, 22), rep(1, 3))] + +#Fisheries +#Landings +trawl <- c(rep(0, 4), 0.08, 0, 0.32, 0, 0.09, 0, 0.05, 0.2, rep(0, 10), rep(NA, 3)) +mid <- c(rep(0, 12), 0.3, 0.08, 0.02, rep(0, 7), rep(NA, 3)) +dredge <- c(rep(0, 15), 0.1, 0.5, rep(0, 5), rep(NA, 3)) +REco.params$model[, Trawlers := trawl] +REco.params$model[, Midwater := mid] +REco.params$model[, Dredgers := dredge] + +#Discards +trawl.d <- c(1e-5, 1e-7, 0.001, 0.001, 0.005, 0.001, 0.009, 0.001, 0.04, 0.001, + 0.01, 0.08, 0.001, 0.001, 0.001, rep(0, 7), rep(NA, 3)) +mid.d <- c(rep(0, 2), 0.001, 0.001, 0.01, 0.001, 0.01, rep(0, 4), 0.05, 0.05, + 0.01, 0.01, rep(0, 7), rep(NA, 3)) +dredge.d <- c(rep(0, 3), 0.001, 0.05, 0.001, 0.05, 0.001, 0.05, 0.001, 0.01, 0.05, + rep(0, 3), 0.09, 0.01, 1e-4, rep(0, 4), rep(NA, 3)) +REco.params$model[, Trawlers.disc := trawl.d] +REco.params$model[, Midwater.disc := mid.d] +REco.params$model[, Dredgers.disc := dredge.d] +``` + +```{r Model Table final, echo = F} +knitr::kable(REco.params$model, + caption = 'Example of completed model list') + +``` + +###Stanza Parameters +You may have noticed that the biomass and consumption to biomass parameters are +missing from some of the multistanza groups. Similar to EwE, Rpath calculates those +parameters to ensure that stanza groups support one another (Christensen and Walters +2004^[Christensen and Walters. 2004. Ecopath with Ecosim: methods, capabilities and +limitations. Ecological Modelling 172:109-139]). In order to do this, you need to +populate the stanza list. As mentioned earlier, this is actually a list itself +containing 3 things: the number of stanza groups, stanza group parameters, and +individual stanza parameters. The number of stanzas is automatically populated. For +stanza groups you need their von Bertalanffy growth function specialized K and weight at +50% maturity divided by their weight infinity (relative weight at maturity). Individual +stanzas need the first and last month the species is in the stanza, the total mortality +(Z) on the stanza, and whether or not it is the leading stanza. + +```{r Stanza parameters} +#Group parameters +REco.params$stanzas$stgroups[, VBGF_Ksp := c(0.145, 0.295, 0.0761, 0.112)] +REco.params$stanzas$stgroups[, Wmat := c(0.0769, 0.561, 0.117, 0.321)] + +#Individual stanza parameters +REco.params$stanzas$stindiv[, First := c(rep(c(0, 24), 3), 0, 48)] +REco.params$stanzas$stindiv[, Last := c(rep(c(23, 400), 3), 47, 400)] +REco.params$stanzas$stindiv[, Z := c(2.026, 0.42, 2.1, 0.425, 1.5, + 0.26, 1.1, 0.18)] +REco.params$stanzas$stindiv[, Leading := rep(c(F, T), 4)] + +``` +```{r Stanza Table initial, echo = F} +knitr::kable(REco.params$stanzas$stgroups) +knitr::kable(REco.params$stanzas$stindiv) +``` + +The final month of the ultimate stanza can be set to any value. The function +`rpath.stanzas` will calculate the final month as the point where the species reaches +90% Winf. The function `rpath.stanzas` will also add data tables containing the weight, number, and consumption at age for each stanza group. + +```{r rpath.stanzas} +REco.params <- rpath.stanzas(REco.params) +``` +```{r Stanza Table final, echo = F} +knitr::kable(REco.params$stanzas$stanzas, caption = 'Completed stanzas table') +knitr::kable(head(REco.params$stanzas$StGroup[[1]]), + caption = 'Example of the StGroup data table') +``` + +Output from the `rpath.stanzas` function can be plotted using the `stanzaplot` +function. +```{r stanzaplot, fig.align = 'center', fig.height = 5, fig.width = 9} +stanzaplot(REco.params, StanzaGroup = 1) +``` +Note: If you do not have multistanza groups in your model, you do not have to run +`rpath.stanzas`. + +###Diet Parameters +The data entered in the diet list is the same as the data entered in the +diet composition tab in EwE. Just as within EwE, the columns +represent the predators while the rows represent the prey. Individual diet components +can be adjusted by specifying the prey in the 'Group' variable and assigning a value to +the predator. For example, if you wanted to assign 10% of the seabird diet as 'Other Groundfish' you could do it like this: + +```{r how to fill diet 1} +REco.params$diet[Group == 'OtherGroundfish', Seabirds := 0.1] +``` + +You can also assign the entire diet composition for a predator: + +```{r how to fill diet 2} +whale.diet <- c(rep(NA, 3), 0.01, NA, 0.01, NA, 0.01, NA, 0.01, rep(NA, 4), 0.1, + rep(NA, 3), 0.86, rep(NA, 3), NA) +REco.params$diet[, Whales := whale.diet] +``` +```{r Dietfile table partial, echo = F} +knitr::kable(REco.params$diet[, list(Group, Seabirds, Whales)]) +``` + +Here is the completed model parameter file for R Ecosystem: + +```{r diet fill} +REco.params$diet[, Seabirds := c(rep(NA, 11), 0.1, 0.25, 0.2, 0.15, + rep(NA, 6), 0.3, NA)] +REco.params$diet[, Whales := c(rep(NA, 3), 0.01, NA, 0.01, NA, 0.01, + NA, 0.01, rep(NA, 4), 0.1, rep(NA, 3), + 0.86, rep(NA, 3), NA)] +REco.params$diet[, Seals := c(rep(NA, 3), 0.05, 0.1, 0.05, 0.2, 0.005, + 0.05, 0.005, 0.01, 0.24, rep(0.05, 4), + 0.09, rep(NA, 5), NA)] +REco.params$diet[, JuvRoundfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, + rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, + 0.1, 0.05, NA, NA)] +REco.params$diet[, AduRoundfish1 := c(rep(NA, 5), 1e-3, 0.01, 1e-3, 0.05, 1e-3, + 0.01, 0.29, 0.1, 0.1, 0.347, 0.03, NA, + 0.05, 0.01, rep(NA, 3), NA)] +REco.params$diet[, JuvRoundfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, + rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, + 0.1, .05, NA, NA)] +REco.params$diet[, AduRoundfish2 := c(rep(NA, 3), 1e-4, NA, 1e-4, NA, rep(1e-4, 4), + 0.1, rep(0.05, 3), 0.2684, 0.01, 0.37, 0.001, + NA, 0.1, NA, NA)] +REco.params$diet[, JuvFlatfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), + rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, + NA, NA)] +REco.params$diet[, AduFlatfish1 := c(rep(NA, 7), rep(1e-4, 5), rep(NA, 2), 0.001, + 0.05, 0.001, 0.6, 0.2475, NA, 0.1, NA, NA)] +REco.params$diet[, JuvFlatfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), + rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, + NA, NA)] +REco.params$diet[, AduFlatfish2 := c(rep(NA, 7), 1e-4, NA, 1e-4, rep(NA, 4), + rep(1e-4, 3), 0.44, 0.3895, NA, 0.17, NA, NA)] +REco.params$diet[, OtherGroundfish := c(rep(NA, 3), rep(1e-4, 8), 0.05, 0.08, 0.0992, + 0.3, 0.15, 0.01, 0.3, 0.01, rep(NA, 3), NA)] +REco.params$diet[, Foragefish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, Foragefish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, OtherForagefish := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, Megabenthos := c(rep(NA, 15), 0.1, 0.03, 0.55, rep(NA, 2), 0.32, + NA, NA)] +REco.params$diet[, Shellfish := c(rep(NA, 18), 0.3, 0.5, 0.2, NA, NA)] +REco.params$diet[, Macrobenthos := c(rep(NA, 16), 0.01, rep(0.2, 2), NA, 0.59, NA, NA)] +REco.params$diet[, Zooplankton := c(rep(NA, 18), 0.2, 0.6, 0.2, NA, NA)] +``` +```{r Dietfile Table, echo = F} +knitr::kable(REco.params$diet, caption = 'Diet parameters for R Ecosystem') +``` + +###Pedigree parameters +Rpath does not currently use pedigrees however, future Rpath extensions will use +them. Therefore we include them in the current parameter object. The +default values are 1 (low confidence). These defaults are not changed for R +Ecosystem but can obviously be changed in a similar manner to the other parameter +files. +```{r pedigree table, echo = F} +knitr::kable(REco.params$pedigree, caption = 'Pedigree parameters for R Ecosystem') +``` + diff --git a/vignettes/Rpath.Rmd b/vignettes/Rpath.Rmd index 2d4535f9..139176e5 100644 --- a/vignettes/Rpath.Rmd +++ b/vignettes/Rpath.Rmd @@ -1,353 +1,33 @@ --- -title: "Rpath using R Ecosystem" +title: "Rpath: an open source food web model" author: "Sean M. Lucey" date: "`r Sys.Date()`" output: rmarkdown::html_vignette +csl: "ices-journal-of-marine-science.csl" +bibliography: references.bib +link-citations: yes +urlcolor: blue vignette: > - %\VignetteIndexEntry{Rpath using R Ecosystem} + %\VignetteIndexEntry{Getting Started} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- -Rpath is an implementation of the ecosystem model Ecopath with Ecosim (EwE; -Christensen and Pauly 1992^[Christensen and Pauly. 1992. ECOPATH II - a software -for balancing steady-state models and calculating network characteristics. -Ecological Modelling 61:169-85], Walters et al. 1997^[Walters et al. 1997. -Structuring dynamic models of exploited ecosystems from trophic mass-balance -assessments. Reviews of Fish Biology and Fisheries 7:1-34]). This vignette -describes some of the basic functionality of the package using a fictional -ecosystem, R Ecosystem. Any resemblance to an actual ecosystem is purely -coincidental. To see the underlying mathematics please refer to Lucey et al. -(in prep^[Lucey et al. in prep. Improving the EBFM toolbox with an alternative -open source version of Ecopath with Ecosim]). +Rpath is an implementation of the ecosystem model Ecopath with Ecosim (EwE; @polovina_model_1984; @christensen_ecopath_1992; @walters_structuring_1997; @christensen_ecopath_2004; @walters_fisheries_2004; @walters_ecosim_2008). -```{r rpath load, echo = F} -knitr::opts_chunk$set( - comment = '#>', - collapse = T) -library(Rpath); library(data.table) -``` +Articles for [model setup](articles/ModelSetup.html), [running Rpath](articles/RunRpath.html) and [running Rsim](articles/RunRsim.html) describe some of the basic functionality of the package using a fictional ecosystem, R Ecosystem. Any resemblance to an actual ecosystem is purely coincidental. -## Setting up Ecopath +To see the underlying mathematics please refer to @lucey_conducting_2020. For additional features, see @whitehouse_assessing_2020 for ecosense and @lucey_evaluating_2021 for management strategy evaluation capability. -### Parameter file generation -Unlike the GUI based EwE software package, Rpath relies on a parameter input file. -This file is actually a list of several different parameter files: model, diet, -stanzas, and pedigree. Parameter files can be created outside of R and read in using -the `read.rpath.params` function. This function will merge several different flat -files into an R object of the list type. A preferred alternative is to generate -the list file and populate it completely within R. The function -`create.rpath.params` will generate an Rpath.param. This ensures that all -of the correct columns are present in the parameter file. +# Installation -The parameter file contains all of the information you would normally enter in the -input data tabs in EwE. There are 2 necessary pieces of information to generate -the parameter file: the group names and their corresponding type. The types are: -living = 0, primary producer = 1, detritus = 2, and fleet = 3. If your model -contains multi-stanza groups then you need 2 additional pieces of information: -stanza group names (include NA for those groups not in a stanza) and the number of -stanzas per stanza group. +If necessary, first install the `remotes` package: `install.packages("remotes")` -```{r groups} -#Groups and types for the R Ecosystem - -groups <- c('Seabirds', 'Whales', 'Seals', 'JuvRoundfish1', 'AduRoundfish1', - 'JuvRoundfish2', 'AduRoundfish2', 'JuvFlatfish1', 'AduFlatfish1', - 'JuvFlatfish2', 'AduFlatfish2', 'OtherGroundfish', 'Foragefish1', - 'Foragefish2', 'OtherForagefish', 'Megabenthos', 'Shellfish', - 'Macrobenthos', 'Zooplankton', 'Phytoplankton', 'Detritus', - 'Discards', 'Trawlers', 'Midwater', 'Dredgers') - -types <- c(rep(0, 19), 1, rep(2, 2), rep(3, 3)) - -stgroups <- c(rep(NA, 3), rep('Roundfish1', 2), rep('Roundfish2', 2), - rep('Flatfish1', 2), rep('Flatfish2', 2), rep(NA, 14)) - -REco.params <- create.rpath.params(group = groups, type = types, stgroup = stgroups) -``` - -REco.params now contains a list of 4 objects: model, diet, stanzas, and pedigree. -The majority of the parameters are populated with NA save those that have logical -default vaules (i.e 0.66667 for VBGF_d). - -### Model parameters -The model parameter list contains the biomass, production to biomass, consumption to -biomass, etc. parameters as well as the detrital fate parameters and fleet landings and -discards. - -```{r blank modfile table, echo=FALSE, results='asis'} -knitr::kable(REco.params$model, caption = 'Example of the model list created using the - `create.rpath.param` function') -``` - -Each of the parameter lists are data tables (With the exception of the stanzas list -which is itself a list of an integer and two data tables). Data tables are an -extension of the classic data frame class. Advantages of data tables include -simplified indexing which eases the process of populating the parameters. For example -you can add data to a specific slot or fill an entire column. - -```{r How to fill} -#Example of filling specific slots -REco.params$model[Group %in% c('Seals', 'Megabenthos'), EE := 0.8] - -#Example of filling an entire column -biomass <- c(0.0149, 0.454, NA, NA, 1.39, NA, 5.553, NA, 5.766, NA, - 0.739, 7.4, 5.1, 4.7, 5.1, NA, 7, 17.4, 23, 10, rep(NA, 5)) -REco.params$model[, Biomass := biomass] - -``` - -Note the use of the operator ':=' to assign values. This is unique to data tables. - -```{r Model Table partial, echo = F} -knitr::kable(REco.params$model[, list(Group, Type, Biomass, EE)], - caption = 'Example of assigning a specific slot or a whole column') - -``` - -Here are the rest of the columns for the model list. -```{r Model Table sans stanzas} -#Model -biomass <- c(0.0149, 0.454, NA, NA, 1.39, NA, 5.553, NA, 5.766, NA, - 0.739, 7.4, 5.1, 4.7, 5.1, NA, 7, 17.4, 23, 10, rep(NA, 5)) - -pb <- c(0.098, 0.031, 0.100, 2.026, 0.42, 2.1, 0.425, 1.5, 0.26, 1.1, 0.18, 0.6, - 0.61, 0.65, 1.5, 0.9, 1.3, 7, 39, 240, rep(NA, 5)) - -qb <- c(76.750, 6.976, 34.455, NA, 2.19, NA, 3.78, NA, 1.44, NA, 1.69, - 1.764, 3.52, 5.65, 3.6, 2.984, rep (NA, 9)) - -REco.params$model[, Biomass := biomass] -REco.params$model[, PB := pb] -REco.params$model[, QB := qb] - -#EE for groups w/o biomass -REco.params$model[Group %in% c('Seals', 'Megabenthos'), EE := 0.8] - -#Production to Consumption for those groups without a QB -REco.params$model[Group %in% c('Shellfish', 'Zooplankton'), ProdCons:= 0.25] -REco.params$model[Group == 'Macrobenthos', ProdCons := 0.35] - -#Biomass accumulation and unassimilated consumption -REco.params$model[, BioAcc := c(rep(0, 22), rep(NA, 3))] -REco.params$model[, Unassim := c(rep(0.2, 18), 0.4, rep(0, 3), rep(NA, 3))] - -#Detrital Fate -REco.params$model[, Detritus := c(rep(1, 20), rep(0, 5))] -REco.params$model[, Discards := c(rep(0, 22), rep(1, 3))] - -#Fisheries -#Landings -trawl <- c(rep(0, 4), 0.08, 0, 0.32, 0, 0.09, 0, 0.05, 0.2, rep(0, 10), rep(NA, 3)) -mid <- c(rep(0, 12), 0.3, 0.08, 0.02, rep(0, 7), rep(NA, 3)) -dredge <- c(rep(0, 15), 0.1, 0.5, rep(0, 5), rep(NA, 3)) -REco.params$model[, Trawlers := trawl] -REco.params$model[, Midwater := mid] -REco.params$model[, Dredgers := dredge] - -#Discards -trawl.d <- c(1e-5, 1e-7, 0.001, 0.001, 0.005, 0.001, 0.009, 0.001, 0.04, 0.001, - 0.01, 0.08, 0.001, 0.001, 0.001, rep(0, 7), rep(NA, 3)) -mid.d <- c(rep(0, 2), 0.001, 0.001, 0.01, 0.001, 0.01, rep(0, 4), 0.05, 0.05, - 0.01, 0.01, rep(0, 7), rep(NA, 3)) -dredge.d <- c(rep(0, 3), 0.001, 0.05, 0.001, 0.05, 0.001, 0.05, 0.001, 0.01, 0.05, - rep(0, 3), 0.09, 0.01, 1e-4, rep(0, 4), rep(NA, 3)) -REco.params$model[, Trawlers.disc := trawl.d] -REco.params$model[, Midwater.disc := mid.d] -REco.params$model[, Dredgers.disc := dredge.d] -``` - -```{r Model Table final, echo = F} -knitr::kable(REco.params$model, - caption = 'Example of completed model list') - -``` - -###Stanza Parameters -You may have noticed that the biomass and consumption to biomass parameters are -missing from some of the multistanza groups. Similar to EwE, Rpath calculates those -parameters to ensure that stanza groups support one another (Christensen and Walters -2004^[Christensen and Walters. 2004. Ecopath with Ecosim: methods, capabilities and -limitations. Ecological Modelling 172:109-139]). In order to do this, you need to -populate the stanza list. As mentioned earlier, this is actually a list itself -containing 3 things: the number of stanza groups, stanza group parameters, and -individual stanza parameters. The number of stanzas is automatically populated. For -stanza groups you need their von Bertalanffy growth function specialized K and weight at -50% maturity divided by their weight infinity (relative weight at maturity). Individual -stanzas need the first and last month the species is in the stanza, the total mortality -(Z) on the stanza, and whether or not it is the leading stanza. - -```{r Stanza parameters} -#Group parameters -REco.params$stanzas$stgroups[, VBGF_Ksp := c(0.145, 0.295, 0.0761, 0.112)] -REco.params$stanzas$stgroups[, Wmat := c(0.0769, 0.561, 0.117, 0.321)] - -#Individual stanza parameters -REco.params$stanzas$stindiv[, First := c(rep(c(0, 24), 3), 0, 48)] -REco.params$stanzas$stindiv[, Last := c(rep(c(23, 400), 3), 47, 400)] -REco.params$stanzas$stindiv[, Z := c(2.026, 0.42, 2.1, 0.425, 1.5, - 0.26, 1.1, 0.18)] -REco.params$stanzas$stindiv[, Leading := rep(c(F, T), 4)] - -``` -```{r Stanza Table initial, echo = F} -knitr::kable(REco.params$stanzas$stgroups) -knitr::kable(REco.params$stanzas$stindiv) -``` - -The final month of the ultimate stanza can be set to any value. The function -`rpath.stanzas` will calculate the final month as the point where the species reaches -90% Winf. The function `rpath.stanzas` will also add data tables containing the weight, number, and consumption at age for each stanza group. - -```{r rpath.stanzas} -REco.params <- rpath.stanzas(REco.params) -``` -```{r Stanza Table final, echo = F} -knitr::kable(REco.params$stanzas$stanzas, caption = 'Completed stanzas table') -knitr::kable(head(REco.params$stanzas$StGroup[[1]]), - caption = 'Example of the StGroup data table') -``` - -Output from the `rpath.stanzas` function can be plotted using the `stanzaplot` -function. -```{r stanzaplot, fig.align = 'center', fig.height = 5, fig.width = 9} -stanzaplot(REco.params, StanzaGroup = 1) -``` -Note: If you do not have multistanza groups in your model, you do not have to run -`rpath.stanzas`. - -###Diet Parameters -The data entered in the diet list is the same as the data entered in the -diet composition tab in EwE. Just as within EwE, the columns -represent the predators while the rows represent the prey. Individual diet components -can be adjusted by specifying the prey in the 'Group' variable and assigning a value to -the predator. For example, if you wanted to assign 10% of the seabird diet as 'Other Groundfish' you could do it like this: - -```{r how to fill diet 1} -REco.params$diet[Group == 'OtherGroundfish', Seabirds := 0.1] -``` - -You can also assign the entire diet composition for a predator: - -```{r how to fill diet 2} -whale.diet <- c(rep(NA, 3), 0.01, NA, 0.01, NA, 0.01, NA, 0.01, rep(NA, 4), 0.1, - rep(NA, 3), 0.86, rep(NA, 3), NA) -REco.params$diet[, Whales := whale.diet] -``` -```{r Dietfile table partial, echo = F} -knitr::kable(REco.params$diet[, list(Group, Seabirds, Whales)]) -``` - -Here is the completed model parameter file for R Ecosystem: - -```{r diet fill} -REco.params$diet[, Seabirds := c(rep(NA, 11), 0.1, 0.25, 0.2, 0.15, - rep(NA, 6), 0.3, NA)] -REco.params$diet[, Whales := c(rep(NA, 3), 0.01, NA, 0.01, NA, 0.01, - NA, 0.01, rep(NA, 4), 0.1, rep(NA, 3), - 0.86, rep(NA, 3), NA)] -REco.params$diet[, Seals := c(rep(NA, 3), 0.05, 0.1, 0.05, 0.2, 0.005, - 0.05, 0.005, 0.01, 0.24, rep(0.05, 4), - 0.09, rep(NA, 5), NA)] -REco.params$diet[, JuvRoundfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, - rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, - 0.1, 0.05, NA, NA)] -REco.params$diet[, AduRoundfish1 := c(rep(NA, 5), 1e-3, 0.01, 1e-3, 0.05, 1e-3, - 0.01, 0.29, 0.1, 0.1, 0.347, 0.03, NA, - 0.05, 0.01, rep(NA, 3), NA)] -REco.params$diet[, JuvRoundfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, - rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, - 0.1, .05, NA, NA)] -REco.params$diet[, AduRoundfish2 := c(rep(NA, 3), 1e-4, NA, 1e-4, NA, rep(1e-4, 4), - 0.1, rep(0.05, 3), 0.2684, 0.01, 0.37, 0.001, - NA, 0.1, NA, NA)] -REco.params$diet[, JuvFlatfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), - rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, - NA, NA)] -REco.params$diet[, AduFlatfish1 := c(rep(NA, 7), rep(1e-4, 5), rep(NA, 2), 0.001, - 0.05, 0.001, 0.6, 0.2475, NA, 0.1, NA, NA)] -REco.params$diet[, JuvFlatfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), - rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, - NA, NA)] -REco.params$diet[, AduFlatfish2 := c(rep(NA, 7), 1e-4, NA, 1e-4, rep(NA, 4), - rep(1e-4, 3), 0.44, 0.3895, NA, 0.17, NA, NA)] -REco.params$diet[, OtherGroundfish := c(rep(NA, 3), rep(1e-4, 8), 0.05, 0.08, 0.0992, - 0.3, 0.15, 0.01, 0.3, 0.01, rep(NA, 3), NA)] -REco.params$diet[, Foragefish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), - 0.8196, 0.06, 0.12, NA, NA)] -REco.params$diet[, Foragefish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), - 0.8196, 0.06, 0.12, NA, NA)] -REco.params$diet[, OtherForagefish := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), - 0.8196, 0.06, 0.12, NA, NA)] -REco.params$diet[, Megabenthos := c(rep(NA, 15), 0.1, 0.03, 0.55, rep(NA, 2), 0.32, - NA, NA)] -REco.params$diet[, Shellfish := c(rep(NA, 18), 0.3, 0.5, 0.2, NA, NA)] -REco.params$diet[, Macrobenthos := c(rep(NA, 16), 0.01, rep(0.2, 2), NA, 0.59, NA, NA)] -REco.params$diet[, Zooplankton := c(rep(NA, 18), 0.2, 0.6, 0.2, NA, NA)] -``` -```{r Dietfile Table, echo = F} -knitr::kable(REco.params$diet, caption = 'Diet parameters for R Ecosystem') -``` - -###Pedigree parameters -Rpath does not currently use pedigrees however, future Rpath extensions will use -them. Therefore we include them in the current parameter object. The -default values are 1 (low confidence). These defaults are not changed for R -Ecosystem but can obviously be changed in a similar manner to the other parameter -files. -```{r pedigree table, echo = F} -knitr::kable(REco.params$pedigree, caption = 'Pedigree parameters for R Ecosystem') -``` - -## Running Ecopath - -After creating the parameter object, running ecopath in R is relatively -straightforward. It is just the function `rpath` supplied with the parameter object. -Additionally, you can supply an ecosystem name for the output. - -```{r Running ecopath} -REco <- rpath(REco.params, eco.name = 'R Ecosystem') -REco -``` - -The output object from `rpath` is an S3 object type called 'Rpath'. Rpath objects -are a list of parameters from the mass balance. However, the `print` function will -display the same information as the "Basic Estimates" tab from EwE. You will also -notice that the `print` function will display whether the model is balanced or not. -If the model was not balanced, it would list the groups that are not balanced. - -You can also display the mortalities associated with each group by supplying the -argument `morts = T` to the `print` function. - -```{r Ecopath morts} -print(REco, morts = T) -``` - -Note that if you wish to save the `print` output you need to use the function -`write.rpath`. This function will also accept the argument 'morts = T'. - -The generic function `summary` will display some summary statistics on the model -as well as a list of attributes you can access. To access any of the other -attributes simply use the standard list notation. - -```{r Ecopath summaries} -summary(REco) -REco$TL -``` - -One of the advantages of R is its graphical ability. Users can feel free to develop -their own graphical routines for the Rpath outputs. However, we have included -a basic food web plot. The routine can include fisheries, display group numbers or -names, and even highlight a particular group. - -```{r Food Web Plots, fig.align = 'center', fig.height = 7, fig.width = 7} -webplot(REco) -webplot(REco, labels = T) -webplot(REco, fleets = T, highlight = 'AduRoundfish1') -``` +Use the command `remotes::install_github("noaa-edab/Rpath",build_vignettes=TRUE)` to install Rpath. +# References diff --git a/vignettes/RunRpath.Rmd b/vignettes/RunRpath.Rmd new file mode 100644 index 00000000..c5bc7b64 --- /dev/null +++ b/vignettes/RunRpath.Rmd @@ -0,0 +1,193 @@ +--- +title: "Create a static food web model in Rpath" +author: "Vignette Author" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Running Rpath} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +library(Rpath); library(data.table) +``` + +## Running Rpath + +```{r creating Rpath object, echo = F} +#Groups and types for the R Ecosystem + +groups <- c('Seabirds', 'Whales', 'Seals', 'JuvRoundfish1', 'AduRoundfish1', + 'JuvRoundfish2', 'AduRoundfish2', 'JuvFlatfish1', 'AduFlatfish1', + 'JuvFlatfish2', 'AduFlatfish2', 'OtherGroundfish', 'Foragefish1', + 'Foragefish2', 'OtherForagefish', 'Megabenthos', 'Shellfish', + 'Macrobenthos', 'Zooplankton', 'Phytoplankton', 'Detritus', + 'Discards', 'Trawlers', 'Midwater', 'Dredgers') + +types <- c(rep(0, 19), 1, rep(2, 2), rep(3, 3)) + +stgroups <- c(rep(NA, 3), rep('Roundfish1', 2), rep('Roundfish2', 2), + rep('Flatfish1', 2), rep('Flatfish2', 2), rep(NA, 14)) + +REco.params <- create.rpath.params(group = groups, type = types, stgroup = stgroups) + +#Model +biomass <- c(0.0149, 0.454, NA, NA, 1.39, NA, 5.553, NA, 5.766, NA, + 0.739, 7.4, 5.1, 4.7, 5.1, NA, 7, 17.4, 23, 10, rep(NA, 5)) + +pb <- c(0.098, 0.031, 0.100, 2.026, 0.42, 2.1, 0.425, 1.5, 0.26, 1.1, 0.18, 0.6, + 0.61, 0.65, 1.5, 0.9, 1.3, 7, 39, 240, rep(NA, 5)) + +qb <- c(76.750, 6.976, 34.455, NA, 2.19, NA, 3.78, NA, 1.44, NA, 1.69, + 1.764, 3.52, 5.65, 3.6, 2.984, rep (NA, 9)) + +REco.params$model[, Biomass := biomass] +REco.params$model[, PB := pb] +REco.params$model[, QB := qb] + +#EE for groups w/o biomass +REco.params$model[Group %in% c('Seals', 'Megabenthos'), EE := 0.8] + +#Production to Consumption for those groups without a QB +REco.params$model[Group %in% c('Shellfish', 'Zooplankton'), ProdCons:= 0.25] +REco.params$model[Group == 'Macrobenthos', ProdCons := 0.35] + +#Biomass accumulation and unassimilated production +REco.params$model[, BioAcc := c(rep(0, 22), rep(NA, 3))] +REco.params$model[, Unassim := c(rep(0.2, 18), 0.4, rep(0, 3), rep(NA, 3))] + +#Detrital Fate +REco.params$model[, Detritus := c(rep(1, 20), rep(0, 5))] +REco.params$model[, Discards := c(rep(0, 22), rep(1, 3))] + +#Fisheries +#Landings +trawl <- c(rep(0, 4), 0.08, 0, 0.32, 0, 0.09, 0, 0.05, 0.2, rep(0, 10), rep(NA, 3)) +mid <- c(rep(0, 12), 0.3, 0.08, 0.02, rep(0, 7), rep(NA, 3)) +dredge <- c(rep(0, 15), 0.1, 0.5, rep(0, 5), rep(NA, 3)) +REco.params$model[, Trawlers := trawl] +REco.params$model[, Midwater := mid] +REco.params$model[, Dredgers := dredge] + +#Discards +trawl.d <- c(1e-5, 1e-7, 0.001, 0.001, 0.005, 0.001, 0.009, 0.001, 0.04, 0.001, + 0.01, 0.08, 0.001, 0.001, 0.001, rep(0, 7), rep(NA, 3)) +mid.d <- c(rep(0, 2), 0.001, 0.001, 0.01, 0.001, 0.01, rep(0, 4), 0.05, 0.05, + 0.01, 0.01, rep(0, 7), rep(NA, 3)) +dredge.d <- c(rep(0, 3), 0.001, 0.05, 0.001, 0.05, 0.001, 0.05, 0.001, 0.01, 0.05, + rep(0, 3), 0.09, 0.01, 1e-4, rep(0, 4), rep(NA, 3)) +REco.params$model[, Trawlers.disc := trawl.d] +REco.params$model[, Midwater.disc := mid.d] +REco.params$model[, Dredgers.disc := dredge.d] + +#Group parameters +REco.params$stanzas$stgroups[, VBGF_Ksp := c(0.145, 0.295, 0.0761, 0.112)] +REco.params$stanzas$stgroups[, Wmat := c(0.0769, 0.561, 0.117, 0.321)] + +#Individual stanza parameters +REco.params$stanzas$stindiv[, First := c(rep(c(0, 24), 3), 0, 48)] +REco.params$stanzas$stindiv[, Last := c(rep(c(23, 400), 3), 47, 400)] +REco.params$stanzas$stindiv[, Z := c(2.026, 0.42, 2.1, 0.425, 1.5, + 0.26, 1.1, 0.18)] +REco.params$stanzas$stindiv[, Leading := rep(c(F, T), 4)] + +REco.params <- rpath.stanzas(REco.params) + +#Diets +REco.params$diet[, Seabirds := c(rep(NA, 11), 0.1, 0.25, 0.2, 0.15, + rep(NA, 6), 0.3, NA)] +REco.params$diet[, Whales := c(rep(NA, 3), 0.01, NA, 0.01, NA, 0.01, + NA, 0.01, rep(NA, 4), 0.1, rep(NA, 3), + 0.86, rep(NA, 4))] +REco.params$diet[, Seals := c(rep(NA, 3), 0.05, 0.1, 0.05, 0.2, 0.005, + 0.05, 0.005, 0.01, 0.24, rep(0.05, 4), + 0.09, rep(NA, 6))] +REco.params$diet[, JuvRoundfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, + rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, + 0.1, 0.05, NA, NA)] +REco.params$diet[, AduRoundfish1 := c(rep(NA, 5), 1e-3, 0.01, 1e-3, 0.05, 1e-3, + 0.01, 0.29, 0.1, 0.1, 0.347, 0.03, NA, + 0.05, 0.01, rep(NA, 4))] +REco.params$diet[, JuvRoundfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), 1e-3, + rep(NA, 2), 0.05, 1e-4, NA, .02, 0.7785, + 0.1, .05, NA, NA)] +REco.params$diet[, AduRoundfish2 := c(rep(NA, 3), 1e-4, NA, 1e-4, NA, rep(1e-4, 4), + 0.1, rep(0.05, 3), 0.2684, 0.01, 0.37, 0.001, + NA, 0.1, NA, NA)] +REco.params$diet[, JuvFlatfish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), + rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, + NA, NA)] +REco.params$diet[, AduFlatfish1 := c(rep(NA, 7), rep(1e-4, 5), rep(NA, 2), 0.001, + 0.05, 0.001, 0.6, 0.2475, NA, 0.1, NA, NA)] +REco.params$diet[, JuvFlatfish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 3), + rep(1e-4, 2), NA, 0.416, 0.4334, 0.1, 0.05, + NA, NA)] +REco.params$diet[, AduFlatfish2 := c(rep(NA, 7), 1e-4, NA, 1e-4, rep(NA, 4), + rep(1e-4, 3), 0.44, 0.3895, NA, 0.17, NA, NA)] +REco.params$diet[, OtherGroundfish := c(rep(NA, 3), rep(1e-4, 8), 0.05, 0.08, 0.0992, + 0.3, 0.15, 0.01, 0.3, 0.01, rep(NA, 4))] +REco.params$diet[, Foragefish1 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, Foragefish2 := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, OtherForagefish := c(rep(NA, 3), rep(c(1e-4, NA), 4), rep(NA, 7), + 0.8196, 0.06, 0.12, NA, NA)] +REco.params$diet[, Megabenthos := c(rep(NA, 15), 0.1, 0.03, 0.55, rep(NA, 2), 0.32, + NA, NA)] +REco.params$diet[, Shellfish := c(rep(NA, 18), 0.3, 0.5, 0.2, NA, NA)] +REco.params$diet[, Macrobenthos := c(rep(NA, 16), 0.01, rep(0.2, 2), NA, 0.59, NA, NA)] +REco.params$diet[, Zooplankton := c(rep(NA, 18), 0.2, 0.6, 0.2, NA, NA)] + +REco <- rpath(REco.params, eco.name = 'R Ecosystem') +``` + +After creating the parameter object, running ecopath in R is relatively +straightforward. It is just the function `rpath` supplied with the parameter object. +Additionally, you can supply an ecosystem name for the output. + +```{r Running ecopath} +REco <- rpath(REco.params, eco.name = 'R Ecosystem') +REco +``` + +The output object from `rpath` is an S3 object type called 'Rpath'. Rpath objects +are a list of parameters from the mass balance. However, the `print` function will +display the same information as the "Basic Estimates" tab from EwE. You will also +notice that the `print` function will display whether the model is balanced or not. +If the model was not balanced, it would list the groups that are not balanced. + +You can also display the mortalities associated with each group by supplying the +argument `morts = T` to the `print` function. + +```{r Ecopath morts} +print(REco, morts = T) +``` + +Note that if you wish to save the `print` output you need to use the function +`write.rpath`. This function will also accept the argument 'morts = T'. + +The generic function `summary` will display some summary statistics on the model +as well as a list of attributes you can access. To access any of the other +attributes simply use the standard list notation. + +```{r Ecopath summaries} +summary(REco) +REco$TL +``` + +One of the advantages of R is its graphical ability. Users can feel free to develop +their own graphical routines for the Rpath outputs. However, we have included +a basic food web plot. The routine can include fisheries, display group numbers or +names, and even highlight a particular group. + +```{r Food Web Plots, fig.align = 'center', fig.height = 7, fig.width = 7} +webplot(REco) +webplot(REco, labels = T) +webplot(REco, fleets = T, highlight = 'AduRoundfish1') +``` + diff --git a/vignettes/Rsim.Rmd b/vignettes/RunRsim.Rmd similarity index 91% rename from vignettes/Rsim.Rmd rename to vignettes/RunRsim.Rmd index 5620a0dd..7685ffa3 100644 --- a/vignettes/Rsim.Rmd +++ b/vignettes/RunRsim.Rmd @@ -1,5 +1,5 @@ --- -title: "Rsim using R Ecosystem" +title: "Run a dynamic food web simulation in Rsim" author: "Sean M. Lucey" date: "`r Sys.Date()`" output: rmarkdown::html_vignette @@ -9,18 +9,6 @@ vignette: > %\VignetteEncoding{UTF-8} --- -Rpath is an implementation of the ecosystem model Ecopath with Ecosim (EwE; -Christensen and Pauly 1992^[Christensen and Pauly. 1992. ECOPATH II - a software -for balancing steady-state models and calculating network characteristics. -Ecological Modelling 61:169-85], Walters et al. 1997^[Walters et al. 1997. -Structuring dynamic models of exploited ecosystems from trophic mass-balance -assessments. Reviews of Fish Biology and Fisheries 7:1-34]). This vignette -describes some of the basic functionality of the package using a fictional -ecosystem, R Ecosystem. Any resemblance to an actual ecosystem is purely -coincidental. To see the underlying mathematics please refer to Lucey et al. -(in prep^[Lucey et al. in prep. Improving the EBFM toolbox with an alternative -open source version of Ecopath with Ecosim]). - ```{r rpath load, echo = F} knitr::opts_chunk$set( comment = '#>', @@ -30,8 +18,8 @@ library(Rpath); library(data.table) ## Running rsim -Rsim is the ecosim implementation of the EwE code in R. In order to procede you -must have a valid Rpath object. The steps for setting this up are discribed in +Rsim is the ecosim implementation of the EwE code in R. In order to proceed you +must have a valid Rpath object. The steps for setting this up are described in the vignette "Rpath using R Ecosystem". ```{r creating Rpath object, echo = F} diff --git a/vignettes/UnitTests.Rmd b/vignettes/UnitTests.Rmd new file mode 100644 index 00000000..36d11997 --- /dev/null +++ b/vignettes/UnitTests.Rmd @@ -0,0 +1,220 @@ +--- +title: "Unit Tests" +author: "Ron Klasky" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Unit Tests} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- +Source: ```vignettes/UnitTests.Rmd``` +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +## Unit Tests + +Unit Tests are written using the testthat R package. The tests are stored in the file: **tests/tests_rpath.R**. They may be run explicitly by the user clicking the Test or Check buttons under the Build tab in RStudio. They also run automatically via git actions when the user does a push or pull request. The output of the unit tests is a pdf file with a variety of comparison plots, examples of which are given below in Figures 1-3. + +## Details + +Unit Tests consist of comparing a "current" model value (i.e., string, table) to a previously stored "baseline" value. Differences are shown in the testing output as well as reflected in the generated plots which are written to: **Rplots.pdf**. Difference "tolerances" are defined by the variable: + +```{r Tolerance} +TOLERANCE <- 1e-5 +``` + +which can be modified as necessary. + +### Regenerating Baseline Files + +If the user needs to regenerate the baseline files, the following variable should be set to TRUE and the tests re-run manually (by clicking the Test button under the Build tab). This will regenerate all of the baseline data files. + +```{r Create Baseline 1} +CREATE_BASELINE_FILES <- TRUE +``` + +After the baseline files have been generated, the user should reset the variable back: + +```{r Create Baseline 2} +CREATE_BASELINE_FILES <- FALSE +``` + +## List of Tests + +The following unit tests have been developed. Note that some tests consist of additional/finer tests that compare out_Biomass, out_Catch, and out_Gear_Catch* for AB (Adams-Bashforth) and RK4 (4th Order Runge Kutta) numerical differential equation methods. + +### Unit Tests + +
Is model balanced? +1. Looks for "Balanced" string in Rpath summary file output +
+ +
Does model run silent? +2. Tests if model runs without producing print statements, warnings, or error messages. +
+ +
Compare Rpath summaries +3. Is the baseline Rpath object the same as the current Rpath object? +
+ +
Compare Rpath summaries +4. Is the baseline Rpath summary the same as the current Rpath summary? +
+ +
Compare baseline AB sim run to current AB sim run +5. Checks if baseline Rpath AB sim run is same as current AB sim run (checks top level data structure only)
+6. Compare out_Biomass from baseline and current AB sim runs
+7. Compare out_Catch from baseline and current AB sim runs
+8. Compare out_Gear_Catch from baseline and current AB sim runs
+
+ +
Compare baseline RK4 sim run to current RK4 sim run +9. Checks if baseline RK4 sim run same as current RK4 sim run (checks top level data structure only)
+10. Compare out_Biomass from baseline and current RK4 sim runs
+11. Compare out_Catch from baseline and current RK4 sim runs
+12. Compare out_Gear_Catch from baseline and current RK4 sim runs
+
+ +
Compare baseline AB sim run to current RK4 sim run +13. Checks if baseline AB sim run same as current RK4 sim run (checks top level data structure only)
+14. Compare out_Biomass from baseline AB run and current RK4 sim run
+15. Compare out_Catch from baseline AB run and current RK4 sim run
+16. Compare out_Gear_Catch from baseline AB run and current RK4 sim run
+
+ +
Compare sim runs with random noise (i.e., jitter) added to \$forcing\$ForcedBio +17. Compare out_Biomass from baseline AB run and current AB run with noise added to ForcedBio
+18. Compare out_Catch from baseline AB run and current AB run with noise added to ForcedBio
+19. Compare out_Gear_Catch from baseline AB run and current AB run with noise added to ForcedBio
+20. Compare out_Biomass from baseline RK4 run and current RK4 run with noise added to ForcedBio
+21. Compare out_Catch from baseline RK4 run and current RK4 run with noise added to ForcedBio
+22. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with noise added to ForcedBio
+
+ +
Compare sim runs with random noise (i.e., jitter) added to \$forcing\$ForcedMigrate +23. Compare out_Biomass from baseline AB run and current AB run with noise added to ForcedMigrate
+24. Compare out_Catch from baseline AB run and current AB run with noise added to ForcedMigrate
+25. Compare out_Gear_Catch from baseline AB run and current AB run with noise added to ForcedMigrate
+26. Compare out_Biomass from baseline RK4 run and current RK4 run with noise added to ForcedMigrate
+27. Compare out_Catch from baseline RK4 run and current RK4 run with noise added to ForcedMigrate
+28. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with noise added to ForcedMigrate
+
+ +
Compare sim runs with stepped noise added to \$forcing\$ForcedBio +29. Compare out_Biomass from baseline AB run and current AB run with stepped noise added to ForcedBio
+30. Compare out_Catch from baseline AB run and current AB run with stepped noise added to ForcedBio
+31. Compare out_Gear_Catch from baseline AB run and current AB run with stepped noise added to ForcedBio
+32. Compare out_Biomass from baseline RK4 run and current RK4 run with stepped noise added to ForcedBio
+33. Compare out_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedBio
+34. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedBio
+
+ +
Compare sim runs with stepped noise added to \$forcing\$ForcedMigrate +35. Compare out_Biomass from baseline AB run and current AB run with stepped noise added to ForcedMigrate
+36. Compare out_Catch from baseline AB run and current AB run with stepped noise added to ForcedMigrate
+37. Compare out_Gear_Catch from baseline AB run and current AB run with stepped noise added to ForcedMigrate
+38. Compare out_Biomass from baseline RK4 run and current RK4 run with stepped noise added to ForcedMigrate
+39. Compare out_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedMigrate
+40. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedMigrate
+
+ +
Compare sim runs with random noise (i.e., jitter) added to \$fishing\$ForcedEffort +41. Compare out_Biomass from baseline AB run and current AB run with noise added to ForcedEffort
+42. Compare out_Catch from baseline AB run and current AB run with noise added to ForcedEffort
+43. Compare out_Gear_Catch from baseline AB run and current AB run with noise added to ForcedEffort
+44. Compare out_Biomass from baseline RK4 run and current RK4 run with noise added to ForcedEffort
+45. Compare out_Catch from baseline RK4 run and current RK4 run with noise added to ForcedEffort
+46. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with noise added to ForcedEffort
+
+ +
Compare sim runs with random noise (i.e., jitter) added to \$fishing\$ForcedFRate +47. Compare out_Biomass from baseline AB run and current AB run with noise added to ForcedFRate
+48. Compare out_Catch from baseline AB run and current AB run with noise added to ForcedFRate
+49. Compare out_Gear_Catch from baseline AB run and current AB run with noise added to ForcedFRate
+50. Compare out_Biomass from baseline RK4 run and current RK4 run with noise added to ForcedFRate
+51. Compare out_Catch from baseline RK4 run and current RK4 run with noise added to ForcedFRate
+52. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with noise added to ForcedFRate
+
+ +
Compare sim runs with random noise (i.e., jitter) added to \$fishing\$ForcedCatch +53. Compare out_Biomass from baseline AB run and current AB run with noise added to ForcedCatch
+54. Compare out_Catch from baseline AB run and current AB run with noise added to ForcedCatch
+55. Compare out_Gear_Catch from baseline AB run and current AB run with noise added to ForcedCatch
+56. Compare out_Biomass from baseline RK4 run and current RK4 run with noise added to ForcedCatch
+57. Compare out_Catch from baseline RK4 run and current RK4 run with noise added to ForcedCatch
+58. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with noise added to ForcedCatch
+
+ +
Compare sim runs with stepped noise added to \$fishing\$ForcedEffort +59. Compare out_Biomass from baseline AB run and current AB run with stepped noise added to ForcedEffort
+60. Compare out_Catch from baseline AB run and current AB run with stepped noise added to ForcedEffort
+61. Compare out_Gear_Catch from baseline AB run and current AB run with stepped noise added to ForcedEffort
+62. Compare out_Biomass from baseline RK4 run and current RK4 run with stepped noise added to ForcedEffort
+63. Compare out_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedEffort
+64. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedEffort
+
+ +
Compare sim runs with stepped noise added to \$fishing\$ForcedFRate +65. Compare out_Biomass from baseline AB run and current AB run with stepped noise added to ForcedFRate
+66. Compare out_Catch from baseline AB run and current AB run with stepped noise added to ForcedFRate
+67. Compare out_Gear_Catch from baseline AB run and current AB run with stepped noise added to ForcedFRate
+68. Compare out_Biomass from baseline RK4 run and current RK4 run with stepped noise added to ForcedFRate
+69. Compare out_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedFRate
+70. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedFRate
+
+ +
Compare sim runs with stepped noise added to \$fishing\$ForcedCatch +71. Compare out_Biomass from baseline AB run and current AB run with stepped noise added to ForcedCatch
+72. Compare out_Catch from baseline AB run and current AB run with stepped noise added to ForcedCatch
+73. Compare out_Gear_Catch from baseline AB run and current AB run with stepped noise added to ForcedCatch
+74. Compare out_Biomass from baseline RK4 run and current RK4 run with stepped noise added to ForcedCatch
+75. Compare out_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedCatch
+76. Compare out_Gear_Catch from baseline RK4 run and current RK4 run with stepped noise added to ForcedCatch
+
+
+*The out_Gear_Catch tests are currently awaiting issue #74 to be resolved. + +## Figures + +The Unit Tests compare current runs with baseline runs and produce plots in a pdf file. These plots may be useful for diagnostic purposes. The plots depict the output of a current run in blue and of the baseline run in red. If there are no errors, then there should be no red visible on the plots. There are two types of plots available, also set by a variable in tests/tests_rpath.R: + +```{r Plot Type 1} +PLOT_TYPE <- 1 +``` + +If PLOT_TYPE is set to 1, then the plot depicts the current model in blue superimposed over the baseline model in red. If PLOT_TYPE is set to 2, then the difference (current-baseline) is displayed. + +## Example plots: + +Figure 1 depicts an Rpath Simulation run of Biomass Density vs Time for 3 species. The ```REcosystem_scene$forcing$ForcedBio``` table, where + +``` {r ForcedBio, eval=FALSE} + REcosystem_scene <- rsim.scenario(REco, REco.params, 1:50) +``` + +has been modified with random noise. Both the baseline and current model runs use the AB (Adams-Bashforth) numerical differential equation method. Notice that there is no red line visible in this plot. That is, the current (blue) line is identical (and covers completely) the baseline (red) plot. +

+ +```{r figs1, echo=FALSE, out.width="85%:", out.height="85%", fig.cap="Figure 1. No Difference in Baseline vs Current Models"} +knitr::include_graphics("img/plot_01_no_difference.png") +``` +

+Figure 2 depicts the same information as Figure 1 with the difference being that the randomization factor was slightly changed in the current model from what was used in the baseline model. This was done to only to highlight how the plot would appear if the current model deviated from the baseline. Notice that the underlying baseline plot (in red) is now clearly visible. +

+```{r figs2, echo=FALSE, out.width="85%:", out.height="85%", fig.cap="Figure 2. Difference in red of Baseline vs Current Models"} +knitr::include_graphics("img/plot_02_superimposed_with_difference.png") +``` +

+Figure 3 shows the difference of the current and baseline models. If the models were identical, the difference would be 0, and the plots should be completely flat lines. This plot shows the current-baseline plots for the data shown in Figure 2. Notice that the plot lines are not completely flat, denoting that the difference is not 0. The scale of the y-axis may be modified by changing the following line in **tests/tests_rpath.R**: + +``` {r scale} +YLIMIT_DIFFERENCE_PLOTS <- 0.05 +``` +```{r figs3, echo=FALSE, out.width="85%:", out.height="85%", fig.cap="Figure 3. Current-Baseline Result"} +knitr::include_graphics("img/plot_03_current-baseline.png") +``` diff --git a/vignettes/UnitTests.html b/vignettes/UnitTests.html new file mode 100644 index 00000000..1f0b8727 --- /dev/null +++ b/vignettes/UnitTests.html @@ -0,0 +1,736 @@ + + + + + + + + + + + + + + + + +Unit Tests + + + + + + + + + + + + + + + + + + + + + + + + + + +

Unit Tests

+

Ron Klasky

+

2024-01-13

+ + + +

Source: vignettes/UnitTests.Rmd

+
+

Unit Tests

+

Unit Tests are written using the testthat R package. The tests are +stored in the file: tests/tests_rpath.R. They may be +run explicitly by the user clicking the Test or Check buttons under the +Build tab in RStudio. They also run automatically via git actions when +the user does a push or pull request. The output of the unit tests is a +pdf file with a variety of comparison plots, examples of which are given +below in Figures 1-3.

+
+
+

Details

+

Unit Tests consist of comparing a “current” model value (i.e., +string, table) to a previously stored “baseline” value. Differences are +shown in the testing output as well as reflected in the generated plots +which are written to: Rplots.pdf. Difference +“tolerances” are defined by the variable:

+
TOLERANCE <- 1e-5
+

which can be modified as necessary.

+
+

Regenerating Baseline Files

+

If the user needs to regenerate the baseline files, the following +variable should be set to TRUE and the tests re-run manually (by +clicking the Test button under the Build tab). This will regenerate all +of the baseline data files.

+
CREATE_BASELINE_FILES <- TRUE
+

After the baseline files have been generated, the user should reset +the variable back:

+
CREATE_BASELINE_FILES <- FALSE
+
+
+
+

List of Tests

+

The following unit tests have been developed. Note that some tests +consist of additional/finer tests that compare out_Biomass, out_Catch, +and out_Gear_Catch* for AB (Adams-Bashforth) and RK4 (4th Order Runge +Kutta) numerical differential equation methods.

+
+

Unit Tests

+
+ +Is model balanced? + +
    +
  1. Looks for “Balanced” string in Rpath summary file output
  2. +
+
+
+ +Does model run silent? + +
    +
  1. Tests if model runs without producing print statements, warnings, or +error messages.
  2. +
+
+
+ +Compare Rpath summaries + +
    +
  1. Is the baseline Rpath object the same as the current Rpath +object?
  2. +
+
+
+ +Compare Rpath summaries + +
    +
  1. Is the baseline Rpath summary the same as the current Rpath +summary?
  2. +
+
+
+ +Compare baseline AB sim run to current AB sim run + +
    +
  1. Checks if baseline Rpath AB sim run is same as current AB sim run +(checks top level data structure only)
  2. +
  3. Compare out_Biomass from baseline and current AB sim runs
  4. +
  5. Compare out_Catch from baseline and current AB sim runs
  6. +
  7. Compare out_Gear_Catch from baseline and current AB sim +runs
  8. +
+
+
+ +Compare baseline RK4 sim run to current RK4 sim run + +
    +
  1. Checks if baseline RK4 sim run same as current RK4 sim run (checks +top level data structure only)
  2. +
  3. Compare out_Biomass from baseline and current RK4 sim runs
  4. +
  5. Compare out_Catch from baseline and current RK4 sim runs
  6. +
  7. Compare out_Gear_Catch from baseline and current RK4 sim +runs
  8. +
+
+
+ +Compare baseline AB sim run to current RK4 sim run + +
    +
  1. Checks if baseline AB sim run same as current RK4 sim run (checks +top level data structure only)
  2. +
  3. Compare out_Biomass from baseline AB run and current RK4 sim +run
  4. +
  5. Compare out_Catch from baseline AB run and current RK4 sim +run
  6. +
  7. Compare out_Gear_Catch from baseline AB run and current RK4 sim +run
  8. +
+
+
+ +Compare sim runs with random noise (i.e., jitter) added to +$forcing$ForcedBio + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +noise added to ForcedBio
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with noise +added to ForcedBio
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +noise added to ForcedBio
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +noise added to ForcedBio
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +noise added to ForcedBio
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with noise added to ForcedBio
  12. +
+
+
+ +Compare sim runs with random noise (i.e., jitter) added to +$forcing$ForcedMigrate + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +noise added to ForcedMigrate
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with noise +added to ForcedMigrate
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +noise added to ForcedMigrate
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +noise added to ForcedMigrate
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +noise added to ForcedMigrate
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with noise added to ForcedMigrate
  12. +
+
+
+ +Compare sim runs with stepped noise added to $forcing$ForcedBio + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +stepped noise added to ForcedBio
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with +stepped noise added to ForcedBio
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +stepped noise added to ForcedBio
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +stepped noise added to ForcedBio
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +stepped noise added to ForcedBio
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with stepped noise added to ForcedBio
  12. +
+
+
+ +Compare sim runs with stepped noise added to $forcing$ForcedMigrate + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +stepped noise added to ForcedMigrate
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with +stepped noise added to ForcedMigrate
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +stepped noise added to ForcedMigrate
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +stepped noise added to ForcedMigrate
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +stepped noise added to ForcedMigrate
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with stepped noise added to ForcedMigrate
  12. +
+
+
+ +Compare sim runs with random noise (i.e., jitter) added to +$fishing$ForcedEffort + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +noise added to ForcedEffort
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with noise +added to ForcedEffort
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +noise added to ForcedEffort
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +noise added to ForcedEffort
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +noise added to ForcedEffort
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with noise added to ForcedEffort
  12. +
+
+
+ +Compare sim runs with random noise (i.e., jitter) added to +$fishing$ForcedFRate + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +noise added to ForcedFRate
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with noise +added to ForcedFRate
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +noise added to ForcedFRate
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +noise added to ForcedFRate
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +noise added to ForcedFRate
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with noise added to ForcedFRate
  12. +
+
+
+ +Compare sim runs with random noise (i.e., jitter) added to +$fishing$ForcedCatch + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +noise added to ForcedCatch
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with noise +added to ForcedCatch
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +noise added to ForcedCatch
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +noise added to ForcedCatch
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +noise added to ForcedCatch
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with noise added to ForcedCatch
  12. +
+
+
+ +Compare sim runs with stepped noise added to $fishing$ForcedEffort + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +stepped noise added to ForcedEffort
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with +stepped noise added to ForcedEffort
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +stepped noise added to ForcedEffort
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +stepped noise added to ForcedEffort
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +stepped noise added to ForcedEffort
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with stepped noise added to ForcedEffort
  12. +
+
+
+ +Compare sim runs with stepped noise added to $fishing$ForcedFRate + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +stepped noise added to ForcedFRate
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with +stepped noise added to ForcedFRate
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +stepped noise added to ForcedFRate
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +stepped noise added to ForcedFRate
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +stepped noise added to ForcedFRate
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with stepped noise added to ForcedFRate
  12. +
+
+
+ +Compare sim runs with stepped noise added to $fishing$ForcedCatch + +
    +
  1. Compare out_Biomass from baseline AB run and current AB run with +stepped noise added to ForcedCatch
  2. +
  3. Compare out_Catch from baseline AB run and current AB run with +stepped noise added to ForcedCatch
  4. +
  5. Compare out_Gear_Catch from baseline AB run and current AB run with +stepped noise added to ForcedCatch
  6. +
  7. Compare out_Biomass from baseline RK4 run and current RK4 run with +stepped noise added to ForcedCatch
  8. +
  9. Compare out_Catch from baseline RK4 run and current RK4 run with +stepped noise added to ForcedCatch
  10. +
  11. Compare out_Gear_Catch from baseline RK4 run and current RK4 run +with stepped noise added to ForcedCatch
  12. +
+
+


*The out_Gear_Catch tests are currently awaiting issue #74 to be +resolved.

+
+
+
+

Figures

+

The Unit Tests compare current runs with baseline runs and produce +plots in a pdf file. These plots may be useful for diagnostic purposes. +The plots depict the output of a current run in blue and of the baseline +run in red. If there are no errors, then there should be no red visible +on the plots. There are two types of plots available, also set by a +variable in tests/tests_rpath.R:

+
PLOT_TYPE <- 1 
+

If PLOT_TYPE is set to 1, then the plot depicts the current model in +blue superimposed over the baseline model in red. If PLOT_TYPE is set to +2, then the difference (current-baseline) is displayed.

+
+
+

Example plots:

+

Figure 1 depicts an Rpath Simulation run of Biomass Density vs Time +for 3 species. The REcosystem_scene$forcing$ForcedBio +table, where

+
  REcosystem_scene <- rsim.scenario(REco, REco.params, 1:50)
+

has been modified with random noise. Both the baseline and current +model runs use the AB (Adams-Bashforth) numerical differential equation +method. Notice that there is no red line visible in this plot. That is, +the current (blue) line is identical (and covers completely) the +baseline (red) plot.

+
+Figure 1. No Difference in Baseline vs Current Models +

+Figure 1. No Difference in Baseline vs Current Models +

+
+

Figure 2 depicts the same information as Figure 1 with the +difference being that the randomization factor was slightly changed in +the current model from what was used in the baseline model. This was +done to only to highlight how the plot would appear if the current model +deviated from the baseline. Notice that the underlying baseline plot (in +red) is now clearly visible.

+
+Figure 2. Difference in red of Baseline vs Current Models +

+Figure 2. Difference in red of Baseline vs Current Models +

+
+



Figure 3 shows the difference of the current and baseline +models. If the models were identical, the difference would be 0, and the +plots should be completely flat lines. This plot shows the +current-baseline plots for the data shown in Figure 2. Notice that the +plot lines are not completely flat, denoting that the difference is not +0. The scale of the y-axis may be modified by changing the following +line in tests/tests_rpath.R:

+
YLIMIT_DIFFERENCE_PLOTS <- 0.05
+
+Figure 3. Current-Baseline Result +

+Figure 3. Current-Baseline Result +

+
+
+ + + + + + + + + + + diff --git a/vignettes/ecosense.Rmd b/vignettes/ecosense.Rmd index 6d24d474..c25de563 100644 --- a/vignettes/ecosense.Rmd +++ b/vignettes/ecosense.Rmd @@ -1,268 +1,301 @@ ---- -title: "ecosense_proto_vignette" -author: "George A. Whitehouse" -date: "11/15/2021" -output: html_document ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -library(Rpath); library(data.table); library(viridis) -knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) -``` - -Rpath is an R implementation of the food web modeling program Ecopath with Ecosim -(EwE; Christensen and Pauly 1992^[Christensen V, Pauly D (1992) Ecopath II-a software -for balancing steady-state ecosystem models and calculating network characteristics. -Ecol Model 61:169-185. doi:10.1016/0304-3800(92)90016-8], Walters et al. 1997^[Walters -C, Christensen V, Pauly D (1997) Structuring dynamic models of exploited ecosystems -from trophic mass-balance assessments. Rev Fish Biol Fish 7:139-172. -doi:10.1023/a:1018479526149]). For full documentation of the Rpath package see Lucey -et al. (2020^[Lucey SM, Gaichas SK, Aydin KY (2020) Conducting reproducible ecosystem -modeling using the open source mass balance model Rpath. Ecol Model 427:11. -doi:10.1016/j.ecolmodel.2020.109057]). Ecosense is a Monte Carlo approach to generating -an ensemble of plausible ecosystem parameter sets from a single Rpath model for -use with `rsim.run`, the time-dynamic counterpart to Rpath. For complete documentation -of Ecosense see Whitehouse and Aydin (2020^[Whitehouse GA, Aydin KY (2020) -Assessing the sensitivity of three Alaska marine food webs to perturbations: an -example of Ecosim simulations using Rpath. Ecol Model 429:16. -doi:10.1016/j.ecolmodel.2020.109074]). This vignette assumes the reader is familiar -with EwE and the Rpath package and its basic operations. - -## Ecosense - -To use Ecosense you need an `rpath.params` object and the corresponding `rsim.scenario` -object. In this vignette we've included the example Rpath models from Whitehouse and -Aydin (2020) for the eastern Bering Sea (EBS), eastern Chukchi Sea (ECS), and Gulf -of Alaska (GOA) marine food webs, and use the EBS model in our examples. Each of -these models has 50–54 functional groups, including one fishery, one primary -producer, two detrital compartments, and there are no stanzas. - -```{r load the models and Ecosense} -load("data/sense_vignette.RData") -ls() -source("R/ecosense.R", local = knitr::knit_global()) -``` -Each of the three Rpath models included in this data set has an `rpath.params` object (unbal), -a balanced `rpath` model (bal), and an `rsim.scenario` object (scene). - -### Setting up Ecosense - -Full sets of Ecosim parameter sets are drawn from distributions centered on the -original Rpath parameter estimates. The width of the distribution for each parameter -is defined in the data pedigree of the `rpath.params` object. The drawn parameters -include biomass, P/B, Q/B, diet composition, and natural mortality (i.e., M zero). -Additionally, vulnerability and handling time from the predator prey functional -response can be drawn over a specified range (lower/upper bounds in log space-1) -for each individual predator-prey interactions. - -A single parameter set can be generated with a call to `rsim.sense`. The object -returned by `rsim.sense` is equivalent to the list of parameters in an `rsim.scenario` -object (e.g., EBS_scene$params). - -```{r echo=TRUE} -# One set of Ecosim parameters for the EBS model -rsim.sense(EBS_scene,EBS_unbal,Vvary = c(0,0), Dvary = c(0,0)) -``` - -Each Ecosim parameter set can be subject to an initial simulation, also known as a -burn-in period, to eliminate numerically unstable parameter sets. This instability -usually results from incompatible draws of parameter sets that either lead to uncontrolled -population growth or population crash. Such as predator consumption and production -that exceeds the production of prey. The length of the burn-in period can be set -in the original `rsim.scenario` object. - -```{r , echo=TRUE} -# Setting the burn-in period in the EBS scenario object to 50 years. -EBS_scene$params$BURN_YEARS <- 50 -``` -During burn-in, if the biomass of a functional group exceeds 1,000x its starting -biomass or decreases to less than 1/1,000 its starting biomass, the ecosystem parameter -set is rejected and not retained for further analysis. A 50 year burn-in period is -generally sufficient to eliminate most of the unstable configurations but the length -of burn-in can be adjusted if necessary. - -### Generating an ensemble of Ecosim parameter sets - -To generate an ensemble of parameter sets we repeat the call to `rsim.sense` in -a loop. We first determine the number of parameter sets we wish to generate -and create lists to store those parameter sets. -```{r , echo=TRUE} -NUM_RUNS <- 1000 # how many ecosystem parameter sets to generate -parlist<-as.list(rep(NA,NUM_RUNS)) # create lists to store the generated parameters -kept<-rep(NA,NUM_RUNS) # object to keep track of kept systems -set.seed(666) # Optional, set seed so output can be replicated -``` -Now run the generator loop. In this example we will generate 1,000 parameter sets -(NUM_RUNS) for the eastern Bering Sea food web model. parlist[[i]] is the object -that will store the ith generated parameter set. In order to replicate the results -we use `set.seed`. - -The following loop generates an ensemble of Ecosim parameters for the EBS food web -model, assigns the generated base biomass (B_BaseRef) to the starting biomass in -the `rsim.scenario` object, sets the burn years to 50, runs a simulation with `rsim.run`, -and rejects or retains parameter sets based on the boundaries described above. - -```{r generator loop, echo=TRUE, results='hide'} -for (i in 1:NUM_RUNS){ - EBSsense <- EBS_scene # scenario object - # INSERT SENSE ROUTINE BELOW - parlist[[i]]<- EBS_scene$params # Base ecosim params - parlist[[i]]<- rsim.sense(EBS_scene,EBS_unbal,Vvary = c(-4.5,4.5), Dvary = c(0,0)) # Replace the base params with Ecosense params - EBSsense$start_state$Biomass <- parlist[[i]]$B_BaseRef # Apply the Ecosense starting biomass - parlist[[i]]$BURN_YEARS <- 50 # Set Burn Years to 50 - EBSsense$params <- parlist[[i]] # replace base params with the Ecosense generated params - EBStest <- rsim.run(EBSsense, method="AB") # Run rsim with the generated system - failList <- which(is.na(EBStest$end_state$Biomass)) - {if (length(failList)>0) - {cat(i,": fail in year ",EBStest$crash_year,": ",EBStest$params$spname[failList],"\n"); kept[i]<-F; flush.console()} - else - {cat(i,": success!\n"); kept[i]<-T; flush.console()}} # output for the console - parlist[[i]]$BURN_YEARS <- 1 -} -``` -This loop produces output in the console noting whether the generated parameter -set was a success or failure, the year the ecosystem "crashed", and which group(s) -were responsible for the crash. We have suppressed that output here to save -space but here is a sample of what that console output looks like: - - 1 : fail in year 1 : Salmon returning\ - 2 : fail in year 1 : Other zooplankton\ - 3 : success!\ - 4 : fail in year 1 : Benthic amphipods\ - 5 : fail in year 3 : Polychaetes\ - -The first two ecosystems each failed in year one. Salmon returning was the group -that crashed in the first ecosystem and other zooplankton in the second. The third -ecosystem successfully survived the 50 year burn-in. - -To determine which of the 1,000 generated systems survived burn-in, how many survived -burn-in and what the rejection rate was: -```{r, echo=TRUE} -KEPT <- which(kept==T) # the number associated with the kept system -nkept <- length(KEPT); nkept # how many were kept -1-(nkept/NUM_RUNS) # rejection rate -``` - -Running each of the retained Ecosim parameter sets for 100 years without any additional -perturbations, the first 50 years of which is the burn-in period. -```{r, echo=TRUE, results='hide'} -ecos <- as.list(rep(NA,length(KEPT))) # lists for simulated ecosystems -k <- 0 # counter for simulated ecosystems -for (i in KEPT) { - EBS_scene$start_state$Biomass <- parlist[[i]]$B_BaseRef # set the starting Biomass to the generated values - EBSsense <- EBS_scene # set up the scenario object - EBSsense$params <- parlist[[i]] # set the params in the scenario object equal to the generated params. - EBSsense$BURN_YEARS <- -1 # no burn-in period - k <- k + 1 # set the number for the simulated ecosystem - ecos[[k]] <- rsim.run(EBSsense,method='AB') # run rsim.run on the generated system - print(c("Ecosystem no.", k, "out of", nkept)) # progress output to console -} -``` - -Calculate the relative biomass of each group in each system, relative to their starting -biomass as drawn by Ecosense. -```{r, echo=TRUE} -relB_ecos <- as.list(rep(NA,length(KEPT))) # list to output relative biomass -k <- 0 -for (i in 1:nkept) { - spname <- colnames(ecos[[i]]$out_Biomass[,2:ncol(ecos[[i]]$out_Biomass)]) - biomass <- ecos[[i]]$out_Biomass[, spname] - n <- ncol(biomass) - start.bio <- biomass[1, ] # the drawn starting biomass - start.bio[which(start.bio == 0)] <- 1 - rel.bio <- matrix(NA, dim(biomass)[1], dim(biomass)[2]) - for(isp in 1:n) rel.bio[, isp] <- biomass[, isp] / start.bio[isp] # biomass relative to biomass at t=1 - colnames(rel.bio) <- spname - k <- k + 1 - relB_ecos[[k]] <- rel.bio -} -``` -An example plot of walleye pollock. First setup a matrix with the pollock trajectories -from all of the retained parameter sets. -```{r, echo=TRUE} -this_species <- "Walleye pollock" -plot_mat <- matrix(nrow=1200, ncol=nkept) # matrix of pollock trajectories from all generated systems -for (i in 1:nkept) { - plot_mat[,i] <- relB_ecos[[i]][,this_species] -} -``` -Then plot all the trajectories: -```{r, echo=TRUE} -plot_col <- viridis(nkept) -layout(matrix(c(1,1,1,1,1,1,2,2), nrow = 1, ncol = 8, byrow = TRUE)) -plot(1:1200, relB_ecos[[1]][,this_species], type='n', xlab="Months", - ylab="Relative biomass", ylim=c(min(plot_mat),max(plot_mat)), main=this_species) -# one line for pollock in each of the generated systems -for (i in 1:nkept) { - lines(1:1200, relB_ecos[[i]][,this_species], lwd=2, col=plot_col[i]) -} -# distribution of pollock relative biomasses -boxplot(plot_mat[1200,], ylim=c(min(plot_mat),max(plot_mat)), yaxt='n') -axis(side=2, at=c(seq(0,150,50)), tick=TRUE, labels=F) -``` - -### Run the kept systems with a perturbation - -Increase the FRate on pollock using `adjust.fishing`. The first 50 years are the -burn-in period. So, the perturbation is put in place from year 51 to 100. -```{r, echo=TRUE, results='hide'} -ecos_sp <- as.list(rep(NA,length(KEPT))) # lists for simulated ecosystems -k <- 0 # counter for simulated ecosystems -for (i in KEPT) { - EBS_scene$start_state$Biomass <- parlist[[i]]$B_BaseRef # set the starting Biomass to the generated values - EBSsense <- EBS_scene # set up the scenario object - EBSsense <- adjust.fishing(EBSsense, "ForcedFRate", group=this_species, sim.year=51:100, value=2) # perturb pollock FRate - EBSsense$params <- parlist[[i]] # set the params in the scenario object equal to the generated params. - EBSsense$BURN_YEARS <- -1 # no burn-in period - k <- k + 1 # set the number for the simulated ecosystem - ecos_sp[[k]] <- rsim.run(EBSsense,method='AB') # run rsim.run on the generated system - print(c("Ecosystem no.", k, "out of", nkept)) # progress output to console -} -``` -Calculate the biomass for each functional group relative to their biomass at the -end of the burn-in period (year 50), for each of the retained ecosystems. -```{r, echo=TRUE} -relB_ecos_sp <- as.list(rep(NA,length(KEPT))) -k <- 0 -for (i in 1:nkept) { - spname <- colnames(ecos_sp[[i]]$out_Biomass[,2:ncol(ecos_sp[[i]]$out_Biomass)]) - biomass <- ecos_sp[[i]]$out_Biomass[, spname] - n <- ncol(biomass) - start.bio <- biomass[600, ] # end of burn-in - start.bio[which(start.bio == 0)] <- 1 - rel.bio <- matrix(NA, dim(biomass)[1], dim(biomass)[2]) - for(isp in 1:n) rel.bio[, isp] <- biomass[, isp] / start.bio[isp] # biomass relative to the end of burn-in biomass - colnames(rel.bio) <- spname - k <- k + 1 - relB_ecos_sp[[k]] <- rel.bio -} -``` -Plot the trajectories for pollock from this perturbation. Note, the x-axis starts -at the begining of the perturbation (January of year 51). -```{r, echo=TRUE} -plot_mat_sp <- matrix(nrow=1200, ncol=nkept) -for (i in 1:nkept) { - plot_mat_sp[,i] <- relB_ecos_sp[[i]][,this_species] -} -layout(matrix(c(1,1,1,1,1,1,2,2), nrow = 1, ncol = 8, byrow = TRUE)) -plot(601:1200, relB_ecos_sp[[1]][601:1200,this_species], type='n', xlab="Months", - ylab="Relative biomass", ylim=c(min(plot_mat_sp[601:1200,]),max(plot_mat_sp[601:1200,])), main=this_species) -for (i in 1:nkept) { - lines(601:1200, relB_ecos_sp[[i]][601:1200,this_species], lwd=2, col=plot_col[i]) -} -boxplot(plot_mat_sp[1200,], ylim=c(min(plot_mat_sp[601:1200,]),max(plot_mat_sp[601:1200,]))) -``` - -A boxplot of the distribution of outcomes for all the living groups relative to -their biomass at the start of the perturbation. -```{r, echo=TRUE} -sp_perturb_out <- matrix(nrow=nkept, ncol=(EBS_bal$NUM_LIVING+EBS_bal$NUM_DEAD)) -for(i in 1:nkept){ - sp_perturb_out[i,] <- relB_ecos_sp[[i]][1200,] -} -colnames(sp_perturb_out) <- colnames(relB_ecos_sp[[1]]) -par(mfrow=c(1,1), mar=c(9,3,1,1)) -boxplot(sp_perturb_out, outline=FALSE, las=2, cex.axis=0.6) -abline(h=1, lty=2) -``` +--- +title: "Generating an Rsim ensemble with Ecosense" +author: "George A. Whitehouse" +date: "`r Sys.Date()`" +output: + html_document: default + pdf_document: default +vignette: > + %\VignetteIndexEntry{Generating an Rsim ensemble with Ecosense} + %\VignetteEncoding{UTF-8} + %\VignetteEngine{knitr::rmarkdown} +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +library(Rpath); library(data.table); library(viridis) +knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) +``` + +Rpath is an R implementation of the food web modeling program Ecopath with Ecosim +(EwE; Christensen and Pauly 1992^[Christensen V, Pauly D (1992) Ecopath II-a software +for balancing steady-state ecosystem models and calculating network characteristics. +Ecol Model 61:169-185. doi:10.1016/0304-3800(92)90016-8], Walters et al. 1997^[Walters +C, Christensen V, Pauly D (1997) Structuring dynamic models of exploited ecosystems +from trophic mass-balance assessments. Rev Fish Biol Fish 7:139-172. +doi:10.1023/a:1018479526149]). For full documentation of the Rpath package see Lucey +et al. (2020^[Lucey SM, Gaichas SK, Aydin KY (2020) Conducting reproducible ecosystem +modeling using the open source mass balance model Rpath. Ecol Model 427:11. +doi:10.1016/j.ecolmodel.2020.109057]). Ecosense is a Monte Carlo approach to generating +an ensemble of plausible ecosystem parameter sets from a single Rpath model for +use with `rsim.run`, the time-dynamic counterpart to Rpath. For complete documentation +of Ecosense see Whitehouse and Aydin (2020^[Whitehouse GA, Aydin KY (2020) +Assessing the sensitivity of three Alaska marine food webs to perturbations: an +example of Ecosim simulations using Rpath. Ecol Model 429:16. +doi:10.1016/j.ecolmodel.2020.109074]). To use this vignette it is recommended you +are familiar with Rpath and its basic operations. + +## Ecosense + +This vignette includes the example Rpath models from Whitehouse and +Aydin (2020) for the eastern Bering Sea (EBS), eastern Chukchi Sea (ECS), and Gulf +of Alaska (GOA) marine food webs, and uses the EBS model in an example. Each of +these models has 50–54 functional groups, including one fishery, one primary +producer, two detrital compartments, and there are no stanzas. To use Ecosense you +need an `rpath.params` object and the corresponding `rsim.scenario` object. First, +load the unbalanced models, balance them, and setup the rsim scenario objects. + +```{r load the unbalanced models, balance the models, setup rsim scenario objects} +# load the unbalanced models +load("data/Ecosense.EBS.rda") +load("data/Ecosense.ECS.rda") +load("data/Ecosense.GOA.rda") +# balance the models +EBS_bal <- rpath(Ecosense.EBS) +ECS_bal <- rpath(Ecosense.ECS) +GOA_bal <- rpath(Ecosense.GOA) +# create rsim scenario objects +EBS_scene <- rsim.scenario(EBS_bal, Ecosense.EBS, years=1:100) +ECS_scene <- rsim.scenario(ECS_bal, Ecosense.ECS, years=1:100) +GOA_scene <- rsim.scenario(GOA_bal, Ecosense.GOA, years=1:100) +# source ecosense.R +source("R/ecosense.R", local = knitr::knit_global()) +ls() +``` +### Setting up Ecosense + +Full sets of Ecosim parameter sets are drawn from distributions centered on the +original Rpath parameter estimates. The width of the distribution for each parameter +is defined in the data pedigree of the `rpath.params` object. The drawn parameters +include biomass, P/B, Q/B, diet composition, and natural mortality (i.e., M zero). +Additionally, vulnerability and handling time from the predator prey functional +response can be drawn over a specified range (lower/upper bounds in log space-1) +for each individual predator-prey interaction. + +A single parameter set can be generated with a call to `rsim.sense`. The object +returned by `rsim.sense` is equivalent to the list of parameters in an `rsim.scenario` +object (e.g., scenario_object$params). + +```{r echo=TRUE} +# One set of Ecosim parameters for the EBS model +rsim.sense(EBS_scene,Ecosense.EBS,Vvary = c(0,0), Dvary = c(0,0)) +``` + +Each Ecosim parameter set drawn with Ecosense can be subject to an initial simulation, +also known as a burn-in, to eliminate unstable parameter sets. This instability +usually results from incompatible draws of parameter sets that either lead to uncontrolled +population growth or population crash. Such as predator consumption and production +that exceeds the production of prey. The length of the burn-in period can be set +in the original `rsim.scenario` object. + +```{r , echo=TRUE} +# Setting the burn-in period in the EBS scenario object to 50 years. +EBS_scene$params$BURN_YEARS <- 50 +``` +During burn-in, if the biomass of a functional group exceeds 1,000x its starting +biomass or decreases to less than 1/1,000 its starting biomass, the ecosystem parameter +set is rejected and not retained for further analysis. A 50 year burn-in period +is generally sufficient to eliminate most of the unstable configurations. + +### Generating an ensemble of Ecosim parameter sets + +To generate an ensemble of parameter sets you can repeat the call to `rsim.sense` +in a loop. First, determine the number of parameter sets you wish to generate and +create lists to store those parameter sets. Set up another vector to keep track +of which generated parameter sets were rejected or retained. +```{r , echo=TRUE} +NUM_RUNS <- 1000 # how many ecosystem parameter sets to generate +parlist<-as.list(rep(NA,NUM_RUNS)) # create lists to store the generated parameters +kept<-rep(NA,NUM_RUNS) # object to keep track of kept systems +set.seed(666) # Optional, set seed so output can be replicated +``` +In this example we will generate 1,000 parameter sets (NUM_RUNS) for the eastern +Bering Sea food web model. parlist[[i]] is the object that will store the ith +generated parameter set. Optionally, you can use `set.seed` to replicate these results. + +The following loop generates an ensemble of Ecosim parameters for the EBS food web +model, assigns the generated base biomass (B_BaseRef) to the starting biomass in +the `rsim.scenario` object, sets the burn years to 50, runs a simulation with `rsim.run`, +and rejects or retains parameter sets based on the boundaries described above. + +```{r generator loop, echo=TRUE, results='hide'} +for (i in 1:NUM_RUNS){ + EBSsense <- EBS_scene # scenario object + # INSERT SENSE ROUTINE BELOW + parlist[[i]]<- EBS_scene$params # Base ecosim params + parlist[[i]]<- rsim.sense(EBS_scene,Ecosense.EBS,Vvary = c(-4.5,4.5), Dvary = c(0,0)) # Replace the base params with Ecosense params + EBSsense$start_state$Biomass <- parlist[[i]]$B_BaseRef # Apply the Ecosense starting biomass + parlist[[i]]$BURN_YEARS <- 50 # Set Burn Years to 50 + EBSsense$params <- parlist[[i]] # replace base params with the Ecosense generated params + EBStest <- rsim.run(EBSsense, method="AB") # Run rsim with the generated system + failList <- which(is.na(EBStest$end_state$Biomass)) + {if (length(failList)>0) + {cat(i,": fail in year ",EBStest$crash_year,": ",EBStest$params$spname[failList],"\n"); kept[i]<-F; flush.console()} + else + {cat(i,": success!\n"); kept[i]<-T; flush.console()}} # output for the console + parlist[[i]]$BURN_YEARS <- 1 +} +``` +This loop produces output in the console noting whether the generated parameter +set was a success or failure, the year the ecosystem "crashed", and which group(s) +were responsible for the crash. Here are the results for the first two generated +parameter sets: + + 1 : fail in year 1 : Squids\ + 2 : fail in year 7 : Salmon returning\ + +The first two ecosystems both failed, the first in year one and the second in year +seven. Squids crashed in the first ecosystem and Salmon returning in the second. +The 52nd generated parameter set was the first to survive the 50 year burn-in: + + 52 : success!\ + +To determine which of the 1,000 generated systems survived burn-in, how many survived +burn-in and what the rejection rate was: +```{r, echo=TRUE} +KEPT <- which(kept==T); KEPT # the number associated with the kept system +nkept <- length(KEPT); nkept # how many were kept +1-(nkept/NUM_RUNS) # rejection rate +``` +The numbers in KEPT can be used to access the retained parameter sets in parlist[[i]]. +In this example, 43 parameter sets were retained and the rejection rate for generated +parameter sets was 95.7%. + +All of the retained Rsim parameter sets can be run through a simulation with another +for loop. This loop subjects each of the 43 retained parameter sets in this example +to a 100 year simulation without any additional perturbations, the first 50 years +of which is the burn-in period. +```{r, echo=TRUE, results='hide'} +ecos <- as.list(rep(NA,length(KEPT))) # lists for simulated ecosystems +k <- 0 # counter for simulated ecosystems +for (i in KEPT) { + EBS_scene$start_state$Biomass <- parlist[[i]]$B_BaseRef # set the starting Biomass to the generated values + EBSsense <- EBS_scene # set up the scenario object + EBSsense$params <- parlist[[i]] # set the params in the scenario object equal to the generated params. + EBSsense$BURN_YEARS <- -1 # no burn-in period + k <- k + 1 # set the number for the simulated ecosystem + ecos[[k]] <- rsim.run(EBSsense,method='AB') # run rsim.run on the generated system + print(c("Ecosystem no.",k,"out of",nkept)) # progress output to console +} +``` + +Because biomass can differ greatly between the generated parameter sets, relative +biomass can be used for plotting. This loop calculates the relative biomass of each +group in each system, relative to their starting biomass, as drawn by Ecosense. +```{r, echo=TRUE} +relB_ecos <- as.list(rep(NA,length(KEPT))) # list to output relative biomass +k <- 0 +for (i in 1:nkept) { + spname <- colnames(ecos[[i]]$out_Biomass[,2:ncol(ecos[[i]]$out_Biomass)]) + biomass <- ecos[[i]]$out_Biomass[, spname] + n <- ncol(biomass) + start.bio <- biomass[1, ] # the drawn starting biomass + start.bio[which(start.bio == 0)] <- 1 + rel.bio <- matrix(NA, dim(biomass)[1], dim(biomass)[2]) + for(isp in 1:n) rel.bio[, isp] <- biomass[, isp] / start.bio[isp] # biomass relative to biomass at t=1 + colnames(rel.bio) <- spname + k <- k + 1 + relB_ecos[[k]] <- rel.bio +} +``` +Here's an example plot of walleye pollock from all the retained Rsim parameter sets. +First setup a matrix to store the pollock trajectories from the simulations with +the retained parameter sets. +```{r, echo=TRUE} +this_species <- "Walleye pollock" +plot_mat <- matrix(nrow=1200, ncol=nkept) # matrix of pollock trajectories from all generated systems +for (i in 1:nkept) { + plot_mat[,i] <- relB_ecos[[i]][,this_species] +} +``` +Then plot all the trajectories: +```{r, echo=TRUE} +plot_col <- viridis(nkept) +layout(matrix(c(1,1,1,1,1,1,2,2), nrow = 1, ncol = 8, byrow = TRUE)) +plot(1:1200, relB_ecos[[1]][,this_species], type='n', xlab="Months", + ylab="Relative biomass", ylim=c(min(plot_mat),max(plot_mat)), main=this_species) +# one line for pollock in each of the generated systems +for (i in 1:nkept) { + lines(1:1200, relB_ecos[[i]][,this_species], lwd=2, col=plot_col[i]) +} +# distribution of pollock relative biomasses +boxplot(plot_mat[1200,], ylim=c(min(plot_mat),max(plot_mat)), yaxt='n') +axis(side=2, at=c(seq(0,150,50)), tick=TRUE, labels=F) +``` +Each line in the left panel is the relative biomass trajectory of walleye pollock +over the 100 year simulation with the retained Rsim parameter sets. + +### Run the kept systems with a perturbation + +When working with an ensemble such as this, we are often interested in doing the +same perturbation across all ensemble members to describe a range of potential outcomes. +In this example, we'll increase the fishing mortality on walleye pollock using the +`adjust.fishing` function. The first 50 years of the simulation are the burn-in +period. So, the perturbation is put in place from year 51 to 100, and in this example +we increase walleye pollock fishing mortality by 2X. +```{r, echo=TRUE, results='hide'} +ecos_sp <- as.list(rep(NA,length(KEPT))) # lists for simulated ecosystems +k <- 0 # counter for simulated ecosystems +for (i in KEPT) { + EBS_scene$start_state$Biomass <- parlist[[i]]$B_BaseRef # set the starting Biomass to the generated values + EBSsense <- EBS_scene # set up the scenario object + EBSsense <- adjust.fishing(EBSsense, "ForcedFRate", group=this_species, sim.year=51:100, value=2) # perturb pollock FRate + EBSsense$params <- parlist[[i]] # set the params in the scenario object equal to the generated params. + EBSsense$BURN_YEARS <- -1 # no burn-in period + k <- k + 1 # set the number for the simulated ecosystem + ecos_sp[[k]] <- rsim.run(EBSsense,method='AB') # run rsim.run on the generated system + print(c("Ecosystem no.", k, "out of", nkept)) # progress output to console +} +``` +To visualize the results, we use relative biomass again but this time relative to +biomass at the end of the burn-in period (year 50). That is the point in time where +the perturbation began and the point from which we want to measure any response +or change. +```{r, echo=TRUE} +relB_ecos_sp <- as.list(rep(NA,length(KEPT))) +k <- 0 +for (i in 1:nkept) { + spname <- colnames(ecos_sp[[i]]$out_Biomass[,2:ncol(ecos_sp[[i]]$out_Biomass)]) + biomass <- ecos_sp[[i]]$out_Biomass[, spname] + n <- ncol(biomass) + start.bio <- biomass[600, ] # end of burn-in + start.bio[which(start.bio == 0)] <- 1 + rel.bio <- matrix(NA, dim(biomass)[1], dim(biomass)[2]) + for(isp in 1:n) rel.bio[, isp] <- biomass[, isp] / start.bio[isp] # biomass relative to the end of burn-in biomass + colnames(rel.bio) <- spname + k <- k + 1 + relB_ecos_sp[[k]] <- rel.bio +} +``` +Plot the trajectories for walleye pollock from this perturbation. Note, the x-axis +starts at the begining of the perturbation (January of year 51). +```{r, echo=TRUE} +plot_mat_sp <- matrix(nrow=1200, ncol=nkept) +for (i in 1:nkept) { + plot_mat_sp[,i] <- relB_ecos_sp[[i]][,this_species] +} +layout(matrix(c(1,1,1,1,1,1,2,2), nrow = 1, ncol = 8, byrow = TRUE)) +plot(601:1200, relB_ecos_sp[[1]][601:1200,this_species], type='n', xlab="Months", + ylab="Relative biomass", ylim=c(min(plot_mat_sp[601:1200,]),max(plot_mat_sp[601:1200,])), main=this_species) +for (i in 1:nkept) { + lines(601:1200, relB_ecos_sp[[i]][601:1200,this_species], lwd=2, col=plot_col[i]) +} +boxplot(plot_mat_sp[1200,], ylim=c(min(plot_mat_sp[601:1200,]),max(plot_mat_sp[601:1200,]))) +``` +Biomass for walleye pollock decreased in all 43 ecosystems in response to the perturbation. + +Walleye pollock are a nodal species in the eastern Bering Sea food web and such +a perturbation as in this example might illicit a response from many functional +groups across the food web. Here is an example boxplot of the distribution +of biomass outcomes for all the living functional groups relative to their biomass +at the start of the perturbation. +```{r, echo=TRUE} +sp_perturb_out <- matrix(nrow=nkept, ncol=(EBS_bal$NUM_LIVING+EBS_bal$NUM_DEAD)) +for(i in 1:nkept){ + sp_perturb_out[i,] <- relB_ecos_sp[[i]][1200,] +} +colnames(sp_perturb_out) <- colnames(relB_ecos_sp[[1]]) +par(mfrow=c(1,1), mar=c(9,3,0.5,0.5)) +boxplot(sp_perturb_out, outline=FALSE, las=2, cex.axis=0.6) +abline(h=1, lty=2) +``` diff --git a/vignettes/ices-journal-of-marine-science.csl b/vignettes/ices-journal-of-marine-science.csl new file mode 100644 index 00000000..40027037 --- /dev/null +++ b/vignettes/ices-journal-of-marine-science.csl @@ -0,0 +1,223 @@ + + diff --git a/vignettes/img/output_plot_example.png b/vignettes/img/output_plot_example.png new file mode 100644 index 00000000..f37ec961 Binary files /dev/null and b/vignettes/img/output_plot_example.png differ diff --git a/vignettes/img/plot_01_no_difference.png b/vignettes/img/plot_01_no_difference.png new file mode 100644 index 00000000..25657236 Binary files /dev/null and b/vignettes/img/plot_01_no_difference.png differ diff --git a/vignettes/img/plot_02_superimposed_with_difference.png b/vignettes/img/plot_02_superimposed_with_difference.png new file mode 100644 index 00000000..bd2a8c4e Binary files /dev/null and b/vignettes/img/plot_02_superimposed_with_difference.png differ diff --git a/vignettes/img/plot_03_current-baseline.png b/vignettes/img/plot_03_current-baseline.png new file mode 100644 index 00000000..9794172e Binary files /dev/null and b/vignettes/img/plot_03_current-baseline.png differ diff --git a/vignettes/references.bib b/vignettes/references.bib new file mode 100644 index 00000000..bc32d50c --- /dev/null +++ b/vignettes/references.bib @@ -0,0 +1,141 @@ + +@article{heymans_best_2016, + series = {Ecopath 30 years – {Modelling} ecosystem dynamics: beyond boundaries with {EwE}}, + title = {Best practice in {Ecopath} with {Ecosim} food-web models for ecosystem-based management}, + volume = {331}, + issn = {0304-3800}, + url = {http://www.sciencedirect.com/science/article/pii/S030438001500575X}, + doi = {10.1016/j.ecolmodel.2015.12.007}, + abstract = {Ecopath with Ecosim (EwE) models are easier to construct and use compared to most other ecosystem modelling techniques and are therefore more widely used by more scientists and managers. This, however, creates a problem with quality assurance; to address this we provide an overview of best practices for creating Ecopath models. We describe the diagnostics that can be used to check for thermodynamic and ecological principles, and highlight principles that should be used for balancing a model. We then highlight the pitfalls when comparing Ecopath models using Ecological Network Analysis indices. For dynamic simulations in Ecosim we show the state of the art in calibrating the model by fitting it to time series using a formal fitting procedure and statistical goodness of fit. Finally, we show how Monte Carlo simulations can be used to address uncertainty in input parameters, and we discuss the use of models in a management context, specifically using the concept of ‘key runs’ for ecosystem-based management. This novel list of best practices for EwE models will enable ecosystem managers to evaluate the goodness of fit of the given EwE model to the ecosystem management question.}, + urldate = {2018-06-25}, + journal = {Ecological Modelling}, + author = {Heymans, Johanna Jacomina and Coll, Marta and Link, Jason S. and Mackinson, Steven and Steenbeek, Jeroen and Walters, Carl and Christensen, Villy}, + month = jul, + year = {2016}, + keywords = {Ecological network analysis, Ecopath with Ecosim, Ecosystem modelling, Ecosystem-based management, Monte Carlo, Time series fitting}, + pages = {173--184}, + file = {ScienceDirect Full Text PDF:/Users/sarahgaichas/Zotero/storage/3QGBKQ2P/Heymans et al. - 2016 - Best practice in Ecopath with Ecosim food-web mode.pdf:application/pdf;ScienceDirect Snapshot:/Users/sarahgaichas/Zotero/storage/I4QQ75ZD/S030438001500575X.html:text/html}, +} + +@article{christensen_ecopath_2004, + title = {Ecopath with {Ecosim}: methods, capabilities, and limitations}, + volume = {172}, + shorttitle = {Ecopath with {Ecosim}: methods, capabilities, and limitations}, + journal = {Ecologial Modelling}, + author = {Christensen, V. and Walters, C. J.}, + year = {2004}, + pages = {109--139}, +} + +@article{walters_structuring_1997, + title = {Structuring dynamic models of exploited ecosystems from trophic mass-balance assessments}, + volume = {7}, + shorttitle = {Structuring dynamic models of exploited ecosystems from trophic mass-balance assessments}, + journal = {Reviews in Fish Biology and Fisheries}, + author = {Walters, C. J. and Christensen, V. and Pauly, D.}, + year = {1997}, + pages = {139--172}, +} + +@article{polovina_model_1984, + title = {Model of a coral reef ecosystem {I}. {The} {ECOPATH} model and its application to {French} {Frigate} {Shoals}}, + volume = {3}, + shorttitle = {Model of a coral reef ecosystem {I}. {The} {ECOPATH} model and its application to {French} {Frigate} {Shoals}}, + journal = {Coral Reefs}, + author = {Polovina, J. J.}, + year = {1984}, + pages = {1--11}, +} + +@book{walters_fisheries_2004, + address = {Princeton}, + title = {Fisheries {Ecology} and {Management}}, + shorttitle = {Fisheries {Ecology} and {Management}}, + publisher = {Princeton University Press}, + author = {Walters, C. J. and Martell, S. J. D.}, + year = {2004}, +} + +@article{walters_ecosim_2008, + title = {An ecosim model for exploring {Gulf} of {Mexico} ecosystem management options: {Implications} of including multistanza life-history models for policy predictions}, + volume = {83}, + shorttitle = {An ecosim model for exploring {Gulf} of {Mexico} ecosystem management options: {Implications} of including multistanza life-history models for policy predictions}, + number = {1}, + journal = {Bulletin of Marine Science}, + author = {Walters, C. J. and Martell, S. J. D. and Christensen, V. and Mahmoudi, B.}, + year = {2008}, + pages = {251--271}, +} + +@article{lucey_conducting_2020, + title = {Conducting reproducible ecosystem modeling using the open source mass balance model {Rpath}}, + volume = {427}, + issn = {0304-3800}, + url = {https://www.sciencedirect.com/science/article/pii/S0304380020301290}, + doi = {10.1016/j.ecolmodel.2020.109057}, + abstract = {Ecosystem models are important tools for conducting ecosystem-based management. A particularly useful method of characterizing the flow of energy through an ecosystem and the subsequent direct and indirect implications of management actions is mass balance modeling. Here we outline the equations as utilized in Rpath, an R implementation of the mass balance algorithms popularized by Ecopath with Ecosim that are designed to work with fisheries data sources. We believe that common practices in R will aid in the reproducibility of conducting analysis using a mass balance model as all of the code is contained within a single script file. This includes the built-in statistical and graphical functions of R. In addition to added reproducibility, R is a coding language with which ecologists are familiar. This familiarity offers greater flexibility for practitioners to tailor the model to their needs. We have made the code available on an open software development platform which should aid in continuous community development of the tool.}, + language = {en}, + urldate = {2021-04-16}, + journal = {Ecological Modelling}, + author = {Lucey, Sean M. and Gaichas, Sarah K. and Aydin, Kerim Y.}, + month = jul, + year = {2020}, + keywords = {Ecopath, Ecosim, Mass balance, R, Reproducibility, Rpath}, + pages = {109057}, + file = {ScienceDirect Full Text PDF:/Users/sarahgaichas/Zotero/storage/FFPCH5ZW/Lucey et al. - 2020 - Conducting reproducible ecosystem modeling using t.pdf:application/pdf;ScienceDirect Full Text PDF:/Users/sarahgaichas/Zotero/storage/AI3CQ579/Lucey et al. - 2020 - Conducting reproducible ecosystem modeling using t.pdf:application/pdf;ScienceDirect Full Text PDF:/Users/sarahgaichas/Zotero/storage/SDQ64VU7/Lucey et al. - 2020 - Conducting reproducible ecosystem modeling using t.pdf:application/pdf;ScienceDirect Snapshot:/Users/sarahgaichas/Zotero/storage/WQXFX7KZ/S0304380020301290.html:text/html;ScienceDirect Snapshot:/Users/sarahgaichas/Zotero/storage/P28ZCPZR/S0304380020301290.html:text/html}, +} + +@article{lucey_evaluating_2021, + title = {Evaluating fishery management strategies using an ecosystem model as an operating model}, + volume = {234}, + copyright = {All rights reserved}, + issn = {0165-7836}, + url = {http://www.sciencedirect.com/science/article/pii/S0165783620302976}, + doi = {10.1016/j.fishres.2020.105780}, + abstract = {Management Strategy Evaluation (MSE) is an effective tool to gauge the relative performance of fishery management options. For the most part, MSEs have been applied to single-species management procedures. However, to be more inclusive of all the biological and technical interactions occurring within a system, ecosystem-based strategies are emerging. In order to test the feasibility of these strategies, a full ecosystem model should be used as an operating model. Mass balance food web models include many features that managers are interested in and therefore can be useful as an operating model. Until recently, full feedback interactions between a management strategy and a mass balance operating model were impractical. However, with the development of Rpath, users now have the ability to fully customize their mass balance models. We developed new functionality for the Rpath modelling framework that allows it to be used as a flexible operating model. Using an example Georges Bank model, we demonstrate how Rpath can now pause the simulation, evaluate an external model, and use the results to modify the parameters of the operating model. This new flexibility will allow users to test a variety of management strategies or couple to other models making Rpath a valuable tool for conducting MSEs.}, + language = {en}, + urldate = {2020-12-09}, + journal = {Fisheries Research}, + author = {Lucey, Sean M. and Aydin, Kerim Y. and Gaichas, Sarah K. and Cadrin, Steven X. and Fay, Gavin and Fogarty, Michael J. and Punt, André}, + month = feb, + year = {2021}, + pages = {105780}, + file = {ScienceDirect Full Text PDF:/Users/sarahgaichas/Zotero/storage/UE78XPGW/Lucey et al. - 2021 - Evaluating fishery management strategies using an .pdf:application/pdf;ScienceDirect Full Text PDF:/Users/sarahgaichas/Zotero/storage/3PKE6BVJ/Lucey et al. - 2021 - Evaluating fishery management strategies using an .pdf:application/pdf;ScienceDirect Snapshot:/Users/sarahgaichas/Zotero/storage/UJVBJ76E/S0165783620302976.html:text/html;ScienceDirect Snapshot:/Users/sarahgaichas/Zotero/storage/FA8IQPMJ/S0165783620302976.html:text/html}, +} + +@article{christensen_ecopath_1992, + title = {{ECOPATH} {II} — a software for balancing steady-state ecosystem models and calculating network characteristics}, + volume = {61}, + issn = {0304-3800}, + url = {https://www.sciencedirect.com/science/article/pii/0304380092900168}, + doi = {10.1016/0304-3800(92)90016-8}, + abstract = {The ECOPATH II microcomputer software is presented as an approach for balancing ecosystem models. It includes (i) routines for balancing the flow in a steady-state ecosystem from estimation of a missing parameter for all groups in the system, (ii) routines for estimating network flow indices, and (iii) miscellaneous routines for deriving additional indices such as food selection indices and omnivory indices. The use of ECOPATH II is exemplified through presentation of a model of the Schlei Fjord ecosystem (Western Baltic).}, + language = {en}, + number = {3}, + urldate = {2023-01-13}, + journal = {Ecological Modelling}, + author = {Christensen, V. and Pauly, D.}, + month = jun, + year = {1992}, + pages = {169--185}, + file = {ScienceDirect Snapshot:/Users/sarahgaichas/Zotero/storage/GVZTRW68/0304380092900168.html:text/html}, +} + +@article{whitehouse_assessing_2020, + title = {Assessing the sensitivity of three {Alaska} marine food webs to perturbations: an example of {Ecosim} simulations using {Rpath}}, + volume = {429}, + issn = {0304-3800}, + shorttitle = {Assessing the sensitivity of three {Alaska} marine food webs to perturbations}, + url = {https://www.sciencedirect.com/science/article/pii/S0304380020301460}, + doi = {10.1016/j.ecolmodel.2020.109074}, + abstract = {Ecosystem modelling is a useful tool for exploring the potential outcomes of policy options and conducting experiments that would otherwise be impractical in the real world. However, ecosystem models have been limited in their ability to engage in the management of living marine resources due in part to high levels of uncertainty in model parameters and model outputs. Additionally, for multispecies or food web models, there is uncertainty about the predator-prey functional response, which can have implications for population dynamics. In this study, we evaluate the sensitivity of large marine food webs in Alaska to parameter uncertainty, including parameters that govern the predator-prey functional response. We use Rpath, an R implementation of the food web modeling program Ecopath with Ecosim (EwE), to conduct a series of mortality-based perturbations to examine the sensitivity and recovery time of higher trophic level groups in the eastern Chukchi Sea, eastern Bering Sea, and Gulf of Alaska. We use a Monte Carlo approach to generate thousands of plausible ecosystems by drawing parameter sets from the range of uncertainty around the base model parameters. We subjected the ecosystem ensembles to a series of mortality-based perturbations to identify which functional groups the higher trophic level groups are most sensitive to when their mortality was increased, whether the food webs returned to their unperturbed configurations following a perturbation, and how long it took to return to that state. In all three ecosystems, we found that the number of disrupted ensemble food webs was positively related to the biomass and the number of trophic links of the perturbed functional group, and negatively related to trophic level. The eastern Chukchi Sea was most sensitive to perturbations to benthic invertebrate groups, the eastern Bering Sea was most sensitive to shrimp and walleye pollock, and the Gulf of Alaska was most sensitive to shrimps, pelagic forage fish, and zooplankton. Recovery time to perturbations were generally less than 5 years in all three ecosystems. The recovery times when fish groups were perturbed were generally longer than when benthic invertebrates were perturbed, and recovery times were shortest when it was pelagic invertebrates. The single model ensemble approach produced simulation results that described a range of possible outcomes to the prescribed perturbations and provided a sense for how robust the results are to parameter uncertainty.}, + language = {en}, + urldate = {2023-01-13}, + journal = {Ecological Modelling}, + author = {Whitehouse, George A. and Aydin, Kerim Y.}, + month = aug, + year = {2020}, + keywords = {Bering Sea, Chukchi Sea, Ecosim, food web, Gulf of Alaska, Rpath}, + pages = {109074}, + file = {ScienceDirect Full Text PDF:/Users/sarahgaichas/Zotero/storage/2KGN7ZX6/Whitehouse and Aydin - 2020 - Assessing the sensitivity of three Alaska marine f.pdf:application/pdf;ScienceDirect Snapshot:/Users/sarahgaichas/Zotero/storage/9MMPFTP9/S0304380020301460.html:text/html}, +}