knitr::opts_chunk$set(echo = FALSE)

options(knitr.table.format = 'latex', knitr.kable.NA = '')

#load chunks from r script
# knitr::read_chunk("AnnualReportChunks.R")

\thispagestyle{empty} Pre-season DB: r pre.season.db.name, Pre-season run name: r pre.season.run.name \newline Post-season DB: r post.season.db.name, Post-season run name: r post.season.run.name \newline

Table 1: Summary of the r run.year return of natural spawning Coho Management Units. Total exploitation rate (ER) represents the sum of US and Canadian exploitation rates on each Management Unit (MU). Status (i.e., "L"ow, "M"oderate, "A"bundant) is based on cohort abundance. Pre-season status is based on agency forecasts of MU cohort abundance and post-season status is based on backwards Coho FRAM run reconstruction of cohort abundances. The ER Cap on the Interior Fraser MU is 20% due to its Low MU status. ER Caps are not available for other Canadian MUs. ER Caps on each of the Inside US MUs (Skagit, Stillaguamish, Snohomish, Hood Canal, and US Strait JDF) are based on MU status, which is determined by cohort abundance. ER Caps on each of the Outside US MUs (Quillayute Fall, Queets, Hoh, Grays Harbor) are based on cohort abundance and the escapement goals for each MU. Outside US MUs are managed for an escapement range; the floor of the escapement range is used for MU status determination. Pre-season modelled ERs are the result of US and Canadian fishery planning processes. Post-season estimated ERs are generated from backwards Coho FRAM. Cohort abundance is the ocean age-3 abundance and represents escapement plus fishery mortality, but not natural mortality.

total.int.fr.esc <- filter(annual.tbl.second, management.unit == "Interior Fraser") %>%
  .$post.escapement %>%
  as.numeric()


total.int.fr.ret <- filter(annual.tbl.second, management.unit == "Interior Fraser") %>%
  .$post.ocean.age %>%
  as.numeric()

# big.bar.morts <- total.int.fr.esc - big.bar.esc

big.bar.mort.txt <- format(round(big.bar.morts, 0), big.mark = ",")

big.bar.t1 <- filter(annual.tbl.second, management.unit == "Interior Fraser") %>%
  mutate(post.escapement = as.character(big.bar.esc)) %>%
  mutate(post.ocean.age = as.numeric(post.ocean.age) - big.bar.morts) %>%
  mutate(post.ocean.age = as.character(post.ocean.age)) %>%
  mutate(post.estd = 1-(big.bar.esc/as.numeric(post.ocean.age))) %>%
  mutate(post.estd = as.character(post.estd)) %>%
  mutate(management.unit = "Interior Fraser w/o Big Bar morts*")

t1 <- annual.tbl.second %>%
  tibble::add_row(big.bar.t1)%>%
  mutate_if(colnames(.) %in% c("pre.cap", "pre.model", "post.cap", "post.estd", "pre.escapement", "post.escapement", "pre.ocean.age", "post.ocean.age"), ~as.double(as.character(.))) %>%
  mutate_if(colnames(.) %in% c("pre.cap", "pre.model", "post.cap", "post.estd"),  ~percent(.,accuracy = 0.1)) %>%
  slice(3, 1:2, 13, 4:12)

# 
# t1 <- annual.tbl.second %>%
#   mutate_if(colnames(.) %in% c("pre.cap", "pre.model", "post.cap", "post.estd", "pre.escapement", "post.escapement", "pre.ocean.age", "post.ocean.age"), ~as.double(as.character(.))) %>%
#   mutate_if(colnames(.) %in% c("pre.cap", "pre.model", "post.cap", "post.estd"),  ~percent(.,accuracy = 0.1)) %>%
#   mutate(post.escapement = format(round(post.escapement, 0), big.mark = ",")) %>%
#   mutate(post.escapement = if_else(management.unit == "Interior Fraser", paste(post.escapement, "*", sep = " "), as.character(post.escapement))) %>%
#   mutate(post.escapement = if_else(management.unit == "Lower Fraser", " ", post.escapement)) %>%
#   mutate(post.escapement = if_else(management.unit == "Georgia Strait", " ", post.escapement))







# # 
# big.bar.footnote <- str_glue("The Big Bar land slide resulted in an estimated {round(total.int.fr.esc - big.bar.esc, 0)} Coho spawner mortalities in 2019. Excluding these mortalities from the escapement estimate, results a surviving escapement of {big.bar.esc} for Interior Fraser Coho. Exploitation rates for Interior Fraser Coho without the Big Bar mortalities included in the escapement were calculated using the catch estimates from the backwards FRAM run that included the Big Bar mortalities divided by the escapement with the Big Bar mortalities removed.")

# big.bar.footnote <- str_glue("The Big Bar land slide resulted in an estimated {big.bar.mort.txt} Coho spawner mortalities in 2019.  Two sets of estimates for the Interior Fraser Management Unit are reported in tables 1-3 using outputs from a single backwards FRAM run. The estimates that are not highlighted were computed using spawning escapement plus the estimated {big.bar.mort.txt} Big Bar passage mortalities. The estimates that are highlighted in yellow are computed using the same fishery mortalilty estimates, but use only the Interior Fraser Coho spawners not impacted by Big Bar as the escapement" )

big.bar.footnote <- str_glue("Interior Fraser Coho ERs calculated using escapement without the {big.bar.mort.txt} Big Bar mortalities are highlighted in yellow")

table1form <- kable(t1,  digits = c(0), format.args = list(big.mark =","), escape = T,
                    col.names = c("Management unit", "Status", "Cap", "Model", "Status",  "Cap", "Estd", "Pre", "Post", "Pre", "Post"), label = "GUYUYUYUYUY",
                    booktabs = T, linesep = "", format = "latex") %>%
  # kable_styling(latex_options = "striped") %>%
  row_spec(c(seq(1, nrow(t1),2)), background = "gray!10") %>%
  row_spec(4, background = "#eff2b6") %>%
  add_header_above(c(" ", "Pre-Season total ER" = 3, "Post-Season total ER" = 3, "Escapement" = 2, "Recruitment\n(Ocean Age-3)" = 2)) %>%
  footnote(symbol = c(big.bar.footnote), threeparttable = T)
# column_spec(2, border_left = TRUE)%>%
# column_spec(5, border_left = TRUE)%>%
# column_spec(8, border_left = TRUE)%>%
# column_spec(10, border_left = TRUE)%>%
# column_spec(11, border_right = TRUE)
# 

print(table1form)

\newpage \thispagestyle{empty}

Table 2: Exploitation rates by country for the r run.year return year. US Exploitation Rates: For US ER on Canadian Management Units (MU), a 10% ER Cap for Interior Fraser Coho is allowable under the PSC Coho agreement based on Low status. ER Caps are not defined for other Canadian MUs because status is not available. Canadian Exploitation Rates: For Canadian ER Caps on US MUs, the pre-season ER Caps are the total allowable ER under the PSC Coho agreement. For Canadian ER Caps on Canadian MUs, a 10% ER Cap for Interior Fraser Coho is allowable under the PSC Coho agreement. Pre-season ERs reflect combined US and Canadian pre-season planning processes and do not include estimates of impacts in Canadian freshwater fisheries. Pre-season unused ERs are the difference between the ER Caps and modelled values. Post-season ER Caps and unused ERs are comparable to pre-season values except that they are based on post-season cohort abundance and associated MU status. Post-season estimated ERs are generated from backwards Coho FRAM. A negative value for unused ERs indicates that the post-season estimate exceeded the allowable ER Cap.

big.bar.returns <- as.numeric(big.bar.t1$post.ocean.age)

ifc.us.er <- filter(annual.tbl.first, management.unit == "Interior Fraser") %>%
  .$us.post.estd

ifc.us.catch <- ifc.us.er*as.numeric(total.int.fr.ret)

ifc.us.bigbar.er <- ifc.us.catch/big.bar.returns


ifc.cdn.er <- filter(annual.tbl.first, management.unit == "Interior Fraser") %>%
  .$cdn.post.estd

ifc.cdn.catch <- ifc.cdn.er*as.numeric(total.int.fr.ret)

ifc.cdn.bigbar.er <- ifc.cdn.catch/big.bar.returns

big.bar.t2 <- filter(annual.tbl.first, management.unit == "Interior Fraser") %>%
  mutate(us.post.estd = ifc.us.bigbar.er) %>%
  mutate(us.post.unused = us.post.cap - us.post.estd) %>%
  mutate(cdn.post.estd = ifc.cdn.bigbar.er) %>%
  mutate(cdn.post.cap = if_else(us.post.unused < 0, cdn.post.cap, .10+us.post.unused)) %>%
  mutate(cdn.post.unused = cdn.post.cap - cdn.post.estd) %>%
  mutate(management.unit  = paste0("Interior Fraser w/o Big Bar morts",  footnote_marker_symbol(3, "latex"))) 
  # mutate(cdn.pre.cap =  paste(cdn.pre.cap, footnote_marker_symbol(2, "latex"))) %>%
  # mutate(cdn.post.cap =  paste(cdn.post.cap, footnote_marker_symbol(2, "latex")))

t2 <- annual.tbl.first %>%
  tibble::add_row(big.bar.t2) %>%
  select(-cap.method) %>%
  mutate_if(is.numeric, ~percent(.,accuracy = 0.1, suffix = "\\%")) %>%
  mutate(us.pre.cap = if_else(management.unit %in% c("Skagit", "Stillaguamish", "Snohomish", "Hood Canal", "US Strait JDF", "Quillayute", "Hoh", "Queets", "Grays Harbor"), paste(us.pre.cap, footnote_marker_symbol(2, "latex",), sep = " "), us.pre.cap )) %>%
  mutate(us.post.cap = if_else(management.unit %in% c("Skagit", "Stillaguamish", "Snohomish", "Hood Canal", "US Strait JDF", "Quillayute", "Hoh", "Queets", "Grays Harbor"), paste(us.post.cap, footnote_marker_symbol(2, "latex"), sep = " "), us.post.cap )) %>%
  mutate(cdn.pre.cap = if_else(str_detect(management.unit, "Interior Fraser"), paste(cdn.pre.cap, footnote_marker_symbol(2, "latex"), sep = " "), cdn.pre.cap)) %>%
  mutate(cdn.post.cap = if_else(str_detect(management.unit, "Interior Fraser"), paste(cdn.post.cap, footnote_marker_symbol(2, "latex"), sep = " "), cdn.post.cap)) %>%
  slice(3, 1:2, 13, 4:12)




# t2$us.pre.cap[5:13] <-  (paste0(t2$us.pre.cap[5:13], footnote_marker_symbol(2)))
# t2$us.post.cap[5:13] <- (paste0(t2$us.post.cap[5:13], footnote_marker_symbol(2)))
# t2$cdn.pre.cap[2] <- (paste0(t2$cdn.pre.cap[2], footnote_marker_symbol(2)))
# t2$cdn.post.cap[2] <- (paste0(t2$cdn.pre.cap[2], footnote_marker_symbol(2)))

cdn_skag_unused <- annual.tbl.first$cdn.pre.unused[annual.tbl.first$management.unit == "Skagit"] %>%
  percent(., accuracy = 0.1)

us_skag_cap <- annual.tbl.first$us.pre.cap[annual.tbl.first$management.unit == "Skagit"] %>%
   percent(., accuracy = 0.1)

footnote2 <- str_glue("Contains the base cap ER plus the unused portion of the intercepting party's ER. For example in the pre-season, Skagit includes US share plus the unused {cdn_skag_unused} Canadian allocation, totalling {us_skag_cap} total US allocation.")

table2form <-  kable(t2, digits = 1,
                     col.names = c("Management unit", "Cap", "Model", "Unused", "Cap", "Estd", "Unused", "Cap", "Model", "Unused", "Cap", "Estd","Unused"), escape = F, linesep = "", booktabs = T, format = "latex") %>%
  # column_spec(2, border_left = TRUE)%>%
  # column_spec(5, border_left = TRUE)%>%
  # column_spec(8, border_left = TRUE)%>%
  # column_spec(11, border_left = TRUE)%>%
  # column_spec(13, border_right  = TRUE)%>%
  row_spec(c(seq(1, nrow(t1),2)), background = "gray!10") %>%
  # column_spec(1, width = "7em") %>%
  row_spec(4, background = "#eff2b6") %>%
  add_header_above(c(" ", "Pre-Season" = 3, "Post-Season" = 3, "Pre-Season" = 3, "Post-Season" = 3))%>%
  add_header_above(c(" ", "Southern U.S.* Exploitation Rate" = 6, "Canadian Exploitation Rate" = 6)) %>%
  footnote(symbol = c("Southern U.S. is limited to US fisheries south of the Canadian border.", footnote2, big.bar.footnote), threeparttable = T)

print(table2form)

\newpage \thispagestyle{empty}

Table 3: Post-season summary exploitation rates, escapements, and cohort abundances for naturally spawning Coho MUs in r run.year.

t3_per <- annual.tbl.third %>%
  filter(psc.fishery.name %notin% c("escapement", "cohort")) %>%
  mutate(`Interior Fraser without Big Bar` = (`Interior Fraser`*total.int.fr.ret)/big.bar.returns) %>%
  mutate_if(is.numeric, ~percent(.,accuracy = 0.1, suffix = "\\%"))

t3_cnt <- annual.tbl.third %>%
  filter(psc.fishery.name %in% c("escapement", "cohort")) %>%
  mutate(`Interior Fraser without Big Bar` = c(big.bar.esc, big.bar.returns)) %>%
  mutate_if(is.numeric, ~comma(.))

t3_cnt_GS <- select(t3_cnt, c("psc.fishery.name", starts_with("Georgia")))

t3_cnt_GS[1,2:ncol(t3_cnt_GS)] <- paste0(t3_cnt_GS[1,2:ncol(t3_cnt_GS)], footnote_marker_symbol(3))
t3_cnt_GS[2,2:ncol(t3_cnt_GS)] <- paste0(t3_cnt_GS[2,2:ncol(t3_cnt_GS)], footnote_marker_symbol(2))

t3_cnt_oth <- select(t3_cnt, -starts_with("Georgia")) %>%
  mutate(`Lower Fraser` = if_else(psc.fishery.name == "escapement",
                                  paste0(`Lower Fraser`, footnote_marker_symbol(1)," "),
                                  paste0(`Lower Fraser`, footnote_marker_symbol(2))))

t3_cnt <- left_join(t3_cnt_GS, t3_cnt_oth, "psc.fishery.name")


t3 <- bind_rows(t3_per, t3_cnt) %>%
  mutate(psc.fishery.name = str_replace(psc.fishery.name, "&", "\\\\&")) %>%
  rename(`Fishery Name` = "psc.fishery.name")  %>%
  select(1, 4, 2, 3, 14, everything())


table3form <-  kable(t3, escape = F, booktabs= T, linesep = "", row.names = FALSE,
                     col.names = linebreak(c("Fishery name", "Georgia\nStrait", "Lower\nFraser","Interior\nFraser", paste0("Interior Fraser\nw/o Big Bar morts",  footnote_marker_symbol(4, "latex")), "Skagit", "Stillaguamish", "Snohomish", "Hood\nCanal", "US Strait\nJDF", "Quillayute", "Hoh", "Queets", "Grays\nHarbor"))) %>%
  # table3form <-  kable(t3, escape = F, booktabs= T, linesep = "") %>%
  kable_styling(latex_options = c("scale_down", "hold_position")) %>%
  column_spec(1, bold = T) %>%
  row_spec(c(0, nrow(t3), nrow(t3)-1), bold = TRUE) %>%
  row_spec(c(13, 23, 25), background = "#e3e7fc") %>%
  row_spec(c(seq(2, nrow(t3),2)), background = "#d6d6d6") %>%
  column_spec(5,background = "#eef58c") %>%
  footnote(symbol = c("Modelled values of terminal run size occuring after lower Fraser in river fisheries.", " Modelled values of terminal run size that are not directly estimated.", "Modelled values that are not directly estimated.", big.bar.footnote))


print(table3form)


PSC-CoTC/AnnualReport documentation built on March 26, 2022, 9:33 a.m.