PIFSCstockassessments / 2024-WCNPO-MLS-Rebuilding

1 stars 0 forks source link

Not filtering selectivity at age properly #13

Open MOshima-PIFSC opened 7 months ago

MOshima-PIFSC commented 7 months ago

I am going through the Build_Input_Files.R test script but am running into an issue. On line 47 UniqueFleets <- which(!duplicated(SSInput$Fishery_SelAtAge)) is not filtering out any rows for selectivity. I believe because it is including the year and fleet column, all the rows are going to be unique. One way to get around this is to group by year and see which fleets within the same year have the same selectivities and make sure to ignore the first 2 columns. However, if selectivity changes within a fleet across years, I'm not sure how you want to handle that.

michellesculley commented 7 months ago

I just pushed a change to match the 013_BuildAGEPROInputfile.R with the Build_Input_File.R to reflect changes in the SS_to_Agepro functions. It should work properly now.

JonBrodziak commented 7 months ago

Looks like issue this has been resolved but I will check the new Build_Input_File with previous test cases and update the /Build-Input-File/test and /Build-Input-File folders

As for the issue of fleets with time-varying selectivity, there are 2 fleets with time-varying selectivity: the Hawaii longline and the Japanese distant water longline in area 1 and quarter 1. Both of these fleets have constant fishery selectivities since the mid-2000s so this will not affect the future projections based on recent average fishery system conditions. But a great question to consider for other applications. Thanks Meg.

On Wed, Jan 17, 2024 at 1:19 PM Meg Oshima @.***> wrote:

I am going through the Build_Input_Files.R test script but am running into an issue. On line 47 UniqueFleets <- which(!duplicated(SSInput$Fishery_SelAtAge)) is not filtering out any rows for selectivity. I believe because it is including the year and fleet column, all the rows are going to be unique. One way to get around this is to group by year and see which fleets within the same year have the same selectivities and make sure to ignore the first 2 columns. However, if selectivity changes within a fleet across years, I'm not sure how you want to handle that.

— Reply to this email directly, view it on GitHub https://github.com/PIFSCstockassessments/2024-WCNPO-MLS-Rebuilding/issues/13, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVXIZV4AYDCZQD7OSGA2TDYPBL7LAVCNFSM6AAAAABB7K6JCWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4DOMJXGIYDSNY . You are receiving this because you were assigned.Message ID: @.***>

-- Jon Brodziak, Ph.D. NOAA Inouye Regional Center Pacific Islands Fisheries Science Center 1845 Wasp Boulevard, Building 176, NMFS/PIFSC/FRMD Mail Room 2247 Honolulu, Hawaii 96818 USA PIFSC Stock Asessment Program https://pifscstockassessments.github.io/ Phone: 808-725-5617 Email: @.***

“Wherever my travels may lead, paradise is where I am.” ~ Voltaire

The views expressed in this message are my own and do not necessarily reflect any position of NOAA.

MOshima-PIFSC commented 7 months ago

Thanks @michellesculley and @JonBrodziak. @JonBrodziak I created a new branch Review_Build_Input_Files and am working on there right now if you want to add your changes to that branch and we can merge them into the main branch. I had a few other code suggestions I've added to make the code more flexible.

MOshima-PIFSC commented 7 months ago

@JonBrodziak I made some changes to the test/Build_Input_File.R script to match what Michelle did. Have a look at it when you get a chance and make sure it is still doing what you expect. I noticed that the changes do affect the test_input.inp file but I'm familiar enough with the file to know which one is correct. If these changes look ok, I can submit a pull request to the main branch to merge in these changes, but if not, I can fix any issues.