sample_survey_biomass: Sample a biomass index of abundance from an atlantis scenario

View source: R/sample_survey_biomass.R

sample_survey_biomassR Documentation

Sample a biomass index of abundance from an atlantis scenario

Description

The function takes numbers-at-age data from an Atlantis scenario where the data was read in from Atlantis output using load_nc within run_truth. One does not need to use these functions to create dat, rather you must only ensure that the structure of dat is the same.

Usage

sample_survey_biomass(dat, cv, wtAtAge)

Arguments

dat

A data.frame of numbers at age containing the following columns:

  • species

  • agecl

  • polygon

  • layer

  • time

  • atoutput

The data.frame is generated from either create_survey or create_fishery_subset.

cv

Coefficient of variation for the entire species specific biomass a matrix with columns: species, cv

wtAtAge

Weight-at-age by species. a matrix with columns: species, agecl, time (optional), wtAtAge (kg)

Details

This function simply calculates biomass-at-age in t by applying a weight-at-age vector (units of kg), sums over polygons, and then applies user defined error to the biomass. The result is a coastwide biomass estimate in tons from the survey Improvements could be to provide polygon specific biomass, but the cv will need to be thought about.

Value

The standard dataframe as specified used in dat. The function sums over layers and makes $layers is NA.

Author(s)

Poseidon

Examples

d <- system.file("extdata", "SETAS_Example", package = "atlantisom")
species <- c("Pisciv_T_Fish","Pisciv_S_Fish")
truth <- run_truth(scenario = "outputs",
  dir = d,
  file_fgs = "Functional_groups.csv",
  file_bgm = "Geography.bgm",
  select_groups = species,
  file_init = "Initial_condition.nc",
  file_biolprm = "Biology.prm",
  file_runprm = "Run_settings.xml")

 boxes <- 1:3
effic <- data.frame(species=c("Pisciv_T_Fish","Pisciv_S_Fish"), efficiency=c(0.3,0.1))
selex <- data.frame(species=c(rep("Pisciv_T_Fish",10),rep("Pisciv_S_Fish",10)),
               agecl=c(1:10,1:10),
                selex=c(0,0,0.1,0.5,0.8,1,1,1,1,1,0,0,0.1,0.3,0.5,0.7,0.9,1,1,1))

tmp <- create_survey(dat=truth$nums, time=seq(10,55,3), species=species, boxes=boxes, effic=effic, selex=selex)

wtAtAge <- data.frame(species=c(rep("Pisciv_T_Fish",10),rep("Pisciv_S_Fish",10)),
                agecl=c(1:10,1:10),
                wtAtAge=c(0.1,0.5,0.9,1.5,1.8,2.0,2.1,2.2,2.3,2.35,0.05,0.2,0.3,0.35,0.45,0.5,0.55,0.6,0.63,0.65))
cv <- data.frame(species=species, cv=c(0.2,0.3))

survObsBiom <- sample_survey_biomass(dat=tmp,cv=cv,wtAtAge)

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