commfish / seak_sablefish

NSEI sablefish stock assessment
8 stars 5 forks source link

Data discrepancies in tag recoveries in the fishery #41

Open jysullivan opened 4 years ago

jysullivan commented 4 years ago

Tags from fishery that don't match landings

https://github.com/commfish/seak_sablefish/blob/ea0ef5821cc7de25a45639b4183ae772dfd948b7/r/mark_recapture.R#L585

Data discrepancy - Some year_trip fishery combos in recoveries df are not in marks df. Seven of the trips are from 2008. They are in IFDB and look like they were missed. They are from the NSEI state managed fishery and appear not to have been accounted for in the countbacks spreadsheets. One option is to the marks df:

anti_join(recoveries %>% 
            filter(!trip_no %in% c(1, 2, 3) & 
                     !is.na(trip_no) & 
                     Project_cde == "02"), 
          marks, by = "year_trip") %>% 
  group_by(year_trip, Mgmt_area) %>% 
  summarize(tags_from_fishery = n_distinct(tag_no)) -> no_match

> no_match
# A tibble: 10 x 3
# Groups:   year_trip [10]
   year_trip Mgmt_area tags_from_fishery
   <chr>     <chr>                 <int>
 1 2008_123  NSEI                      6
 2 2008_2006 NSEI                      5
 3 2008_2007 NSEI                      8
 4 2008_2012 NSEI                      1
 5 2008_2023 NSEI                      4
 6 2008_2029 NSEI                      1
 7 2008_2048 NSEI                      3
 8 2018_9001 NA                        1
 9 2018_9003 NA                        1
10 2018_9004 NA                        1

# Just for 2008 trips..
fsh_tx %>% 
   filter(year_trip %in%no_match$year_trip) %>% 
   group_by(year, trip_no, year_trip, sell_date, julian_day) %>% 
   summarise(whole_kg = sum(whole_kg)) %>% 
   rename(date = sell_date) %>% 
   left_join(no_match, by = "year_trip") %>% 
   select(-Mgmt_area) %>%
   full_join(marks, by = c("year", "trip_no", "year_trip", "date", "julian_day", "whole_kg", 
                                       "tags_from_fishery")) %>% 
   arrange(date)  %>%
   fill_by_value(unmarked, marked, bio_samples, total_obs, value = 0) %>%
   fill_by_value(observed_flag, all_observed, value = "No") -> marks

Adding these landings into the marks df had a pretty large impact on the 2008 assessment, so I omitted this code.

The 2018 tags are from the 9000 series, which are assigned to bio samples that do not have logbooks or samples from a tendered trip where the fish are mixed.

In the 2018 assessment I just filtered out the 2008 and 2018 no_match tag recoveries.

SOLUTION: I think instead I should treat them as "D's" (tags lost in a time period that should be decremented from the next time period).

jysullivan commented 4 years ago

Pothole - check that all fish ticket trips have been accounted for in the NSEI in other years in the daily accounting form... or not. This is a mess!

full_join(fsh_tx %>%
            filter(year >= FIRST_YEAR) %>%
            distinct(year_trip, whole_kg) %>%
            arrange(year_trip) %>%
            select(year_trip, whole_kg1 = whole_kg),
          marks %>%
            distinct(year_trip, whole_kg) %>%
            arrange(year_trip)) %>% View()