Skip to content

Commit

Permalink
fix calc for LG_PHY, no sediment layer
Browse files Browse the repository at this point in the history
  • Loading branch information
sgaichas committed Oct 4, 2023
1 parent e42fc7f commit 73cbc30
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/calc_biomass_pool.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ calc_biomass_pool <- function(pooln, vol, area, fgs, biolprm){
"sed_bact",
"sed_ep_ff",
"sed_ep_other",
"mobile_ep_other",
"mob_ep_other",
"coral",
"sponge")) ~ "benthos",
TRUE ~ "nonbenth"))
(grouptype %in% c("lg_phy")) ~ "lg_phy",
TRUE ~ "alllayers"))

data_names <- c("species", "agecl", "polygon", "layer", "time", "atoutput")

Expand All @@ -91,7 +92,9 @@ calc_biomass_pool <- function(pooln, vol, area, fgs, biolprm){
#pooln$atoutput <- with(pooln, vol * atoutput * bio_conv)

pooln <- pooln |>
dplyr::mutate(atoutput = dplyr::case_when(pooltype == "nonbenth" ~ vol * atoutput * bio_conv,
dplyr::mutate(atoutput = dplyr::case_when(pooltype == "alllayers" ~ vol * atoutput * bio_conv,
pooltype == "lg_phy" ~
ifelse(layer!=sedlayer, vol * atoutput * bio_conv, 0),
pooltype == "benthos" ~
ifelse(layer==sedlayer, area * atoutput * bio_conv, 0)))

Expand Down

0 comments on commit 73cbc30

Please sign in to comment.