pfmc-assessments / indexwc

Estimate indices of abundance for west coast fish species
2 stars 2 forks source link

Add boundaries argument to run_sdmtmb() and add new area to boundaries_data #32

Open iantaylor-NOAA opened 8 months ago

iantaylor-NOAA commented 8 months ago

What was changed/addressed

I don't know what the current workflow is, but for exploring the fraction of Petrale Sole north of 46 degrees 53.3 minutes, I found it helpful to be able to add a boundary argument to run_sdmtmb(). Perhaps this is unnecessary if you typically run the model once and then separately call calc_index_areas() after the initial estimation. If so, go ahead and delete this PR.

I also added new "North of 46deg 53.3min" and "South of 46deg 53.3min" areas to boundaries_data. If you'd rather not have that file include stuff like this, but think the other commit is useful, please cherry pick as you wish.

These changes allowed me to get everything I wanted in a single call to run_sdmtmb():

run_sdmtmb(
    data = data$data_filtered[[1]],
    formula = "catch_weight ~ 0 + fyear + pass_scaled",
    family = sdmTMB::delta_lognormal(),
    anisotropy = TRUE,
    n_knots = 500,
    boundaries = boundaries_data[c("Coastwide", "North of 46deg 53.3min", "South of 46deg 53.3min")],
    spatiotemporal = list("iid", "iid")
)

Related to issue(s)

No issue. Need for petrale calculation discussed by email.