Skip to content
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

Adds area to get_results_timeseries() for SSmse #424

Merged
merged 2 commits into from Apr 17, 2024
Merged

Conversation

kellijohnson-NOAA
Copy link
Contributor

I am so excited that the user community wants to add area-specific models to the mix! So, thank you @skylersagarese-NOAA for reaching out. Hopefully this change fixes the lack of area in the time series results for you. Given the slightly complicated workflow here, you will need to install this branch of ss3sim and then run your code for SSmse as we talked. The branch is locally passing the tests but there are 4 warnings related to things that I need to update and do not pertain, or at least I do not think that they pertain, to the code changes for this request. Again, thanks for reaching out and let me know how your testing goes. You can also test the function locally by just installing this branch and running

output_list <- r4ss::SS_output("YourDirectoryWithModelFilesHere", verbose = FALSE, printstats = FALSE)
small_test <- ss3sim::get_results_timeseries(output_list)
head(small_test)

Once you approve @skylersagarese-NOAA, then I will assign @k-doering-NOAA as a reviewer.

There was no need to call gsub twice, when an `|` performed the same
task for searching for brackets and colons. Now this is done in one call
to `gsub()`.
@kellijohnson-NOAA kellijohnson-NOAA added topic --- results pertains to generating, reading, or visualizing the results status --- needs testing code is in place but testing is needed type --- feature feature requests and enhancement labels Mar 26, 2024
@skylersagarese-NOAA
Copy link

It worked. Area is now retained in the summary function (SSMSE borrowing from ss3sim), so we can sum TS values across areas by year on the back end for our purposes. Thank you @kellijohnson-NOAA !

@kellijohnson-NOAA
Copy link
Contributor Author

Thanks @skylersagarese-NOAA for testing it out!

@k-doering-NOAA I have assigned you as a reviewer to make sure that I did not break anything for SSmse. Please feel free to say that you do not have time.

k-doering-NOAA added a commit to nmfs-fish-tools/SSMSE that referenced this pull request Mar 26, 2024
@k-doering-NOAA
Copy link
Contributor

Thanks @kellijohnson-NOAA and @skylersagarese-NOAA , I can review!

I am testing the branch to make sure no tests in SSMSE are broken by this change: https://github.com/nmfs-fish-tools/SSMSE/tree/test-ss3sim

@k-doering-NOAA
Copy link
Contributor

@kellijohnson-NOAA unfortunately this breaks some code in SSMSE (I think because of the new added column). I won't have time to work on fixes until Friday, is it ok to leave this as an on PR until then?

@kellijohnson-NOAA
Copy link
Contributor Author

Yes, that is just fine, @skylersagarese-NOAA said that there was no rush.

@kellijohnson-NOAA
Copy link
Contributor Author

@k-doering-NOAA There is the following failed test in test-runSSMSE.R that is not failing b/c of ss3sim

  # change one of the summary values so that the SSB_ratio > 2
  summary$ts[4, "SpawnBio"] <- (summary$ts[4, "SpawnBio"])^2 # make really large
  expect_warning(
    ssb_check_warn <- check_convergence(summary, min_yr = 101, max_yr = 106),
    "Some large"
  )
  expect_true(ssb_check_warn[1, "SSB_ratio"] > 2)

because summary$ts[4] is not within years 101--106 so the expected warning is not generated and the returned object ssb_check_warndoes not actually contain the year that you altered withsummary$ts[4,"SpawnBio"]`. But, I am not sure how this test is passing in the main branch right now.

If I change the test in expect_warning to

ssb_check_warn <- check_convergence(summary, min_yr = 4, max_yr = 106)

Then both of the checks pass.

@k-doering-NOAA
Copy link
Contributor

@kellijohnson-NOAA, I think you are right that the indices of the summary$ts object in the test changed with this change in ss3sim, but this is just an issue of the test that was too fragile, not a problem in ss3sim.

Feel free to merge this in when you are ready!

For SPRratio and recruitment deviations, because this information is in
in the derived quantities and recruitment sections that do not summarize
by season or area but rather by year. Determine season of recruitment
from elsewhere in the report file rather than just assign 1.

Use semantic versioning.
@kellijohnson-NOAA kellijohnson-NOAA removed the status --- needs testing code is in place but testing is needed label Apr 17, 2024
@kellijohnson-NOAA kellijohnson-NOAA merged commit dcdb867 into main Apr 17, 2024
2 checks passed
@kellijohnson-NOAA kellijohnson-NOAA deleted the adds-area branch April 17, 2024 15:54
@kellijohnson-NOAA
Copy link
Contributor Author

Thanks @skylersagarese-NOAA for the suggestion and following through with the testing. Also, thanks to @k-doering-NOAA for testing within SSmse!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic --- results pertains to generating, reading, or visualizing the results type --- feature feature requests and enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_results_timeseries function - possible to sum TS values across areas?
3 participants