calc_pred_diet: Calculate eaten biomass in tonnes for each functional group.

View source: R/calc_pred_diet.R

calc_pred_dietR Documentation

Calculate eaten biomass in tonnes for each functional group.

Description

Function to calculate the eaten biomass in tonnes for each functional group per time, polygon, ageclass, and prey item.

Usage

calc_pred_diet(dietcomp, eat, grazing, vol, biolprm, runprm)

Arguments

dietcomp

A data.frame containing the diet proportions for each functional group, prey functional group, time, and ageclass. The data.frame must originate from load_diet_comp using the diet_check.txt as input.

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, vol, prey, dietcomp, bio_eaten

Author(s)

Alexander Keth

See Also

Other calc functions: calc_Z(), calc_age2length(), calc_avgwtstage2age(), calc_biomass_age(), calc_biomass_pool(), calc_pred_cons(), 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")
dietcomp <- load_diet_comp(dir = d, file_diet = "outputsDietCheck.txt",
  fgs = fgs)
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_diet(dietcomp = dietcomp, eat = eat, grazing = grazing,
  vol = vol, biolprm = biolprm, runprm = runprm)
rm(calcs)


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