commfish / seak_sablefish

NSEI sablefish stock assessment
8 stars 5 forks source link

Readability code with age comps #33

Open jysullivan opened 5 years ago

jysullivan commented 5 years ago

Currently use all ages, regardless of readability code.

kwmcneel commented 4 years ago

Readability codes are currently single digits between 0 and 9. Region 1 has historically only uploaded readability codes 1 through 3, but codes 4-9 should be excluded from modeling. Attached is a memo explaining the definitions of the readability codes and references of the historical codes. Readability Memo 1.6.2019.docx

jysullivan commented 4 years ago

Notes for future ageing error matrix: there is both training (i.e. employee's data who are in training) and production data. Contact K. McNeel for more information of reading flags from the ageing database.

jysullivan commented 4 years ago

@kwmcneel It appears that age readability codes 04 and 05 are being uploaded into the database. Maybe I'm using the wrong view?

Here's the query for the NSEI fishery age comps:

query <-
  paste0(" select  year, project_code, trip_no, adfg_no, vessel_name, sell_date, g_stat_area,
          g_management_area_code, sample_type, species_code, length_type_code, 
          length_type, length_millimeters / 10 as length, weight_kilograms,
          age, age_readability_code, age_readability, sex_code, 
          maturity_code, maturity, gear_code, gear

  from    out_g_bio_age_sex_size

  where   species_code = '710' and
          project_code in ('02', '17') and
          g_management_area_code = 'NSEI' and year = ", YEAR)

And here's a table of the numbers of readability codes for 2019:

Age readability codes 2019
01 25
02 622
03 587
04 55
05 17
jysullivan commented 4 years ago

@kwmcneel Once I filtered out the age readability codes > 3 here's the data I have for the NSEI fishery age comps:

Age readability code 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
1 0 7 9 55 34 9 43 0 197 211 15 96 133 103 29 111 58 8 25
2 0 450 353 729 664 370 952 631 894 701 1049 850 692 912 858 834 906 651 622
3 1 1736 1357 1512 1037 1302 504 905 469 621 406 608 471 304 315 482 430 708 587
jysullivan commented 4 years ago

@kwmcneel These are the sample sizes I have for age readability codes > 3 for the NSEI longline survey:

Age readability code 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
1 19 102 9 16 37 31 22 43 17 84 35 3 0 1 3 0 0 23 29 0 1 8 16 49 20 40 24 9 109 44 21 19
2 241 99 198 262 160 374 279 188 258 440 278 103 94 47 74 10 76 264 576 215 234 200 239 427 350 236 448 352 296 436 339 268
3 22 15 11 8 11 28 33 13 32 48 42 228 311 648 581 774 666 589 133 560 397 411 350 200 356 260 90 136 156 117 212 182

The associated query updated to exclude bad age readability codes:

query <-
  paste0(" select  year, project_code, trip_no, target_species_code, adfg_no, vessel_name, 
          time_first_buoy_onboard, number_of_stations, hooks_per_set, hook_size, 
          hook_spacing_inches, sample_freq, last_skate_sampled, effort_no, station_no, species_code, 
          g_stat_area as stat, start_latitude_decimal_degrees as start_lat,
          start_longitude_decimal_degree as start_lon, end_latitude_decimal_degrees as end_lat,
          end_longitude_decimal_degrees as end_lon, avg_depth_fathoms * 1.8288 as depth_meters, 
          length_millimeters / 10 as length, weight_kilograms as weight, 
          age, age_type_code, age_readability_code, sex_code, maturity_code, otolith_condition_code

  from    output.out_g_sur_longline_specimen

  where   species_code = '710' and
          age_readability_code in ('01', '02', '03') and
          project_code in ('603', '03') ") 
jysullivan commented 4 years ago

Hi Jane,

These numbers closely match our database. I think Mike used to go through and personally delete ages with readabilities >3, but 4s and 5s have always existed. I can work with James and try to get the recent higher codes erased from your database if you’d like.

Thanks, Kevin Jan 24, 2020

jysullivan commented 4 years ago

@kwmcneel Excellent! Let's hold off on deleting stuff from the database for now. These high codes are now filtered out in the query, I've added significant documentation, and I plan on including your memo as an appendix in our assessment this year. Hopefully this will sufficiently ward off future mistakes. Thanks again!