ControlTreeMixin discretizes empty branches
If there are 2 ensembles with the exact same forcings ("forecast_variables"), and one adds a single split somewhere with k=2, both ensembles will be allocated to the zeroth branch.
This in itself is not wrong (I would even say it's correct behavior), but ControlTreeMixin does still allocate the state vector part for branch 1. This part of the state vector is now just a bunch of free variables.
It would be cleaner if we could avoid allocating free variables like this.
NOTE: Not sure if this also happens if splitting twice, and the first branc hlooks like {'': [1,2,3,4], '0': [1,2,3], '1': [4]}. If it does, it's probably more important to address.
EDIT: Looking at the Dijkverruiming test, I see this:
control_tree_mixin.py 165 DEBUG {'': [0, 1, 2], '0': [0], '1': [2, 1], '00': [0], '01': [], '000': [0], '001': [], '0000': [0], '0001': [], '00000': [0], '00001': [], '000000': [0], '000001': [], '0000000': [0], '0000001': [], '00000000': [0], '00000001': [], '000000000': [0], '000000001': [], '0000000000': [0], '0000000001': [], '00000000000': [0], '00000000001': [], '000000000000': [0], '000000000001': [], '0000000000000': [0], '0000000000001': [], '00000000000000': [0], '00000000000001': [], '000000000000000': [0], '000000000000001': [], '0000000000000000': [0], '0000000000000001': [], '00000000000000000': [0], '00000000000000001': [], '000000000000000000': [0], '000000000000000001': [], '0000000000000000000': [0], '0000000000000000001': [], '00000000000000000000': [0], '00000000000000000001': [], '10': [2], '11': [1], '100': [2], '101': [], '1000': [2], '1001': [], '10000': [2], '10001': [], '100000': [2], '100001': [], '1000000': [2], '1000001': [], '10000000': [2], '10000001': [], '100000000': [2], '100000001': [], '1000000000': [2], '1000000001': [], '10000000000': [2], '10000000001': [], '100000000000': [2], '100000000001': [], '1000000000000': [2], '1000000000001': [], '10000000000000': [2], '10000000000001': [], '100000000000000': [2], '100000000000001': [], '1000000000000000': [2], '1000000000000001': [], '10000000000000000': [2], '10000000000000001': [], '100000000000000000': [2], '100000000000000001': [], '1000000000000000000': [2], '1000000000000000001': [], '10000000000000000000': [2], '10000000000000000001': [], '110': [1], '111': [], '1100': [1], '1101': [], '11000': [1], '11001': [], '110000': [1], '110001': [], '1100000': [1], '1100001': [], '11000000': [1], '11000001': [], '110000000': [1], '110000001': [], '1100000000': [1], '1100000001': [], '11000000000': [1], '11000000001': [], '110000000000': [1], '110000000001': [], '1100000000000': [1], '1100000000001': [], '11000000000000': [1], '11000000000001': [], '110000000000000': [1], '110000000000001': [], '1100000000000000': [1], '1100000000000001': [], '11000000000000000': [1], '11000000000000001': [], '110000000000000000': [1], '110000000000000001': [], '1100000000000000000': [1], '1100000000000000001': [], '11000000000000000000': [1], '11000000000000000001': []}
I can only imagine that many of those branches are allocated in the state vector but empty/free.