Skip to content

Feature(#38): Fixes the integration with R for TAC. Adds functionality for effort - #73

Open
erlasturl wants to merge 6 commits into
devfrom
feature/i38-rlink
Open

Feature(#38): Fixes the integration with R for TAC. Adds functionality for effort #73
erlasturl wants to merge 6 commits into
devfrom
feature/i38-rlink

Conversation

@erlasturl

Copy link
Copy Markdown
Collaborator

Your commits explain the who, what, where and when of these changes. Your code shows the how. You do not need to reiterate this. This PR should complete the big picture by telling the why.

Justification

Makes the RAssess functions work for TAC and Effort allocation.

The main changes was done to Read_RAssess_output(). It can read in to format of files 1) TAC for each fishery 2) Effort allocation (box, season, fishery) based on effortmodel= 3. The code detects if there is TAC or Effort in the header of the file from R. It then reads the values into the appropriate arrays. The format of the files needed is given in a comment above the function in the code.

In order to allocate effort one needs to assess a species and put isTAC > 1 in the group csv file. This should then be done for a group which is not being assessed for TAC. The parameterization does not really make sense for effort allocation. We may want to add a parameter so instead of whichRAssess_XXX we would have RAssesseffortAllocation_YYY. Then I think we would need to call Do_RAssess (or just Run_RAssess() and Read_RAssess_output()) somewhere outside the loop Do_RAssess() is in. Maybe we would like to put it straight into RunNextTimeStep() after Manage_Calculate_Total_Effort() so it can be called before each season or monthly and the effort allocation for certain fleets updated.

Added new arrays to RAssessSurvey() to collect size index and fixed minor bugs. Using Ecology_Get_Size() instead of Get_Length() as there is a bug in Get_Length() when converting from mg N to g ww. Ecology_Get_Size() used the l-w parameters from the biology file but Get_Length() uses parameters from the assessment file.

In Populate_RAssessFile() I removed code that was not working. The array SizeCaught was only created but never used so only contained zeros. I made changes in Calculate_Catch() such that SizeCaught contains caught biomass which is used in Populate_RAssessFile() to calculate size in catch. This function now reads data into all columns that were initialized.

Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other change (if none of the other choices apply)

Further comments

If this is a New Feature, Breaking change, or a bug fix, the Atlantis Manual will need to be updated to reflect these changes.
Now would be a good time to create an issue in the Atlantis Manual repo and begin documenting your changes.

  • I've created an issue
  • This is NA

Reviewer instructions:

Assign at least 2 reviewers:

  • one of which should be a maintainer,
  • the others should be familiar with the subject changes. Please add these under the assignees field

Please detail the process reviewers will need to follow to properly test these changes. It is especially helpful to identify the exact code needed to conduct a local build/review/test and to specify any aspects of the testing that may not be obvious.

I have written sections in the manual "Effort reallocation using R-link" in "Fishing Mortality" chapter and "Dynamic TAC using R-link" in "Management" that should help with the testing. Theses sections can be found on following branch

https://github.com/Atlantis-Ecosystem-Model/AtlantisManual/tree/docs/i32-rlink-documetation-new

In order to test this a model with assessment parameter file is needed and to test the effort allocation a fleet with effort model 3 is needed.

@erlasturl
erlasturl requested review from andybeet and eafulton August 28, 2026 11:10
@andybeet andybeet changed the title Feature/i38 rlink Feature(#38): Fixes the integration with R for TAC. Adds functionality for effort Sep 8, 2026
@jcaracappa1

Copy link
Copy Markdown
Collaborator

@erlasturl For new features, I think we need to be able to test it on the example SETAS model within the repo. That would allow anyone to review the new functionality more easily. To do this, we would need an example assess.prm file and R script in the example folder and instructions in the Pull Request for how to "turn on" the R link in the SETAS model. Otherwise, we would be testing a new feature on different regional models potentially introducing new issues.

@andybeet
andybeet changed the base branch from main to dev September 9, 2026 19:58
@andybeet

andybeet commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

@erlasturl Did you have issues initially compiling this? I noticed you had changed the PreRules.am? Do you remember was going on? This PR had a merge conflict that i fixed but now the workflow is failing. It is looking for a file in the r-base-dev package which we dont install in the workflow. Not sure why it is now required.

I think it is related to ubuntu 18.04 EOL. Some base packages being moved into archived repositories. I have updated the workflow to run on 20.04 and amended the Prerules on a fork and i am testing it. I will make a branch off of this with the changes and we can merge it back into this PR.

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