Skip to content

Add population derived quantity lookup by name in rcpp#1357

Open
codeafridi wants to merge 2 commits into
NOAA-FIMS:mainfrom
codeafridi:feature/derived-quantities-registry
Open

Add population derived quantity lookup by name in rcpp#1357
codeafridi wants to merge 2 commits into
NOAA-FIMS:mainfrom
codeafridi:feature/derived-quantities-registry

Conversation

@codeafridi

Copy link
Copy Markdown

proof of concept for issue #1291

What is the feature?

This PR adds a small proof of concept for referencing a population derived quantity from R by name. in issue #1291, the main problem is that derived quantities are created during model setup but do not have a consistent R facing access path like parameters do so I focused on a minimal population side example.

How have you implemented the solution?

I added a small registry path in the CatchAtAge Rcpp interface for population derived quantities during model initialization.

The change does the following:

  • registers population derived quantities into the existing model setup path
  • stores a stable ID for each quantity by name
  • exposes an Rcpp method to retrieve the ID from R using the population id and quantity name

For the proof of concept, I used "spawning_biomass".

I also added a focused test in "test-initialize_modules.R" to check that:

  • a population derived quantity can be referenced from R by name after model initialization
  • an unknown derived quantity returns an error

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

No this change is only within FIMS

@kellijohnson-NOAA

Copy link
Copy Markdown
Contributor

@nathanvaughan-NOAA and @Andrea-Havron-NOAA are you using parts of this PR for your refactor on random effects? If yes, I would like to ensure that @codeafridi gets credit by being a commit author. We can modify this PR if that would be helpful. Please let me know how to proceed. Also, @msupernaw are there parts of the PR that you think should be brought into the codebase?

@nathanvaughan-NOAA

nathanvaughan-NOAA commented May 22, 2026 via email

Copy link
Copy Markdown
Contributor

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.

3 participants