options(scipen = 999)

year <- format(Sys.time(), "%Y")
assessmentyear <- as.numeric(year) - 
  as.numeric(as.numeric(format(Sys.time(), "%m")) < 5)

mydir <- hakedata_wd()
mydirfiles <- dir(
  full.names = TRUE,
  file.path(mydir, "extractedData"),
  pattern = "\\.Rdat"
)
for (i in mydirfiles) {
  load(i)
}

date: r format(calc_calendar_date(params$wednesdaynumber), "%b. %d, %Y")

atseacatch <- aggregate(
  OFFICIAL_TOTAL_CATCH ~ VESSEL_TYPE + format(as.Date(HAUL_DATE),"%Y"),
  data = ncatch[ncatch$SPECIES == 206 & ncatch$VESSEL_TYPE %in% 1:2, ],
  sum
)
atseacatchMS <- atseacatch[atseacatch$VESSEL_TYPE == 2 & atseacatch[, 2] == year, 3]
atseacatchCP <- atseacatch[atseacatch$VESSEL_TYPE == 1 & atseacatch[, 2] == year, 3]

tribalcatchinpacfin <- pcatch %>%
  dplyr::filter(FLEET == "TI", YEAR == year) %>%
  dplyr::summarize(MT = sum(MT)) %>%
  dplyr::pull(MT)
shorecatch <- pcatch %>%
  dplyr::filter(
    YEAR == assessmentyear,
    FLEET %in% c("LE", "TI", "OA")
  ) %>%
  dplyr::group_by(YEAR) %>%
  dplyr::summarize(MT = sum(MT)) %>%
  dplyr::pull(MT)
researchcatch <- pcatch %>%
  dplyr::filter(
    YEAR == assessmentyear,
    FLEET %in% c("R")
  ) %>%
  dplyr::group_by(YEAR) %>%
  dplyr::summarize(MT=sum(MT)) %>%
  dplyr::pull(MT)

allcatch <- atseacatchMS + atseacatchCP + shorecatch +
  ifelse(length(researchcatch) == 0, 0, researchcatch)

data("quotas")
tacs <- c(quotas[, NCOL(quotas)])
names(tacs) <- quotas[, 1]
ntable <- dplyr::group_by(
  atsea.ages,
  Year, read = !is.na(AGE)
) %>%
  dplyr::count() %>%
  dplyr::filter(read, Year %in% 2008:year) %>%
  dplyr::pull(n)
ptable <- table(
  page[!is.na(page[, "AGE"]), c("SAMPLE_YEAR")],
  useNA = "ifany")

final <- data.frame(
  "Year" = names(ptable),
  "At-Sea" = ntable,
  "Shoreside" = c(ptable), check.names = FALSE) %>%
  dplyr::filter(Year %in% (as.numeric(year) - 10:0))
final[, "Total"] <- rowSums(final[, -1])

r year U.S. catch

\centering Catch = r format_big_number(allcatch) (mt)

TAC = r format_big_number(sum(tacs)) (mt)

Attainment = r format(allcatch/sum(tacs)*100, nsmall = 1, digits = 1) (\%)

Mothership (MS)

\centering Catch = r format_big_number(atseacatchMS) (mt)

TAC = r format_big_number(tacs["MS"]) (mt)

Attainment = r format(atseacatchMS/tacs["MS"]*100, nsmall = 1, digits = 1) (\%)

Catcher/Processor (CP)

\centering Catch = r format_big_number(atseacatchCP) (mt)

TAC = r format_big_number(tacs["CP"]) (mt)

Attainment = r format(atseacatchCP/tacs["CP"]*100, nsmall = 1, digits = 1) (\%)

Shoreside

\centering Catch = r format_big_number(shorecatch) (mt)

TAC = r format_big_number(tacs["Shore"]) (mt)

Attainment = r format(shorecatch/tacs["Shore"]*100, nsmall = 1, digits = 1) (\%)

Mothership (MS) catch

{width=100% height=100% alt="U.S. fishery catch: Mothership"}

Catcher/Processor (CP) catch

{width=100% height=100% alt="U.S. fishery catch: Catcher/Processor"}

Shoreside catch

{width=100% height=100% alt="U.S. fishery catch: Shoreside"}

At-Sea fishing depths

{width=100% height=100% alt="U.S. at-sea fishery catch depths (fathoms)"}

At-Sea catch-rate

{width=100% height=100% alt="U.S. at-sea fishery catch-rate"}

Raw length

{width=100% height=100% alt="U.S. at-sea fishery length distribution"} {width=100% height=100% alt="U.S. shoreside fishery length distribution"}

Raw weight

{width=100% height=100% alt="U.S. at-sea fishery weight distribution"} {width=100% height=100% alt="U.S. shoreside fishery weight distribution"}

Recent age structures

knitr::kable(final, row.names = FALSE, label = NULL,
  format = "markdown",
  caption = "Number of ages for at-sea and shoreside sectors.")

Recent age structures by month

a <- data.frame(
  table(as.numeric(
    format(
      subset(
        atsea.ages,
        YEAR == assessmentyear & !is.na(AGE))$HAUL_OFFLOAD_DATE,
      "%m"
    )
  ))
)
b <- data.frame(
  table(subset(
    page,
    SAMPLE_YEAR == assessmentyear & !is.na(AGE))$SAMPLE_MONTH
  )
)
knitr::kable(
  merge(a, b, by = "Var1", all = TRUE) %>%
    dplyr::arrange(as.numeric(as.character(Var1))),
  format = "markdown",
  col.names = c("Month", "At-Sea", "Shoreside"),
  row.names = FALSE,
  label = NULL,
  caption = glue::glue('Number of {assessmentyear} ages for at-sea and shoreside sectors by month.')
)

Thank you

A big thanks to all of those who worked to get data debriefed and available by December 01, or shortly thereafter, to the JTC.



pacific-hake/hakedataUSA documentation built on June 2, 2025, 4:05 a.m.