Currently specified dimensions (ones other than '*') must be present in every input quantity and must be of the same length. I propose to relax this condition such that if quantities are missing a specified dimension, it will be created and broadcast on that quantity, so long as at least one input actually has that dimension.
This would greatly simplify initializing a model with uniform values, as the initial state need only have a single point value with no dimensions, so long as some inputs possess the required dimensions. We can ensure this happens in CliMT by having more complex initializers for key quantities (e.g. air temperature, air pressure). The output values after calling components would reflect any broadcasting as required. This avoids having to worry about the shape of initial arrays when handling initialization (e.g. making things surface-only or surface and vertical), as this would happen automagically when calling components.
The downside is that if a user inadvertently forgets to put in a required dimension (such as with a typo), this may silently broadcast when we want it to error... but I feel as though this scenario is relatively unlikely, and even if it comes up, it's not that bad relative to the gains we get by making this change.
Currently specified dimensions (ones other than '*') must be present in every input quantity and must be of the same length. I propose to relax this condition such that if quantities are missing a specified dimension, it will be created and broadcast on that quantity, so long as at least one input actually has that dimension.
This would greatly simplify initializing a model with uniform values, as the initial state need only have a single point value with no dimensions, so long as some inputs possess the required dimensions. We can ensure this happens in CliMT by having more complex initializers for key quantities (e.g. air temperature, air pressure). The output values after calling components would reflect any broadcasting as required. This avoids having to worry about the shape of initial arrays when handling initialization (e.g. making things surface-only or surface and vertical), as this would happen automagically when calling components.
The downside is that if a user inadvertently forgets to put in a required dimension (such as with a typo), this may silently broadcast when we want it to error... but I feel as though this scenario is relatively unlikely, and even if it comes up, it's not that bad relative to the gains we get by making this change.