-
Notifications
You must be signed in to change notification settings - Fork 1
Description
If a term in a budget is expressed as the sum of a 2D surface flux and a 3D flux convergence, the default xbudget behavior naïvely sums these up, which results in xarray erroneously broadcasting the 2D array along the vertical coordinate of the 3D array, effectively meaning that the surface fluxes have uniform convergence at all vertical levels, whereas they should instead be broadcasted by having a non-zero value in whichever vertical level outcrops and zero flux convergence in all other levels.
In the short term, we should trigger a User Warning whenever such broadcasting occurs.
In the long term, we should see if there's a way to automatically do the correct broadcasting. (I think this is more difficult than it sounds because the outcropping level is not necessarily at the surface; for example, in density coordinates any of the vertical levels can outcrop at the surface, so we need additional information to know which level to put the convergence at.)