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

minor problems processing output from a few SS3 models #35

Closed iantaylor-NOAA closed 1 week ago

iantaylor-NOAA commented 1 week ago

I'm excited to see all the progress on converting SS3 output!

I tried out convert_output() on the collection of 18 SS3 models at https://github.com/nmfs-ost/ss3-test-models/ and only ran into two minor issues.

First, there are a few instances where con.file should be con_file starting with https://github.com/nmfs-ost/asar/blob/8d622376c25e1d4924f322f7401cd8a56adc5d6e/R/convert_output.R#L991

The second issue only occurred in processing the OVERALL_COMPS table for models that had age comps but no length comps. This output section (which has never been processed by r4ss::SS_output() so may not be needed by asar::convert_output() either) is really two tables, one for lengths comps, and one for age comps, with different numbers of columns in each case. When there are no lengths comps but the number of length bins is greater than the number of age bins (e.g. in the Hake_2018 model), then this line https://github.com/nmfs-ost/asar/blob/8d622376c25e1d4924f322f7401cd8a56adc5d6e/R/convert_output.R#L422 thinks that all the rows of the table are incomplete because they don't match the number of length bins and it removes all the contents of the table resulting in

Error in `tidyr::pivot_longer()` at asar/R/convert_output.R:466:11: `
! `cols` must select at least one column.`

If you want to create a test or github action that uses these test models in the future, you could adapt code from https://github.com/r4ss/r4ss/blob/main/tests/testthat/test-test-models.R (which could be simplified with the addition of r4ss::download_models() and r4ss::get_ss3_exe())

Schiano-NOAA commented 1 week ago

@iantaylor-NOAA Thanks for testing this Ian! I am making the fix now for con_file. I did actually notice that issue with length/age comps a bit during initial development and it totally slipped my mind. Would you be able to add an example SS3 report file to this issue that includes both age and length comps as you described?

Bai-Li-NOAA commented 1 week ago

Thanks @iantaylor-NOAA for sharing the test-test-model.R. I will adapt the code as I work on addressing integration test issue #29

iantaylor-NOAA commented 1 week ago

Thanks @Schiano-NOAA and @Bai-Li-NOAA for your work on this. Here are some report files from the ss3-test-models set (renamed with model name and .txt in order to attach here), where the hake model has just age comps and big skate has both lengths and ages: Report_Hake_2018.sso.txt Report_BigSkate_2019.sso.txt