afsc-assessments / afscdata

An R package for data extraction of AFSC survey and fishery data
https://afsc-assessments.github.io/afscdata/
Other
2 stars 0 forks source link

add cols #27

Closed pete-hulson closed 1 year ago

pete-hulson commented 1 year ago

https://github.com/afsc-assessments/afscdata/blob/369dec607b45f1f762e04d509f465b30d9af8c5f/R/queries.R#L442 need to add in hauljoin and portjoin in here for subsequent age/length comp expansions

BenWilliams-NOAA commented 1 year ago

i'm not understanding this one, this is pointing to the observer data pull that is only used for catch projection?

BenWilliams-NOAA commented 1 year ago

i'm not understanding this one, this is pointing to the observer data pull that is only used for catch projection?

pete-hulson commented 1 year ago

right - for this i'm thinking ahead in how we would expand the length/age comps, might be better suited for it's own separate fcn, or, we could write out two sets of data here, one that is for projections, and one that is the whole time series for expansion purposes

BenWilliams-NOAA commented 1 year ago

i'm still dumb, haven't seen this used for anything other than getting the previous 3 years catch through october. not sure why we would use this for length/age comps when we have other functions that pull those data directly q_fsh_specimen and q_fsh_length?

zandjyo commented 1 year ago

Hey Ben, One should weight the raw fishery age/length comps by the catch in some fashion to get the properly expanded length/age compositions for the stock assessment. So the specimen data and length frequency data need to be linked somehow to the catch data. For cod we expand them at several levels requiring the haul join and port join as well as the unique delivery/trip ID if possible.

On Mon, May 22, 2023 at 8:56 PM Ben Williams @.***> wrote:

i'm still dumb, haven't seen this used for anything other than getting the previous 3 years catch through october. not sure why we would use this for length/age comps when we have other functions that pull those data directly q_fsh_specimen and q_fsh_specimen ?

— Reply to this email directly, view it on GitHub https://github.com/afsc-assessments/afscdata/issues/27#issuecomment-1558479689, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJFGJP4WUSGMVHDOHBEAUDXHQYNVANCNFSM6AAAAAAYKZXG2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Steven J. Barbeaux Ph.D. Research Fisheries Biologist Alaska Fisheries Science Center, National Marine Fisheries Service National Oceanic and Atmospheric Administration 7600 Sand Point Way NE, Seattle, WA 98115 USA Tel: (206) 729-0871

BenWilliams-NOAA commented 1 year ago

thanks steve - i'm clear on all the age/length comp expansions. should be noted that this is not the function designed for (or should be used for) calculating age/length comps. it is a holdover function from goa rockfish assessments that was only used to calculate oct catch relative to the end of the year. i ported it over here (after hemming and hawing) simply to have it available for goa rockfish .dat file configuration with the understanding that it would be absorbed in another function (projected catches anyone...) in time, though looking at the function further I see how it could be used just as well for comps.

seems comps are fairly nuanced and complex e.g., some get pulled directly from norpac.debriefed_age_mv others get estimated outside of GAP products (also have swo code we can use). since cod are a bit of comp oddballs i think it may be worthwhile to wrap them in their own function(s) to save getting bogged down trying to generalize q_fsh_specimen (or this function), though i can (easily) be convinced otherwise.

long-winded way of saying - happy to help craft functions to estimate comps in the way cod assessments need (sounds like bootstrapping may be involved?), if we can slightly mod this function great! otherwise happy to let it die on the vine

pete-hulson commented 1 year ago

so, i think there's a couple of things we can do here - ultimately what we need is observer catch data for the full time series (with the haul-port join columns so that it can be matched to the length and specimen data), we also need it for the most recent 3 years (in the case of how rockfish do projections). we can either change this function slightly by adding the port-haul join columns and writing out data for the full time series (then on the back end adjust our rockfish projection scripts to take the most recent 3 years from this data), we add these columns and write the recent three years data and the full time series data separately (if we did this we may get away with not having to change the rockfish projection fcns), or, we write a stand alone function that pulls and writes the whole times series of observer catches with haul-port joins added as columns. my preference is the first option, as it seems to be the easiest & most efficient

BenWilliams-NOAA commented 1 year ago

moved to discussion