Skip to content
Sean Anderson edited this page Jul 11, 2022 · 15 revisions

Building the document

The following is for internal use only. You need to be on the Pacific Biological Station network with access to the groundfish databases.

  1. Install gfsynopsis and csasdown:
# install.packages("devtools")
devtools::install_github("pbs-assess/gfsynopsis", dependencies = TRUE)
  1. Clone or download the gfsynopsis GitHub repository.

  2. On the Pacific Biological Station network and with the R working directory set to the root folder of the project (e.g., open the RStudio gfsynopsis.Rproj file), install any missing packages used in report/make.R and run:

source("report/make.R")
  1. Wait for a long time for all the data to download, all the models to fit, and all the plots to generate. If you are starting from scratch then it may take a day or so to download all the data and fit all the spatiotemporal survey models and commercial CPUE index standardization models. If you already have these results cached, then it could take anywhere from ~10 minutes to a couple hours depending what needs to be built.

  2. In RStudio, open gfsynopsis/report/report-rmd/index.Rmd and click the "Knit" button, or in any R console run:

setwd("report/report-rmd")
bookdown::render_book("index.Rmd")
setwd("../../")

Problems? File an issue.

Steps to regenerate the report

(This is an ongoing place to put notes as I think of them.)

  • Start from a fresh clone of the repository (or carefully remove all cached folders and files).

  • Update all year limits as desired in R/make-pages.R. This should be pulled out into arguments.

  • Install your updated version of gfsynopsis and current versions of gfplot, sdmTMB, and csasdown.

  • Source report/make.R. This should be pulled out into functions. You may want to work your way through the file line by line. Some parts of it will take a long time for a fresh document generation. For example, the data caching, CPUE model fitting, geostatistical survey model fitting, and even the figure page generation will all take a while.

  • Make sure to make a new Git 'Release' when publishing a new version of the report and update the package version in the DESCRIPTION file.

Notes

The CPUE GLMM models will take a long time to fit. I sometimes encountered memory issues with parallel processing. As a result, I tend to run all the species pages in multiple R sessions. You can do this by setting N <- 1:10 to, for example, just run the first 10 species when sourcing report/make.R. If you look in makefile in the root folder you'll see an example of how I do this.

How do I update a stock assessment for one of the species pages?

See this commit as an example. The next time report/make.R is run the file report/report-rmd/plot-pages.Rmd will get updated.