When I move down the heirarchy, should I add the previous heirarchy’s dims to the next?
Either way is fine: Broadcasts to higher-dimensional variables (eg from “location” to (“location”, “time”)), or a long-form specification where the downstream variable remains 1-dimensional, but becomes longer through heavy reliance on subindexing. So from “location” to “location_time”.
The long-form specification is often needed if there is missing data. For example if there are a different number of time points for each location.
To debug shape errors such as the one you encountered, the most pragmatic way I’m aware of is to place something like assert some_variable.eval().shape == (1, 2, 3) in every second line.
It will be slow to recompile the model with every .eval(), but once you found the line with the shape problem, you can remove the asserts again…