Skip to content

Commit 6eb5c50

Browse files
committed
Biomass metrics (ssb, ...) do not use harvest if harvest.spwn = 0
1 parent e63dff5 commit 6eb5c50

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

R/FLStock.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,14 @@ is.FLStock <- function(x)
124124

125125
# F
126126
if(uns == 'f') {
127-
res <- n * exp(-(h * ph + m * pm)) * wt * sel
127+
# SET f to 0 if ph = 0
128+
f <- ifelse(ph == 0, 0, h * ph)
129+
res <- n * exp(-(f + m * pm)) * wt * sel
128130
# HR
129131
} else if(uns == 'hr') {
130-
res <- n * (1 - h * ph) * exp(-m * pm) * wt * sel
132+
# SET h mult to 1 if ph = 0
133+
hm <- ifelse(ph == 0, 1, 1 - h * ph)
134+
res <- n * hm * exp(-m * pm) * wt * sel
131135
# else NA
132136
} else {
133137
res <- quantSums(n) %=% as.numeric(NA)

0 commit comments

Comments
 (0)