Skip to content

[Feature]: add option to convert plot units to lbs#237

Open
Schiano-NOAA wants to merge 18 commits intomainfrom
conv-to-lbs
Open

[Feature]: add option to convert plot units to lbs#237
Schiano-NOAA wants to merge 18 commits intomainfrom
conv-to-lbs

Conversation

@Schiano-NOAA
Copy link
Copy Markdown
Collaborator

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

New argument in spawning_biomass, biomass, and landings plot function to convert units from metric tons to lbs

Plan release for v0.11.0

@Schiano-NOAA Schiano-NOAA changed the title Conv to lbs [Feature]: add option to convert plot units to lbs Apr 27, 2026
@Schiano-NOAA Schiano-NOAA added this to the v0.11.0 milestone Apr 27, 2026
@Schiano-NOAA Schiano-NOAA linked an issue Apr 27, 2026 that may be closed by this pull request
@Schiano-NOAA Schiano-NOAA added the enhancement New feature or request label Apr 27, 2026
@Schiano-NOAA Schiano-NOAA marked this pull request as ready for review May 6, 2026 14:38
@Schiano-NOAA
Copy link
Copy Markdown
Collaborator Author

@sbreitbart-NOAA this is ready for review and you will receive a request shortly. I wanted to note first that

  • bam exports landings in klbs (thousands of lbs) so this will be on the user to change unit_label and NOT use the lbs argument
  • error will not be present when converting from kgs to lbs
  • this argument assumes the output is in kgs

We should plan for this to be temporary until the units column is incorporated into the converter for all models. Once that feature is developed, we can adjust the lbs feature in respective plots to pull the units from the conout file and proceed from there (i.e. if units are already lbs and user sets lbs = TRUE then nothing happens and unit_label can be extracted from the model)

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.

Github won't let me comment on individual lines, so I'll add my comments here. Looks like this is working well! Just have a couple of suggestions and a question:

plot_spawning_biomass.R
L39: suggest updating param to something like this:
#' @param lbs A logical value indicating whether to convert the y-axis values, assumed to be in kilograms, to pounds.
L135: Did you end up verifying this, as per your comment?

process_data.R
L13: Same comment as for plot_spawning_biomass.R L39

@Schiano-NOAA
Copy link
Copy Markdown
Collaborator Author

Schiano-NOAA commented May 6, 2026

@sbreitbart-NOAA Maybe I should changed assumed to default. We are just setting the default to FALSE saying the output units are in lbs.

@sbreitbart-NOAA
Copy link
Copy Markdown
Collaborator

@sbreitbart-NOAA Maybe I should changed assumed to default. We are just setting the default to FALSE saying the output units are in lbs.

I'm not sure I understand. Could you please rephrase?

sbreitbart-NOAA and others added 3 commits May 6, 2026 14:08
* [Fix] plot_indices (#221)

* initial commit of new obs v pred plot

* adjust process data so it converts all indexed data to character to function even when input values are numeric per #212

* update plot indices to use new plot_obsvpred function and adjust based on needs

* update documentation for package

* adjust plot_indices where nfleet = 1 and update test to remove new file produced

* add missing dependency

* Address #218 by scaling uncertainty intervals if relative = TRUE for B and SB plots

* remove previous calcs of relative and add if statement instead

* adjust relative=TRUE cases to extract proportion from model rather than calc in fxn

* add era into arg for plot_biomass

* reflect changes for plotting relative values from the model for spawning_biomass

* add other option to find biomass when relative

* remove relative option from reference_line

* adjust ref line when ref is unfished becomes point

* remove option to be relative in F plot

* remove commented out code

* move placement of unfished reference point in if statement

* update documentation

* remove outdated tests for sb plot

* remove extra test and fix relative testing

* remove relative example from sb plt since it doesnt exist in the example data

* update documentation

* remove rel F quantities

---------

Co-authored-by: Sam Schiano <125507018+Schiano-NOAA@users.noreply.github.com>
@Schiano-NOAA
Copy link
Copy Markdown
Collaborator Author

@sbreitbart-NOAA Maybe I should changed assumed to default. We are just setting the default to FALSE saying the output units are in lbs.

I'm not sure I understand. Could you please rephrase?

My apologies. I misunderstood what you said in your first comment. I can add some indication that we assume the default units are kgs

@Schiano-NOAA
Copy link
Copy Markdown
Collaborator Author

@sbreitbart-NOAA okay thoughts on the new wording?

@sbreitbart-NOAA
Copy link
Copy Markdown
Collaborator

@sbreitbart-NOAA okay thoughts on the new wording?

So close! I think you're just missing a word ("from"):

@param lbs A logical value indicating whether to convert the y-axis values from
#' kilograms to pounds. The default units match the default in the
#' unit_label argument - 'metric tons'.

Base automatically changed from dev to main May 8, 2026 14:11
@Schiano-NOAA Schiano-NOAA force-pushed the main branch 2 times, most recently from b057594 to 5cabc07 Compare May 8, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add options for plots to be output in lbs

2 participants