-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hi Dan,
I noticed some wonky results in my marlin run when trying to add a new species: ssb is modeled as 0 for the entire time series, and, as a result, so is catch.
I've narrowed it down to an issue in the fauna object, which I'll try to re-create for you in the code below.
I am providing a bunch of life history parameters to marlin that I've grabbed from a recent stock assessment, including ssb0, and asking it to not query fishlife, but when creating the fauna object, marlin overwrites my ssb0 value to one that is nearly 0 (changes from input value of 33406 to 7.10938e-15 😱). Any ideas on why this is happening? I've noticed slightly different ssb0 values for other fauna objects I've created, but nothing quite this drastic.
# Load libraries
library(marlin)
library(tidyverse)
# Set marlin parameters
resolution <- c(19, 52)
patch_area <- 23.04782
years <- 35
seasons <- 1
time_step <- 1
steps <- years * seasons
# Create fauna
# Life history parameters
lh <- list(common_name = "petrale sole",
scientific_name="eopsetta jordani",
linf=45.08813,
vbk=0.2195,
t0=-0.009121462,
max_age=30.5,
weight_a=2.539e-06,
weight_b=3.4185,
length_50_mature=35.45,
length_95_mature=41.42,
age_50_mature=7.435,
m=0.1485,
steepness=1,
ssb0=33406,
r0=15357,
fished_depletion=0.336)
# Uniform habitat layer
habitat_matrix <- expand.grid(x = 1:19,
y = 1:52,
value = 1) %>%
pivot_wider(names_from = x, values_from = value) %>%
arrange(y) %>%
column_to_rownames(var = "y") %>%
as.matrix()
fauna <- list("petrale" = create_critter(common_name = lh$common_name,
scientific_name = lh$scientific_name,
query_fishlife = F,
linf = lh$linf,
vbk = lh$vbk,
t0 = lh$t0,
max_age = lh$max_age,
weight_a = lh$weight_a,
weight_b = lh$weight_b,
length_50_mature = lh$length_50_mature,
length_95_mature = lh$length_95_mature,
age_50_mature = lh$age_50_mature,
m = lh$m,
steepness = lh$steepness,
ssb0 = lh$ssb0,
r0 = lh$r0,
fished_depletion = lh$fished_depletion,
density_dependence = "global_habitat",
adult_diffusion = 25,
resolution = resolution,
patch_area = patch_area,
habitat = list(habitat_matrix),
recruit_habitat = habitat_matrix,
seasons = seasons,
explt_type="f",
max_hab_mult=1))
fleets <- list(
"fleet_one" = create_fleet(
list("petrale" = Metier$new(
critter = fauna$petrale,
price = 10,
sel_form = "logistic",
sel_start = 37,
sel_unit = "length",
sel_delta = 6.55,
p_explt = 1)),
base_effort = prod(resolution),
resolution = resolution))
tuned_fleet <- marlin::tune_fleets(fauna = fauna,
fleets = fleets,
tune_type = "depletion")
sim <- simmar(fauna = fauna,
fleets = tuned_fleet,
years = years)
process <- process_marlin(sim = sim,
time_step = time_step,
keep_age = FALSE)
# Plot SSB over time
ggplot() +
geom_line(data = process$fauna %>%
group_by(critter, year) %>%
summarise(ssb = sum(ssb, na.rm = TRUE)) %>%
ungroup(),
mapping = aes(x = year, y = ssb))
# Plot catch over time
ggplot() +
geom_line(data = process$fauna %>%
group_by(critter, year) %>%
summarise(c = sum(c, na.rm = TRUE)) %>%
ungroup(),
mapping = aes(x = year, y = c))
Metadata
Metadata
Assignees
Labels
No labels

