generated from NEFSC/NEFSC-Template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
calculates death (000s mt) from M
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#' @title Calculate the amount of fish dying given M | ||
#' | ||
#' @description Calculates the amount (metric tons) of fish dying given the assumed or estimated M; uses Jan-1 biomass, so an approximation | ||
#' | ||
#' @param mod An rds from a WHAM fit | ||
#' | ||
#' @return A dataframe with two columns. Year and Deaths | ||
#' | ||
#' @example | ||
#' mod.dir="m168" | ||
#' write.dir <- paste("C:/Herring/2022 Assessment/Assessments/WHAM",mod.dir,sep="/") | ||
#' setwd(write.dir) | ||
#' mod <- readRDS(paste0(mod.dir,".rds")) | ||
#' m168deaths=Mdeaths(mod=mod) | ||
#' plot(m168deaths$Year,m168deaths$Deaths,type='o',ylab="Dead Fish (000's mt)",xlab="") | ||
|
||
Mdeaths=function(mod=NULL){ | ||
MAA=mod$rep$MAA | ||
ZAA=mod$rep$ZAA | ||
NAA=mod$rep$NAA | ||
WAA.pt=mod$input$data$waa_pointer_jan1 | ||
WAA=mod$input$data$waa[WAA.pt,,] | ||
|
||
|
||
cons.aa<-((MAA/ZAA)*(1-exp(-ZAA))*NAA*WAA)/1000 | ||
cons.annual=data.frame(Year=mod$input$years,Deaths=rowSums(cons.aa)) | ||
return(cons.annual) | ||
} | ||
|
||
|