calc_pred_cons: Calculate eaten total biomass in tonnes for each functional...

View source: R/calc_pred_cons.R

calc_pred_consR Documentation

Calculate eaten total biomass in tonnes for each functional group.

Description

Function to calculate the eaten total biomass in tonnes: "consumption" for each functional group per time, polygon, and ageclass.

Usage

calc_pred_cons(eat, grazing, vol, biolprm, runprm)

Arguments

eat

A data.frame containing the consumed biomass in mg N for each functional group, time, ageclass, and polygon. The data.frame must originate from load_nc using select_variable = "Eat".

grazing

A data.frame containing the consumed biomass in mg N for each functional group, time, ageclass, and polygon. The data.frame must originate from load_nc using select_variable = "Grazing".

vol

A data.frame containing the volume for each time, polygon, and layer. The data.frame must originate from load_nc_physics using physic_variables = "volume".

biolprm

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

Value

A codedata.frame in tidy format with the following columns: species, agecl, time, polygon, atoutput (bio_eaten)

Author(s)

Alexander Keth, Sarah Gaichas

See Also

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

Examples

d <- system.file("extdata", "SETAS_Example", package = "atlantisom")
fgs <- load_fgs(d, "Functional_groups.csv")
bps <- load_bps(dir = d, fgs = "Functional_groups.csv",
  file_init = "Initial_condition.nc")
runprm <- load_runprm(d, "Run_settings.xml")
boxes <- get_boundary(load_box(dir = d, file_bgm = "Geography.bgm"))
groups <- load_fgs(dir = d, "Functional_groups.csv")
groups <- groups[groups$IsTurnedOn > 0, "Name"]
eat <- load_nc(dir = d, file_nc = "outputsPROD.nc",
  bps = bps, fgs = fgs, select_groups = groups,
  select_variable = "Eat", check_acronyms = TRUE,
  bboxes = boxes)
grazing <- load_nc(dir = d, file_nc = "outputsPROD.nc",
  bps = bps, fgs = fgs, select_groups = groups,
  select_variable = "Grazing", check_acronyms = TRUE,
  bboxes = boxes)
vol <- load_nc_physics(dir = d, file_nc = "outputs.nc",
  physic_variables = "volume", aggregate_layers = FALSE,
  bboxes = boxes)
biolprm <- load_biolprm(dir = d,
  file_biolprm = "Biology.prm")
runprm <- load_runprm(dir = d, file_runprm = "Run_settings.xml")
calcs <- calc_pred_cons(eat = eat, grazing = grazing,
  vol = vol, biolprm = biolprm, runprm = runprm)
rm(calcs)


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