nmfs-ost / asar

DRAFT. R package to partially automate a U.S. stock assessment report.
https://nmfs-ost.github.io/asar/
MIT License
7 stars 3 forks source link

Application of converter function to model outputs #27

Closed Schiano-NOAA closed 1 week ago

Schiano-NOAA commented 2 weeks ago

Goal

Build a function that will convert popular assessment model output files to a standardized format. Specifically aiming to follow the standard implemented by the FIMS team. This includes similar object types and naming conventions in the file.

Milestones

  1. Build a function outputs a tibble for estimated and fixed parameters from an assessment model to the degree the file contains the most important values for creating plots and tables for a stock assessment report. This will be a dependency of the satf R package, a sister tool to the asar package.
  2. Make additions to the function to build an S4 object class that includes the next priority of reported values in an output file. (Only if the model output file contains a prioritized system).
  3. Additional functionality for selected data-limited models.

Assessment Models

The following assessment models are or will be supported for the R function to convert the results to a standard format:

Instructions for testing and use

To convert assessment results to the standard form please use the function after installing the 'asar' package:

new_output <- asar::convert_function(model = "SS3", output.file = "~/Report.SSO")

The user has the option to add the output directory in a separate parameter name of outdir or put the entire path with the file name in output.file.

Alternative use:

new_output <- asar::convert_function(model = "SS3", output.file = "Report.SSO", outdir = "~/")

For SS3 users: only the report file is needed for conversion as such, only data found in this file will be converted. For BAM users: please use the .rdata file for conversion (the file resulting from the ADMB2R routines) For WHAM users: no current support for model output. For AMAK users: no current support for model output.

The resulting object is a standard framework that looks like the following: module_name label time year fleet area season estimate uncertainty uncertainy_label
PARAMETERS recrdev NA 2008 1 1 NA -0.187 NA NA
PARAMETERS recrdev NA 2009 1 1 NA -0.156 NA NA
PARAMETERS recrdev NA 2010 1 1 NA -0.190 NA NA
PARAMETERS recrdev NA 2011 1 1 NA -0.201 NA NA
TIME_SERIES SB NA 2008 1 1 NA 11000 NA NA
TIME SERIES SB NA 2009 1 1 NA 11980 NA NA
TIME SERIES SB NA 2010 1 1 NA 13405 NA NA
TIME SERIES SB NA 2011 1 1 NA 14705 NA NA
...

Other factors are considered in the data frame for parameters that are applicable such as length bins, age, subseason, sex, and growth pattern.

Note: The resulting object will not be the final object output from this function by first release (excepted December 2024). Once more decisions are made, the look of the object will vary slightly.