Skip to content

Update Opakapaka case study and add back to github.io page#101

Open
iantaylor-NOAA wants to merge 33 commits into
mainfrom
opakapaka-update
Open

Update Opakapaka case study and add back to github.io page#101
iantaylor-NOAA wants to merge 33 commits into
mainfrom
opakapaka-update

Conversation

@iantaylor-NOAA

Copy link
Copy Markdown
Contributor

What is the feature?

I updated the opakapaka case study to use r4ss::ss3_data_to_fims() which eliminates the need for all the custom code processing the weight-at-age and age-to-length-conversion inputs. The match with the SS3 isn't perfect, but it's pretty good and I think worth having the stock visible on the rendered github.io page.

How have you implemented the solution?

  • Modify input processessing using new r4ss function (and point to the main branch of r4ss)
  • Copy some calculations and the index plots from pacific-hake.qmd
  • Add Opakapaka back to the rendered github.io page
  • Change the title to "'Ōpakapaka" with the Hawaiian diacritical marks (the ʻokina and the kahakō) as shown on this NOAA page: https://www.fisheries.noaa.gov/species/crimson-jobfish-opakapaka

Does the PR impact any other area of the project, maybe another repo?

  • No

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the PIFSC ‘Ōpakapaka case study to use the newer r4ss::ss3_data_to_fims() pathway (reducing custom SS3-to-FIMS data wrangling), and re-enables the case study in the rendered GitHub Pages site.

Changes:

  • Refactors the ‘Ōpakapaka case study data-prep to use r4ss::ss3_data_to_fims() and updates plots/parameter setup accordingly.
  • Adds the case study back into the Quarto render list + sidebar navigation (with Hawaiian diacritics in the title).
  • Switches CI/devcontainer dependency install from an r4ss feature branch to github::r4ss/r4ss.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
content/PIFSC-opakapaka.qmd Reworks SS3→FIMS data conversion and updates model setup/plots; re-titles the case study.
_quarto.yml Adds the ‘Ōpakapaka case study back to rendering and sidebar nav.
.github/workflows/render.yml Updates CI dependency install to pull r4ss from default branch.
.github/workflows/render-and-publish.yml Updates publish workflow dependency install to pull r4ss from default branch.
.devcontainer/devcontainer.json Updates devcontainer package list to pull r4ss from default branch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/render.yml
Comment thread .github/workflows/render-and-publish.yml
Comment thread .devcontainer/devcontainer.json
Comment on lines 405 to 407
dplyr::rows_update(
tibble::tibble(
module_name = "Recruitment",
Comment thread content/PIFSC-opakapaka.qmd
Comment thread content/PIFSC-opakapaka.qmd Outdated
opaka_ctl$sd_ratio <- NULL
opaka_ctl$submorphdist <- NULL

# remove intial F estimation
Comment thread content/PIFSC-opakapaka.qmd Outdated
group_by(datestart) |>
reframe(prop = value/sum(value))
prop.dat <- opaka_dat_fims |>
filter(type == "length" & name == "BFISH") |>
@iantaylor-NOAA

Copy link
Copy Markdown
Contributor Author

@MOshima-PIFSC, if you're back and have any time to spare, you could look at these changes. Feel free to make additional changes, or raise any issues you find.

iantaylor-NOAA and others added 2 commits June 25, 2026 05:47
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@kellijohnson-NOAA kellijohnson-NOAA moved this to Ready (R) in FIMS Code Club Jun 25, 2026
@kellijohnson-NOAA kellijohnson-NOAA moved this from Ready (R) to In progress in FIMS Code Club Jun 25, 2026
@kellijohnson-NOAA kellijohnson-NOAA moved this from In progress to In review in FIMS Code Club Jun 25, 2026
…rent output structure

Align the opakapaka FIMS inputs and rebuild the age-to-length conversion rows with explicit fleet names and modeled timing so the FIMSFrame validates cleanly.

Update biomass, recruitment, index, and landings to align on years and replace hard-coded module and report indexing with lookup-based joins tied to the configured fleet modules.

Also drop undefined recruitment-deviation rows before plotting so the rendered case study no longer emits geom_line missing-value warnings.
@awilnoaa

Copy link
Copy Markdown

@iantaylor-NOAA, I pushed a case-study cleanup commit for the opakapaka qmd and was able to render it locally after these updates.

What I changed:

  • cleaned up the local SS3-to-FIMS data conversion used in the qmd so the FIMSFrame builds cleanly
  • rebuilt the age-to-length conversion rows with explicit fleet names and timing
  • updated the biomass, spawning biomass, recruitment, and recdev comparison plots to match the current FIMS report timing
  • replaced hard-coded module/report indexing in the index and landings diagnostics with lookup-based joins
  • removed the undefined recruitment-deviation row from the SS3 plotting data so the render no longer throws the geom_line missing-value warning

The main point I would especially appreciate review on is the year alignment in the diagnostics section. From the local checks I ran, it looks like:

  • FIMS biomass and spawning biomass include one extra initial-year value, so I aligned those series as start_year - 1 through end_year
  • FIMS expected recruitment aligns with modeled years start_year:end_year
  • FIMS recruitment deviations do not seem to be defined for the first modeled year, so I padded that first year with NA before plotting
  • SS3 includes one undefined initial recdev row, which I now drop before plotting

I also rendered the case study locally after these changes and it completed successfully.

One note: I used m_landings() in the qmd cleanup because that matched the current exported interface on my side. If model_landings() is the preferred function for this stage or branch, I’m happy to update that too once we confirm which interface we want to standardize on.

@iantaylor-NOAA

Copy link
Copy Markdown
Contributor Author

@awilnoaa, thank you for all the improvements to this case study!

I'm having problems rendering it locally so it's hard to speak to the issues around the range of years in the plotting.

One thing I noticed is that these commands should not be necessary given the current state of r4ss::ss3_data_to_fims() in the main branch of r4ss:
https://github.com/NOAA-FIMS/case-studies/pull/101/changes#diff-94b6ce3753434fa8e875cbe8d0f166758897d3616fbaa3a67f8f8c67ee0dfa2bR259-R264
I attempted to fix that via the change to .devcontainer/devcontainer.json in this PR but that change may not have been applied to your local version.

@awilnoaa

awilnoaa commented Jul 2, 2026

Copy link
Copy Markdown

Hi @iantaylor-NOAA thank you! After reading your comment, I went back and realized I was testing with an older local version of r4ss, so I updated my install to version 1.55.0 and reran ss3_data_to_fims().

After updating, I was still running into the same issue, so I checked the function on the r4ss main branch. It looks like the current version is setting type = "weight_at_age" in the weight-at-age block and creating the age-to-length rows with name = NA, timing = NA, and type = "age_to_length_conversion" in the age-to-length block. So from what I can tell, changing the type strings to the hyphenated versions might fix the type-name mismatch, but that would only solve part of the problem.

I think the age-to-length rows would still be incomplete for the way the opakapaka qmd is currently building a FIMSFrame, because I think they are still coming through without fleet assignment or timing.

For reference, these are the lines I was looking at in the current r4ss function:

weight_at_age: https://github.com/r4ss/r4ss/blob/main/R/ss3_data_to_fims.R#L349
age_to_length_conversion: https://github.com/r4ss/r4ss/blob/main/R/ss3_data_to_fims.R#L463-L465

Let me know your thoughts

@iantaylor-NOAA

Copy link
Copy Markdown
Contributor Author

@awilnoaa,
I'm sorry for my confusion on the requirements for FIMSframe.
My understanding is that the age_to_length_conversion doesn't need fleet or timing as shown in data_big here:
https://noaa-fims.github.io/FIMS/articles/fims-input-data.html#age-to-length-conversion-type-age_to_length_conversion

The data_big object does assign the weight_at_age data to "fleet1", but I thought that the name column wasn't being used since those data are shared among all fleets. But maybe I'm getting that wrong or using a different branch of FIMS by accident.

It's the day before a long holiday weekend, but maybe we can work through this together sometime next week.

@MOshima-PIFSC

Copy link
Copy Markdown
Contributor

@iantaylor-NOAA Sorry I haven't gotten around to this yet. I am just starting to get back and caught up with things. I'm happy to join you and @awilnoaa sometime next week to work through this!

@Rick-Methot-NOAA

Copy link
Copy Markdown

numbers(time, bio*, age, area) can be distributed to numbers(time, bio, age, area, length) at the population(time, area) level.
Then for each fleet operating in (time, area), the length and bio selectivity of that fleet needs to be taken into account to get catch(time, area, bio, fleet, age, length), from which mean body weight can be calculated.

  • bio is inclusive of sex and any other partitions of the population based on biological characteristics.

MOshima-PIFSC and others added 18 commits July 9, 2026 14:52
- no longer requires case-studies code to create age-to-length-conversion or wtatatage

- estimation not currently working
- also add to _quarto.yml to get it to render
…rent output structure

Align the opakapaka FIMS inputs and rebuild the age-to-length conversion rows with explicit fleet names and modeled timing so the FIMSFrame validates cleanly.

Update biomass, recruitment, index, and landings to align on years and replace hard-coded module and report indexing with lookup-based joins tied to the configured fleet modules.

Also drop undefined recruitment-deviation rows before plotting so the rendered case study no longer emits geom_line missing-value warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

6 participants