-
Notifications
You must be signed in to change notification settings - Fork 0
NEFSC Transition #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Schiano-NOAA
wants to merge
11
commits into
main
Choose a base branch
from
nefsc-transition
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
NEFSC Transition #39
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
198f4b2
try adding new content for nefsc workshop
Schiano-NOAA d90c48b
update function to copy over files
Schiano-NOAA 9a795b9
adjust day 2 and make nefsc agenda
Schiano-NOAA 5371c90
update agenda to change timing for day 2 breaks - make sure code is e…
Schiano-NOAA db27ba2
make adjustment so the quarto files that need to be copied for NEFSC …
Schiano-NOAA ff87102
move NEFSC stuff into snippet
Schiano-NOAA 10b417d
fix typo
Schiano-NOAA a86b596
add header for regional content for navigation
Schiano-NOAA f866496
clean up directions and copied code
Schiano-NOAA 09500a4
Add sidebar for regionally-specific info and link to NEFSC snippet; m…
sbreitbart-NOAA a571ac8
Clarify NEFSC conversion steps
sbreitbart-NOAA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| ### Adaptation of NEFSC Template to {asar} | ||
|
|
||
| Dan Hennen, the NEFSC representative on the workflows steering committee, has designed a sleek workflow to help aid the transition from the typical management track assessment to NOAA standard guidelines. The standard guidelines executive summary mimics closely the current management track reports, so here we will automate the executive summary in this section of the report. | ||
|
|
||
| Use the following code to download files into your working directory for the next process: | ||
|
|
||
| ```{r} | ||
| #| eval: false | ||
| get_nefsc_files <- function(dir){ | ||
| NEFSCtoASAR_folder <- file.path(dir, "ExportLegacyNEFSCtoASARproject") | ||
| testStocks_folder <- file.path(NEFSCtoASAR_folder, "testStocks") | ||
| asarreport_folder <- file.path(NEFSCtoASAR_folder, "ASARreportFiles") | ||
| # if (!file.exists(dir)) { | ||
| dir.create(NEFSCtoASAR_folder) | ||
| dir.create(testStocks_folder) | ||
| dir.create(asarreport_folder) | ||
| # } | ||
| file_names_to_download <- c( | ||
| # "ASARreportFiles", | ||
| "CheckLatexInstall.R", | ||
| "create_asar_object.R", | ||
| "Example.R", | ||
| "MapAutoUpdateToAsar.R", | ||
| "plot_survey_indices.R", | ||
| "plot_total_catch.R", | ||
| "table_brp1.1.R", | ||
| "table_catch_status1.1.R", | ||
| "table_projections1.1.R", | ||
| "testAdditionalStocks.R", | ||
| "TestMoreStocksReportOnly.R" | ||
| ) | ||
| teststocks_files <- c( | ||
| "BSBUNITAutoAss.RData", | ||
| "BUTUNITAutoAss.RData", | ||
| "CODGBAutoAss.RData", | ||
| "CODWGOMAutoAss.RData", | ||
| "SCUNITAutoAss.RData" | ||
| ) | ||
| asarreport_files <- c( | ||
| "01_executive_summary.qmd", | ||
| "in-header.tex", | ||
| "preamble.R" | ||
| ) | ||
|
|
||
| for (i in file_names_to_download) { | ||
| cli::cli_alert_info("📥 Downloading {i}...") | ||
| download.file( | ||
| glue::glue("https://raw.githubusercontent.com/nmfs-ost/workflows-workshop/nefsc-transition/resources/ExportLegacyNEFSCtoASARproject/{i}"), | ||
| glue::glue("{NEFSCtoASAR_folder}/{i}"), | ||
| mode = "wb" | ||
| ) | ||
| } | ||
|
|
||
| for (i in teststocks_files) { | ||
| cli::cli_alert_info("📥 Downloading {i}...") | ||
| download.file( | ||
| glue::glue("https://raw.githubusercontent.com/nmfs-ost/workflows-workshop/nefsc-transition/resources/ExportLegacyNEFSCtoASARproject/testStocks/{i}"), | ||
| glue::glue("{testStocks_folder}/{i}"), | ||
| mode = "wb" | ||
| ) | ||
| } | ||
|
|
||
| for (i in asarreport_files) { | ||
| cli::cli_alert_info("📥 Downloading {i}...") | ||
| download.file( | ||
| glue::glue("https://raw.githubusercontent.com/nmfs-ost/workflows-workshop/nefsc-transition/resources/ExportLegacyNEFSCtoASARproject/ASARreportFiles/{i}"), | ||
| glue::glue("{asarreport_folder}/{i}"), | ||
| mode = "wb" | ||
| ) | ||
| } | ||
|
|
||
| message("✅ Download complete.") | ||
| } | ||
| get_nefsc_files(getwd()) | ||
| ``` | ||
|
|
||
| The following steps will guide you through how to adapt the {asar} workflow and template and migrate the current content in your documents to the new ones: | ||
|
|
||
| 1. Change paths in TestMoreStocksReportOnly.R and source it (run all the code in the file). | ||
|
|
||
| 2. Copy the 3 files in ASARreportFiles and paste them into the report directory made by step 1 (and overwrite). | ||
|
|
||
| ```{r} | ||
| #| eval: false | ||
| file.copy( | ||
| from = list.files(file.path(getwd(), "ExportLegacyNEFSCtoASARproject", "ASARreportFiles"), full.names = TRUE), | ||
| to = file.path(getwd(), "report"), | ||
| recursive = FALSE, | ||
| overwrite = TRUE | ||
| ) | ||
| ``` | ||
|
|
||
| 3. Move in-header.tex to report/support_files and overwrite (this just adds the LaTeX package {float}) | ||
|
|
||
| ```{r} | ||
| #| eval: false | ||
| fs::file_move( | ||
| file.path(getwd(), "report", "in-header.tex"), | ||
| file.path(getwd(), "report", "support_files", "in-header.tex") | ||
| ) | ||
| ``` | ||
|
|
||
| 4. Change paths at the top of report/preamble.R. | ||
|
|
||
| * For the third line (starts with `load`), the example rda file ("Black_Sea_Bass2024.rda") will probably be in your working directory. | ||
|
|
||
| 5. Add the following code to the yaml in the skeleton.qmd (probably named "sar_N_Black_Sea_Bass_skeleton.qmd): | ||
|
|
||
| ``` | ||
| execute: | ||
| echo: false | ||
| message: false | ||
| warning: false | ||
| ``` | ||
|
|
||
| 6. From the skeleton, delete lines 70-75 (before step 5, lines 66-71) and *render*. | ||
|
|
||
| ``` | ||
| # load converted output from stockplotr::convert_output() | ||
| load(fname) | ||
| # Call reference points and quantities below | ||
| output <- out_new |> | ||
| dplyr::mutate(estimate = as.numeric(estimate), | ||
| uncertainty = as.numeric(uncertainty)) | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.