pfmc-assessments / PacFIN.Utilities

R code to manipulate data from the PacFIN database for assessments
http://pfmc-assessments.github.io/PacFIN.Utilities
Other
7 stars 1 forks source link

Data request for petrale and canary (catch only) after fix to 2022 data #118

Closed iantaylor-NOAA closed 3 months ago

iantaylor-NOAA commented 1 year ago

Identify the common name(s) or PacFIN species code(s)

GRND FLAT PTR1                 NOM. PETRALE SOLE               
GRND FLAT PTRL                 PETRALE SOLE     

Type of data needed

catch

Additional information

Catch data for petrale and canary needs an update due to a fix in the 2022 landings info reported by WDFW on June 5:

We just identified an issue in our fish ticket PacFIN data feed procedure for 2022 landings. There are about 5000 lb of canary and 127K lb of petrale commercial landings not included in PacFIN. These mostly are from the tribal tickets. They are in our internal system but got filtered out in the PacFIN data feed. We working with PacFIN to fix this issue ASAP.

WDFW has confirmed today that the data should be available in PacFIN

Previous petrale data request was: https://github.com/pfmc-assessments/PacFIN.Utilities/issues/87. I don't see the previous canary request.

These additional catches represent about 3% of the catch in that fleet for each model.

Tagging @brianlangseth-NOAA, @okenk, and @gertsevv.

Do you you have clearance to access these data?

kellijohnson-NOAA commented 1 year ago

PacFIN.PTRL.CompFT.12.Jun.2023.RData and PacFIN.CNRY.CompFT.12.Jun.2023.RData are now on the network.

kellijohnson-NOAA commented 1 year ago

As soon as @brianlangseth-NOAA and @iantaylor-NOAA confirm that the data they need are in the downloads then we can close this issue.

chantelwetzel-noaa commented 1 year ago

@kellijohnson-NOAA Thank you for taking care of this so quickly

brianlangseth-NOAA commented 1 year ago

I ran this through our scripts and I get no change from WA. Sample size is exactly the same. Oregon has a few more samples which amount to 0.02 mt more catch in 2022 which serves to show that at least something has changed.

@iantaylor-NOAA If you similarly get no change then we can go back to theresa. Either the upload to PacFIN didn't work or our scripts are somehow excluding those records.

iantaylor-NOAA commented 1 year ago

Petrale has no new records from Washington. Both extractions have 178 fish tickets from Washington in 2022 with identical FTID values and a single entry that differs by 0.206 mt.

On the other hand, we didn't previous get an extraction with the change to 2017 California catch, so that's an extra 224 mt that we should remove from the model.

# load catch extraction from January 2023
load("data-raw/pacfin/PacFIN.PTRL.CompFT.27.Jan.2023.RData")
catch.pacfin_old = catch.pacfin
rm(catch.pacfin) # probably not needed, but being cautious
# load catch extraction from June 2023
load("data-raw/pacfin/PacFIN.PTRL.CompFT.12.Jun.2023.RData") 

# look at total catch by year and state
x1 = aggregate(catch.pacfin$LANDED_WEIGHT_MTONS, 
  by = list(catch.pacfin$LANDING_YEAR, catch.pacfin$AGENCY_CODE), 
  FUN = sum)
x2 = aggregate(catch.pacfin_old$LANDED_WEIGHT_MTONS, 
  by = list(catch.pacfin_old$LANDING_YEAR, catch.pacfin_old$AGENCY_CODE), 
  FUN = sum)
# calculate differences
xdiff <- data.frame(x1, sum_landings_Jan_mt = x2[,3], diff_Jun_minus_Jan = round(x1[,3] - x2[,3], 3))
xdiff %>% 
  dplyr::rename(year = Group.1, agency = Group.2, sum_landings_Jun_mt = x) %>% 
  dplyr::filter(diff_Jun_minus_Jan != 0, year < 2023) %>%
  dplyr::arrange(year)
#   year agency sum_landings_Jun_mt sum_landings_Jan_mt diff_Jun_minus_Jan
# 1 2014      C           622.68543           622.67996              0.005
# 2 2017      C           616.66437           841.16591           -224.502
# 3 2022      C           966.36331           964.23250              2.131
# 4 2022      W            79.89495            80.10133             -0.206
brianlangseth-NOAA commented 1 year ago

@kellijohnson-NOAA I alerted Theresa about the new pull not having updated data. Im not sure where is issue is. I guess we will wait and see.

kellijohnson-NOAA commented 1 year ago

I just pulled again and no differences from Monday for 2022 data but there was more 2023 from Washington so PacFIN did pull from their server.

kellijohnson-NOAA commented 1 year ago

For 2022 landings (mt) I am getting

kellijohnson-NOAA commented 3 months ago

Closing because Theresa confirmed that 130 was incorrect for canary and that PacFIN matches what WDFW has for petrale. Also to note, when getting emails from Theresa about catch, they are WA catches across all FLEET_CODEs because her query does not separate them out. I was wrong in thinking in an email that she was referring to just tribal catch.