Skip to content

[Fix] plot_spawning_biomass when user wants to use DERIVED_QUANTITIES from SS3#222

Merged
Schiano-NOAA merged 8 commits intodevfrom
fix-sb-plt-219
Apr 9, 2026
Merged

[Fix] plot_spawning_biomass when user wants to use DERIVED_QUANTITIES from SS3#222
Schiano-NOAA merged 8 commits intodevfrom
fix-sb-plt-219

Conversation

@Schiano-NOAA
Copy link
Copy Markdown
Collaborator

@Schiano-NOAA Schiano-NOAA commented Apr 3, 2026

Summary

An issue was identified in plot_spawning_biomass (and most likely our other plots) when wanting to access specific data. After some investigation, "DERIVED_QUANTITIES" is found in the converted dataset when era = NULL; however there was still an issue finishing the plot because era = NULL in the reference line results in an error. The issue was identified in #219

The fix:

  • adjust reference line to take our era and use plot data instead

Additional changes

  • took out a conditional section when era = NULL plotting horizontal break lines (this is doing too much and not needed)

@JoelRice-NOAA could you take a look at this and confirm this is working for you now? The best way to do this is the following:

remotes::install_github("nmfs-ost/stockplotr@fix-sb-plt-219")
# using your example file
albacore <- stockplotr::convert_output(output_file)
stockplotr::plot_spawning_biomass(
  dat = albacore,
  era = NULL, # this is a key change
  ref_line = c("target" = 10e6),
  unit_label = "mt",
  scale_amount = 1e6,
  relative = TRUE,
  module = "DERIVED_QUANTITIES"
)

This is what I am getting from the example file in stockplotr:

plot_spawning_biomass(stockplotr::example_data, era = NULL)
image

@Schiano-NOAA Schiano-NOAA marked this pull request as ready for review April 6, 2026 12:53
@Schiano-NOAA
Copy link
Copy Markdown
Collaborator Author

Schiano-NOAA commented Apr 7, 2026

Note for development: issue when plotting BAM values @ plot_timeseries step

Edit: This is fixed and this PR is ready to merge

Copy link
Copy Markdown
Collaborator

@sbreitbart-NOAA sbreitbart-NOAA left a comment

Choose a reason for hiding this comment

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

LGTM! Nice job addressing the ref line label issue with the underscore!

@Schiano-NOAA Schiano-NOAA merged commit ad11079 into dev Apr 9, 2026
1 check passed
@Schiano-NOAA Schiano-NOAA deleted the fix-sb-plt-219 branch April 9, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants