View source: R/calc_stage2age.R
calc_stage2age | R Documentation |
Will be called in the run_truth file, and requires inputs from
load_nc
for the "Nums" variable, and the
load_biolprm
.
calc_stage2age(nums_data, biolprm, yoy, fgs, runprm)
dir |
The directory of the atlantis model output, where the
default is |
A data.frame
in long format with the following coumn names:
Species, timestep, polygon, agecl, and atoutput (i.e., variable). This is
the same as the input Nums data frame however, agecl will be TRUE numbers
by age class – just named the same as the input to ensure make it work
with the other functions
Emma E Hodgson and Kelli Faye Johnson
Other calc functions:
calc_Z()
,
calc_age2length()
,
calc_avgwtstage2age()
,
calc_biomass_age()
,
calc_biomass_pool()
,
calc_pred_cons()
,
calc_pred_diet()
,
calc_timestep2time()
## 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)
select_groups="Demersal_S_Fish"
select_variable="Nums"
box.info=load_box(dir = dir, file_bgm="Geography.bgm")
bboxes=get_boundary(box.info)
#when calc_stage2age is run, it will need to have the nums
#data frame, the YOY, the runprm 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")
YOY <- load_yoy(dir, file_yoy="outputsYOY.txt")
runprm <- load_runprm(dir, file_runprm="Run_settings.xml")
# aggregate across layers and polygons but not ages
nums_agg <- aggregate(nums_data$atoutput,
by=list(species = nums_data$species,
time = nums_data$time,
agecl = nums_data$agecl),
sum)
nums_agg <- data.frame(species = nums_agg$species,
time = nums_agg$time, agecl = nums_agg$agecl,
polygon = NA, layer = NA,
atoutput = nums_agg$x)
test <- calc_stage2age(nums_agg, biolprm, YOY, fgs, runprm)
rm(test)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.