Feature(#38): Fixes the integration with R for TAC. Adds functionality for effort - #73
Feature(#38): Fixes the integration with R for TAC. Adds functionality for effort #73erlasturl wants to merge 6 commits into
Conversation
… from fisheries fleet but sel param for assessment fleet. Get_Length has a bug in wgt calc and used l-w param from assess file, using Ecology_Get_Size() instead.
|
@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 |
|
@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 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. |
Your commits explain the
who,what,whereandwhenof these changes. Your code shows thehow. You do not need to reiterate this. This PR should complete the big picture by telling thewhy.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
xin the boxes that applyFurther 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.
Reviewer instructions:
Assign at least 2 reviewers:
assigneesfieldPlease 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.