gadget-framework / gadget3

TMB-based gadget implemtation
GNU General Public License v2.0
8 stars 6 forks source link

error when ageing and tagging actions combined #96

Closed willbutler42 closed 1 year ago

willbutler42 commented 1 year ago

I am getting the following error message when running g3_to_tmb on models that include tagging actions:

Error in convert_subset(tail(in_call, -2)) : 
  Missing values must be at start of subset, can't restructure array: prey_a__num[, prey_a__age_idx, ]

It seems to occur when combining ageing and tagging actions. For example, if in test-action_tagging (https://github.com/gadget-framework/gadget3/blob/master/tests/test-action_tagging.R#L9) we include ageing:

g3_stock('prey_a', seq(1, 10)) %>% g3s_age(minage = 0, maxage = 1) %>% g3s_tag(tags)

and insert g3a_age(prey_a) into the action list, the error is produced.

lentinj commented 1 year ago

The order is important. g3a_age() is moaning it wants g3s_age(minage = 0, maxage = 1) last, so it doesn't have to do any trickery to select all the data for one age group in one go.

The error could be a lot clearer, and may not even be relevant now (although would definitely be preferable). g3a_age() is ripe for being reworked.

willbutler42 commented 1 year ago

Ah I see, thanks @lentinj : )