Closed MargaretSiple-NOAA closed 2 weeks ago
OK Paul has provided the path to the instructions for producing Table 3: AI-GOA/Instructions&Procedures/Data Report/Table 3/Instructions CPUE tables by INPFC area and depth_REVISED OCT 12 2017
I have done the same for Table 4 and it looks fine, so this is the one species-specific table we need to do.
Here is a rough sketch of how I think this table is produced. I believe Paul uses something like BIOMASS_INPFC_DEPTH, but it should be replicable from the tables in the AI and GOA schemas.
GOA.GOA_STRATA
(which, counterintuitively, contains stratum information for all the strata in the GOA and the AI), and AI.BIOMASS_STRATUM
.GOA_STRATA
to AI strata only, then left join that table to BIOMASS_STRATUM
so that you have stratum areas for each stratum -- this is important because you'll use the areas to weight the biomass averages, as in this function. I'm sorry I'm not more helpful! My brain is very foggy. I will try this again when I am not sick. In the meantime, even an RODBC::sqlquery()
version is good. And that isn't even needed until next year!
Table 3 = for a given species and year, a summary by survey district and depth intervals of CPUE and Biomass. It looks like this:![image](https://user-images.githubusercontent.com/73858992/214939028-34da1e60-4ee3-46d6-9111-2d789832989f.png)
In documentation and in convo with Paul and Nate, the CPUE and biomass estimate tables for a given species are always called "Table 3" and "Table 4" even though these may not match their names in the formal report. I'm using that terminology here to be consistent, but just FYI Table 3 and Table 4 repeat for each species in the report by chapter.
I don't know where the SQL script is to produce Table 3 (or Table 4 for that matter), so I'm busting this issue into two tasks and assigning both Paul and Alex, though I think each of you will do one of these:
RODBC::sqlQuery()
to pull the data for creating Table 3 from the RACEBASE and/or AI schemas, and then formats it for R? Since there is one table per species, I recommend writing this script for a single species, then turn it into a function wherespecies_code
is one of the arguments.