PacificCommunity / ofp-sam-flr4mfcl

R Functions for Taming MULTIFAN-CL
7 stars 2 forks source link

Default first year 1972 #16

Open arni-magnusson opened 1 year ago

arni-magnusson commented 1 year ago

I have just realized (the hard way) that many basic import functions in FLR4MFCL have a default first year 1972, which is a legacy from the years when FLR4MFCL was mainly used for skipjack.

This is obviously a problem because FLR4MFCL is now used for MFCL stock assessments that do not have 1972 as the first year. Users are therefore likely to get corrupted and misleading data objects by calling

par <- read.MFCLPar("14.par")

A simple fix would be to remove the default, thus requiring the user to always specify first.yr. The above read.MFCLPar example would then raise an error, instead of creating erroneous nonsensical data.

This simple fix, on the other hand, could break existing (skipjack) scripts, so we should probably have a pow-wow to look into this... Basically improve old skipjack scripts that would otherwise be affected by the fix.

Another route to consider (as well) is to see if MFCL can be improved so that all relevant output files include the first year, so FLR4MFCL users would never have to specify first.yr.

Functions that have default value 1972

read.MFCLBiol <- function(parfile, parobj=NULL, first.yr=1972) read.MFCLRec <- function(parfile, parobj=NULL, first.yr=1972) read.MFCLRegion <- function(parfile, parobj=NULL, first.yr=1972) read.MFCLPar <- function(parfile, first.yr=1972) read.MFCLCatchN <- function(file="ests.rep", first.yr=1972) read.temporary_tag_report <- function(temp_tag_report="temporary_tag_report", year1=1972) read.MFCLProjectedNatAge <- function(filename="projected_numbers_at_age", quarterly=T, fyear=1972) read.MFCLProjectedSpawningBiomass <- function(filename="projected_spawning_biomass", quarterly=T, fyear=1972)

Functions that have default value 1972, but first.yr is not used inside the function...

read.MFCLFlags <- function(parfile, parobj=NULL, first.yr=1972) read.MFCLTagRep <- function(parfile, parobj=NULL, first.yr=1972) read.MFCLSel <- function(parfile, parobj=NULL, first.yr=1972) read.MFCLParBits <- function(parfile, parobj=NULL, first.yr=1972)