lkerr / groundfish-MSE

Development of Robust Management Strategies for Northeast Groundfish Fisheries in a Changing Climate
MIT License
4 stars 2 forks source link

RPmat, get_advice, and get_fillRepArrays #254

Open mle2718 opened 1 year ago

mle2718 commented 1 year ago

RPmat is NA until the first time a stock assessment is run. This doesn't happen until y>=fmyearIdx

https://github.com/lkerr/groundfish-MSE/blob/ea59c71d82db906bd7f280c4390809ba0b5c8c86/processes/runSim.R#L82-L89

When runSim.R calls get_fillRepArrays.R, this causes me some problems.

Line 43 here is causing me some problems. https://github.com/lkerr/groundfish-MSE/blob/ea59c71d82db906bd7f280c4390809ba0b5c8c86/functions/datawrangling/get_fillRepArrays.R#L39-L47

Error in omval$FRATIO[r, m, y] <- stock$res$F.report[length(stock$res$F.report)]/RPmat[,  : 
  replacement has length zero
Called from: eval(substitute(expr),

I'm not good enough at R to figure out if this problem is due to length(stock$res$F.report) being 0, if stock$res$F.report is NULL or because RPmat[,1][y] is NULL. I can 'fix this' by only running get_fillRepArrays.R when year>=fmyearIdx, but this is not idea.

mle2718 commented 1 year ago

I've fixed it get_fillRepArrays by moving some of the problematic outputs into an if(y>=fmyearIdx) conditional.

A placeholder to remind me to cherry-pick this from EconOnly2 over to Dev?

96210282bdc14653e45bd4951f545d42abc0e5d9