afsc-assessments/afscdata

Confirm that bts comp data from the BS/AI region gets returned

Closed this issue · 1 comments

dplyr::arrange(year) -> table

When I ran the q_bts_specimen and q_bts_length functions as-was for BSAI flathead, I got back empty data frames. I tracked this issue down to the final filter step, whereby it seems that the left_join with object cc only contains hauls from the GOA (so filtering on 'BSAI' afterwards returns zero rows).

I'm not familiar enough with this schema to know whether I'm either specifying something incorrectly, or whether there needs to be some ifelse() steps at the top of this function, as in the biomass query to ensure we get back values for regions other than GOA. The legacy code I have calls from haehnr which I'm sure is not preferable.

Could someone test this on another BSAI stock and suggest an alternative?

OK, I looked into this again. The empty-dataframe issue persisted for ATF and the fix is straightforward.

We need an ifelse clause at the top to convert area = 'BSAI' to c('BS','AI') as in other functions. I struggled to catch this before because the tbl objects can't be investigated like data frames and are quite slow to convert.

I have updated q_bts_length and q_bts_specimen with this change under SHA#s 51051ef and 999f451

I have not yet dug into whether the full suite of area renames (a la q_catch) is also necessary.