Skip to content

Commit

Permalink
Merge branch 'master' of github.com:flr/FLife
Browse files Browse the repository at this point in the history
  • Loading branch information
iagomosqueira committed Aug 10, 2018
2 parents ee8d92d + 2671eb6 commit 9f32d69
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
28 changes: 23 additions & 5 deletions R/omOut.R
@@ -1,16 +1,22 @@
omStock<-function(object){
ageSwt<-function(object) apply(stock.n(object)%*%ages(stock.n(object)),2:6,sum)%/%
sage<-function(object) apply(stock.n(object)%*%ages(stock.n(object)),2:6,sum)%/%
apply(stock.n(object),2:6,sum)
ageCwt<-function(object) apply(catch.n(object)%*%ages(catch.n(object)),2:6,sum)%/%
cage<-function(object) apply(catch.n(object)%*%ages(catch.n(object)),2:6,sum)%/%
apply(catch.n(object),2:6,sum)
swt<-function(object) apply(stock.n(object)%*%stock.wt(object),2:6,sum)%/%
apply(stock.n(object),2:6,sum)
cwt<-function(object) apply(catch.n(object)%*%catch.wt(object),2:6,sum)%/%
apply(catch.n(object),2:6,sum)
hvt <-function(object) catch(object)/stock(object)

recs <-function(object) {res=rec(object)
dimnames(res)[[1]]="all"
res}

catchJuv<-function(object) apply(catch.n(object)%*%(1-mat(object))%*%catch.wt(object),2:6,sum)

res=FLQuants(object,"ssb"=ssb,"stock"=stock,"rec"=recs,"catch"=catch,"fbar"=fbar,
"ageSwt"=ageSwt,"ageCwt"=ageCwt,"hrate"=hvt)
"swt"=swt,"cwt"=cwt,"sage"=sage,"cage"=cage,"catchJuv"=catchJuv)

model.frame(mcf(res),drop=TRUE)}

Expand All @@ -23,13 +29,25 @@ omRefs<-function(object){

refs}

omSmry<-function(x,y="missing"){

omSmry<-function(x,y="missing",z="missing"){

res=omStock(x)

if ("FLBRP" %in% is(y))
res=merge(res,omRefs(refpts(y)))
else if ("FLPar" %in% is(y))
else if ("FLPar" %in% is(y))
res=merge(res,omRefs(y))

if ("FLPar" %in% is(z))
if (all(c("a","b") %in% dimnames(z)$params))
res=merge(res,lenFn(x,z))
return(res)}

lenFn<-function(x,y){
sln<-function(object) apply(stock.n(object)%*%exp(log(stock.wt(object)%/%y["a"])%/%y["b"]),2:6,sum)%/%
apply(stock.n(object),2:6,sum)
cln<-function(object) apply(catch.n(object)%*%exp(log(catch.wt(object)%/%y["a"])%/%y["b"]),2:6,sum)%/%
apply(catch.n(object),2:6,sum)

model.frame(FLQuants(x,"sln"=sln,"cln"=cln),drop=TRUE)}
8 changes: 8 additions & 0 deletions R/swon.R
@@ -0,0 +1,8 @@
Six operational objectives are:

1. stock has a greater than ___% probability of occurring in the green quadrant of the Kobe matrix for (period).
2. stock has a less than ___% probability of entering the red quadrant of the Kobe matrix for (period).
3. less than ___% probability of the NSWO stock falling below BLIM (to be defined) for (period).
4. Maximize catch levels, achieving BMSY.
5. Limit change in TAC to ___% between management periods.
6. Ensure that fishing mortality of juveniles is below ___ for (period).

0 comments on commit 9f32d69

Please sign in to comment.