calc_Z: Calculate total mortality for age structured groups

View source: R/calc_Z.R

calc_ZR Documentation

Calculate total mortality for age structured groups

Description

Calculate total mortality for all age-structured groups in an Atlantis model. The mortality values are then used in other functions to translate stages to ages: calc_stage2age.

Usage

calc_Z(yoy, nums, fgs, biolprm, toutinc)

Arguments

yoy

Output from load_yoy, which is a data.frame providing information on recruitment for those species that are turned on in an Atlantis run.

nums

Object containing the number at stage.

fgs

A data frame created by load_fgs that reads in the csv file containing functional group names, usually "functionalGroups.csv".

biolprm

A list of biological parameters available from the [...]_Biol.prm file, as read in by load_biolprm.

toutinc

output time increment from run.prm file

Details

Steps included when translating from stages (i.e., multiple age classes in a single group) to individual age classes are:

  • obtain numbers at age from each time-step

  • obtain numbers of recruits for each time-step, where the information provided in the [...]YOY.txt or yoy object is provided in biomass and must be converted to numbers.

  • calculate total mortality for each time step, where

    survival_{t} = (\sum(nastage_{t}) - recruits_{t}) / \sum{nastage_{t-1}}

    Z_{t} = -1 * ln(survival_{t})

This function uses the YOY.txt and Nums to calculate Z.

Value

A data.frame of time-varying Z values.

Author(s)

Sean Lucey

See Also

Other calc functions: calc_age2length(), calc_avgwtstage2age(), calc_biomass_age(), calc_biomass_pool(), calc_pred_cons(), calc_pred_diet(), calc_stage2age(), calc_timestep2time()

Examples

## Not run: 
dir <- system.file("extdata", "SETAS_Example", package = "atlantisom")
file_nc <- "outputs.nc"
fgs <- load_fgs(dir = dir, "Functional_groups.csv")
file_init <- "Initial_condition.nc"
bps <- load_bps(dir = dir, "Functional_groups.csv", file_init = "Initial_condition.nc")
select_groups <- fgs$Name[fgs$IsTurnedOn > 0]
select_variable <- "Nums"
box.info <- load_box(dir = dir, file_bgm="Geography.bgm")
bboxes <- get_boundary(box.info)
#when calc_stage2age is run in the run_truth, it will need to have the nums
#data frame and the bioprm already read in:
nums_data <- load_nc(dir = dir,
                     file_nc="outputs.nc",
                     bps=bps, fgs=fgs, select_groups=select_groups,
                     select_variable = "Nums",
                     check_acronyms = TRUE, bboxes = bboxes)
biolprm <- load_biolprm(dir, file_biolprm="Biology.prm")
run <- load_runprm(dir, "Run_settings.xml")
yoy <- load_yoy(dir = dir, file_yoy = "outputsYOY.txt")
calc_Z(yoy = yoy, nums = nums_data, fgs = fgs, biolprm = biolprm,
  toutinc = run$toutinc)

## End(Not run)

r4atlantis/atlantisom documentation built on Nov. 12, 2023, 2:59 a.m.