| Title: | Tools for Conditioning Fisheries Operating Models Using Stock Synthesis 3 |
|---|---|
| Description: | Tools for loading Stock Synthesis (SS3) models into FLR. Used in conditioning of Operating Models based on SS3 by considering structural uncertainty in input parameters and assumptions. A grid of SS3 runs can be created and results loaded on objects of various FLR classes. |
| Authors: | Iago Mosqueira [aut, cre] |
| Maintainer: | Iago Mosqueira <[email protected]> |
| License: | EUPL |
| Version: | 0.5.7 |
| Built: | 2026-05-24 16:33:41 UTC |
| Source: | https://github.com/flr/ss3om |
Creates an FLQuants from length-distributions by fleet
buildLCss330(dat)buildLCss330(dat)
# LOAD data file #albd <- SS_readdat(system.file("ext-data", "albio", "abt.dat", package="ss3om")) #lcs <- buildLCss330(albd) #ggplotFL::plotLengths(lcs[[1]][, c(1, 5, 10, 15, 20)]) #ggplotFL::plotLengths(seasonSums(lcs[[5]][, c(1, 5, 10, 15, 20)])) #lapply(lcs, function(x) unitSums(quantSums(seasonSums(x))))# LOAD data file #albd <- SS_readdat(system.file("ext-data", "albio", "abt.dat", package="ss3om")) #lcs <- buildLCss330(albd) #ggplotFL::plotLengths(lcs[[1]][, c(1, 5, 10, 15, 20)]) #ggplotFL::plotLengths(seasonSums(lcs[[5]][, c(1, 5, 10, 15, 20)])) #lapply(lcs, function(x) unitSums(quantSums(seasonSums(x))))
A number of derived quantities are available in the Report.sso file, and are useful for checking that the generated FLR objects lead to the same values. These functions are called on the list returned by readOutputss3 or r4ss::SS_output, and extract the yearly values from the following rows in the derived_quants data.frame:
extractSSB(out, endyr = sum(c(out$endyr, out$nforecastyears), na.rm = TRUE)) extractRec(out, endyr = sum(c(out$endyr, out$nforecastyears), na.rm = TRUE)) extractFbar(out, endyr = sum(c(out$endyr, out$nforecastyears), na.rm = TRUE)) extractZatage(out) extractDevs(out)extractSSB(out, endyr = sum(c(out$endyr, out$nforecastyears), na.rm = TRUE)) extractRec(out, endyr = sum(c(out$endyr, out$nforecastyears), na.rm = TRUE)) extractFbar(out, endyr = sum(c(out$endyr, out$nforecastyears), na.rm = TRUE)) extractZatage(out) extractDevs(out)
out |
A list as returned by r4ss::SS_output. |
extractSSB: SSB_y for y between startyr and endyr.
extractRec: Recr_y for y between startyr and endyr.
extractFbar: F_y for y between startyr and endyr.
extractZatage: Z_ay for y between startyr and endyr and ages but last.
For 2 sex models (nsexes), extractRec will return a two-unit FLQuant,
with the Recr_y values split according to the recruitment sex ratio. This
is extracted from recruitment_dist[[1]][, "Frac/sex"].
The value returned by extractFbar is the actual mean F over the age range,
and the value in derived_quants is corrected according to F_std_basis
for models where F reporting basis is F/FMSY.
An FLQuant object of the requested quantity.
out <- readOutputss3(system.file("ext-data", "herring", package="ss3om")) extractSSB(out) extractFbar(out)out <- readOutputss3(system.file("ext-data", "herring", package="ss3om")) extractSSB(out) extractFbar(out)
Creates folder names from a 'grid' df of scenarios
nameGrid(df, dir, from = 1)nameGrid(df, dir, from = 1)
df |
Model grid data.frame |
dir |
Folder name |
from |
Starting number |
FLIndex objectA function to read the CPUE series from an SS3 run into an FLIndex object
readFLIBss3( dir, fleets, birthseas = out$birthseas, repfile = "Report.sso", compfile = "CompReport.sso", ... )readFLIBss3( dir, fleets, birthseas = out$birthseas, repfile = "Report.sso", compfile = "CompReport.sso", ... )
dir |
Directory containing the SS3 output files |
birthseas |
The birthseasons for this stock as a numeric vector. |
repfile |
SS3 Report.sso file |
compfile |
SS3 CompReport.sso file |
... |
Any other argument to be passed to |
An object of class FLStock
Iago Mosqueira, EC JRC
Methot RD Jr, Wetzel CR (2013) Stock Synthesis: A biological and statistical framework for fish stock assessment and fishery management. Fisheries Research 142: 86-99.
FLSR objectA function to read the stock-recruit relationships from an SS3 run into an FLSR object
readFLSRss3( dir, birthseas = out$birthseas, repfile = "Report.sso", compfile = "CompReport.sso", ... )readFLSRss3( dir, birthseas = out$birthseas, repfile = "Report.sso", compfile = "CompReport.sso", ... )
dir |
Directory containing the SS3 output files |
birthseas |
The birthseasons for this stock as a numeric vector. |
... |
Any other argument to be passed to |
An object of class FLStock
Iago Mosqueira, EC JRC
Methot RD Jr, Wetzel CR (2013) Stock Synthesis: A biological and statistical framework for fish stock assessment and fishery management. Fisheries Research 142: 86-99.
Results of a run of the Stock Synthesis sofware, SS3 (Methot & Wetzel, 2013),
can be loaded into an object of class FLStock. The code makes
use of the r4ss::SS_output function to obtain a list from Report.sso. The
following elements of that list are used to generate the necessary information
for the slots in FLStock: "catage", "natage", "ageselex",
"endgrowth", "catch_units", "nsexes", "nseasons", "nareas", "IsFishFleet",
"fleet_ID", "FleetNames", "spawnseas", "inputs" and "SS_version".
readFLSss3( dir, repfile = "Report.sso", compfile = "CompReport.sso", wtatage = out$wtatage_switch, ... )readFLSss3( dir, repfile = "Report.sso", compfile = "CompReport.sso", wtatage = out$wtatage_switch, ... )
dir |
Directory holding the SS3 output files |
repfile |
SS3 Report.sso file |
compfile |
SS3 CompReport.sso file |
wtatage |
Is a wtatage.ss being usee? Logical |
... |
Any other argument to be passed to |
An object of class \link{FLStock}
The FLR Team
Methot RD Jr, Wetzel CR (2013) Stock Synthesis: A biological and statistical framework for fish stock assessment and fishery management. Fisheries Research 142: 86-99.
A series of auxiliary functions that convert one or more elements, typically
of class data.frame. in the list returned by r4ss::SS_output into particular
FLQuant or FLQuants objects.
ss3index(cpue, fleets) ss3index.res(cpue, fleets) ss3index.var(cpue, fleets) ss3index.q(cpue, fleets) ss3sel.pattern(selex, years, fleets, morphs, factor = "Asel2") ss3wt(endgrowth, dmns, birthseas) ss3mat(endgrowth, dmns, birthseas, option = 3) ss3m(endgrowth, dmns, birthseas) ss3n(n, dmns, birthseas) ss3catch(catage, wtatage, dmns, birthseas, idx) ss3mat30(endgrowth, dmns, spawnseas, option = 3) ss3m30(endgrowth, dmns, birthseas) ss3n30(n, dmns, era = "TIME") ss3catch30(catage, wtatage, dmns, birthseas, idx, col = "RetWt", era = "TIME")ss3index(cpue, fleets) ss3index.res(cpue, fleets) ss3index.var(cpue, fleets) ss3index.q(cpue, fleets) ss3sel.pattern(selex, years, fleets, morphs, factor = "Asel2") ss3wt(endgrowth, dmns, birthseas) ss3mat(endgrowth, dmns, birthseas, option = 3) ss3m(endgrowth, dmns, birthseas) ss3n(n, dmns, birthseas) ss3catch(catage, wtatage, dmns, birthseas, idx) ss3mat30(endgrowth, dmns, spawnseas, option = 3) ss3m30(endgrowth, dmns, birthseas) ss3n30(n, dmns, era = "TIME") ss3catch30(catage, wtatage, dmns, birthseas, idx, col = "RetWt", era = "TIME")
cpue |
A data frame obtained from SS_output$cpue. |
fleets |
Named vector of fleets (numeric) codes |
selex |
A data frame obtained from SS_output$ageselex. |
years |
Vector of years for which the index applies |
morphs |
Vector of morphs to use |
endgrowth |
A data frame obtained from SS_output$endgrowth. |
dmns |
dimnames of the output object, usually obatined using |
birthseas |
The birthseasons for this stock as a numeric vector. |
n |
A data frame obtained from SS_output$natage. |
catage |
A data frame obtained from SS_output$catage. |
wtatage |
A data frame obtained from SS_output$endgrowth but subset for |
idx |
The fishing fleets, as in |
ss3index returns the index slot of each survey/CPUE fleet.
ss3index.res returns the index.res slot of each survey/CPUE fleet.
ss3index.var returns the index.var slot of each survey/CPUE fleet.
ss3index.q returns the index.q slot of each survey/CPUE fleet.
ss3sel.pattern returns the sel.pattern slot of each survey/CPUE fleet.
ss3wt returns the stock.wt slot.
ss3mat returns the mat slot.
ss3m returns the m slot.
ss3m returns the m slot.
ss3catch currently returns the landings.n slot, equal to catch.n as discards are not being parsed.
ss3mat30 returns the mat slot.
ss3m returns the m slot.
ss3n30 returns the stock.n slot.
ss3catch currently returns the landings.n slot, equal to catch.n as discards are not being parsed.
An FLQuant or FLQuants object, depending on the converted data structure
Iago Mosqueira, EC JRC D02