gadget-framework/gadget3

error when ageing and tagging actions combined

Closed this issue · 2 comments

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.

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.

Ah I see, thanks @lentinj : )