pfmc-assessments / lingcod

2 stars 2 forks source link

one row with nSamps = 0 in ageCAAL_S_LamThesis #54

Closed iantaylor-NOAA closed 3 years ago

iantaylor-NOAA commented 3 years ago

I'm not sure if it makes sense to have an open-ended issue on this or specific ones for each anomaly. @kellijohnson-NOAA, if you prefer a separate issue for each finding, feel free to rename this issue to "one row with nSamps = 0 in ageCAAL_S_LamThesis"

@brianlangseth-NOAA, after resolving some problems with data that I processed, here's one that I found in the ageCAAL_S_LamThesis object that you provided. It's probably trivial but I want to make sure it's not a sign of some larger problem.

The r4ss::SS_writedat() function removes of composition data with 0 observations and has a warning. I got such a warning which is driven by line 2 of the male data:

ageCAAL_S_LamThesis$male[2,]
  Year Seas Fleet Gender Partition AgeError LbinLo LbinHi nSamps Age_0 Age_1
2 2016    7     9      2         0        1     30     30      0     0     0
  Age_2 Age_3 Age_4 Age_5 Age_6 Age_7 Age_8 Age_9 Age_10 Age_11 Age_12 Age_13
2     0     0     0     0     0     0     0     0      0      0      0      0
  Age_14 Age_15 Age_16 Age_17 Age_18 Age_19 Age_20
2      0      0      0      0      0      0      0

I'm seeing lots of gaps in the LbinLo and LbinHi values suggesting that other length bin/year combinations with no samples are not being written, so I'm wondering why this single line slipped through the cracks. Not a high priority, but if you get a chance to check, please let me know.

brianlangseth-NOAA commented 3 years ago

@iantaylor-NOAA Thank you for alerting me to this. The issue was that ages with NA were being included for length bin assignment (row being included) but then the age was not included in the number of samples because it was NA (nSamps becomes zero). This is now fixed and the rda is updated. This only affected LamThesis north male samples among CAAL comps Ive done.

I went ahead and changed the title. It is easier to mark each issue as resolved - and more satisfying.

iantaylor-NOAA commented 3 years ago

Explanation makes sense. Thank you. And I agree on the title change / opportunity to close more issues.

iantaylor-NOAA commented 3 years ago

Also, what a pleasure to just run devtools::load_all() and add_data(dat = inputs$dat, area = "s") and find that the warning about "Lines of all zero age comp found" has gone away. The workflow is working!