timjmiller / wham

State-space, age-structured fish stock assessment model
https://timjmiller.github.io/wham
Other
32 stars 16 forks source link

Project_wham doesn't work when only 1 WAA matrix in data due to indexing error #69

Closed ahart1 closed 4 months ago

ahart1 commented 1 year ago

This line of code generates the below error when only 1 WAA matrix is included in the ASAP input file

Code: https://github.com/timjmiller/wham/blob/6c30301d5b68c2bb0c0330cc4f112432c7950dfd/R/prepare_projection.R#L181

Error: Error in apply(data$waa[, avg.yrs.ind, ], c(1, 3), mean) : 'MARGIN' does not match dim(X)

When only 1 WAA matrix is available the MARGIN = 3 dimension does not exist

timjmiller commented 1 year ago

Are you supplying the waa through the basic_info argument of prepare_wham_input? If so, and you are not supplying an array (with dim(waa)[1] equal to 1), then this could be causing the error.

For example, the default waa array without an asap3 input is defined here https://github.com/timjmiller/wham/blob/6c30301d5b68c2bb0c0330cc4f112432c7950dfd/R/set_WAA.R#L20

On Wed, Nov 9, 2022 at 1:46 PM Amanda R. Hart @.***> wrote:

This line of code generates the below error when only 1 WAA matrix is included in the ASAP input file

Code: https://github.com/timjmiller/wham/blob/6c30301d5b68c2bb0c0330cc4f112432c7950dfd/R/prepare_projection.R#L181

Error: Error in apply(data$waa[, avg.yrs.ind, ], c(1, 3), mean) : 'MARGIN' does not match dim(X)

When only 1 WAA matrix is available the MARGIN = 3 dimension does not exist

— Reply to this email directly, view it on GitHub https://github.com/timjmiller/wham/issues/69, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIGN7CKQY5AS3CAGHNZMXDWHPWPHANCNFSM6AAAAAAR3XWUQ4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Timothy J. Miller, PhD (he, him, his) Research Fishery Biologist NOAA, Northeast Fisheries Science Center Woods Hole, MA 508-495-2365

timjmiller commented 4 months ago

I'm going to close this issue as old. If it somehow still applies, please just reopen.