flr/FLCore

Consistency between FLStock@m.spwn and FLBiol@spwn

marchtaylor opened this issue · 7 comments

I'm wondering if there is a reason why FLStock@m.spwn includes a year dimension and FLBiol@spwn does not? e.g.:

data(ple4)
data(ple4.biol)

dim(ple4@m.spwn)
# [1] 10 61  1  1  1  1
dim(ple4.biol@spwn)
# [1]  1 61  1  1  1  1

# following conversion
ple4.biol.new <- as(ple4, Class = "FLBiol")
dim(ple4.biol.new@spwn)
ple4.biol.new@spwn
dim(ple4.biol.new@spwn)
# [1]  1 61  1  1  1  1

I personally can't imagine needing the age dimension here, but wondered since it's included in FLStocks.

It looks like the FLBiol class can handle an age dimension. ssb() calculates correctly if this slot is expanded:

# make spwn slot with age dimension
ple4.biol.new <- ple4.biol
ple4.biol.new@spwn <- ple4.biol.new@n * 0
units(ple4.biol.new@spwn) <- ""

# ssb
ssb(ple4.biol)
ssb(ple4.biol.new) # same

# ssb after changes to spwn value
ple4.biol@spwn[] <- 0.5
ple4.biol.new@spwn[] <- 0.5
ssb(ple4.biol)
ssb(ple4.biol.new) # same

For some reason, I am getting a different SSB with one of my FLStocks after conversion to FLBiol. I could have a special case and am thus still tracking down why this happens. I thought it was due to inconsistencies in the @spwn dimensions, but this doesn't seem to be an issue with the above example.

OK, sorry about all this. The reason why I have inconsistencies in SSB after moving from FLStock to FLBiol has nothing to do with the dimensions of the @spwn slot. It is rather due to the fact that the information held by FLStock@harvest.spwn is lost (which is also 0.5 in my case), and thus these additional losses are no longer available to the FLBiol ssb calculation. I guess there is no way around this discrepancy.

For FLBiol we decided to go for a single age, as it is now easy to operate on it using the %*% and %/% operators. FLStock was left as it is for legacy reasons.
The information on harvest.spwn is now coded as startf and endf in FLFishery.
FLBiol has no info on F, so ssb is only corrected for M if spwn > 0. You can call ssb(FLBiol) and supply catch.n or harvest infomation.

library(FLFishery)
data(ple4)

bio <- as(ple4, 'FLBiol')
fis <- as(ple4, 'FLFishery')

# catch.n
ssb(bio, catch.n=catch.n(fis)$PLE)
ssb(ple4)

# harvest
ssb(bio, harvest=harvest(bio, fis))
ssb(ple4)

But let me know if your use now does not work with this and we can see how to make it easier for you to use FLBiol.

Thanks Iago. It is more an issue for me in translating things into FLBEIA (i.e. with FLFleetExt), and having the correct SSB being fed into an HCR. As is, if only M is considered, SSB will be positively biased. I will talk about this issue with Dorleta and let you now what results.

OK - so it looks like FLBEIA uses the @spwn information to define both @harvest.spwn and @m.spwn internally when building an FLStock object used by the management loop. So, this seems to only be a reporting issue of some of the summary functions and should not affect the use of HCRs.

OK. In FLFisheries, spwn plkus fushery harvest timing (hperiod) is used to populate m.pswn and harvest.spwn, based on catch proportions around spawning time

https://github.com/flr/FLFishery/blob/master/R/coerce.R#L120