Suggested fix: use the correct snapshots of $S$ and $s^*$ when combining salt and volume budgets to close the salinity budget. Thanks to @gaelforget for pointing this out.
The salinity budget is derived from the salt and volume budgets by applying the product rule. In the continuous sense:
$$
\frac{\partial (s^\ast S )}{\partial t} = s^\ast \frac{\partial S}{\partial t} + S\frac{\partial s^\ast}{\partial t}.
$$
However, in discrete time, care should be taken to use the correct snapshots. The first-order discrete derivative can (only) be written as:
$$
\frac{s^\ast_1 S_1 - s^\ast_0 S_0}{\Delta t}
= s^\ast_1\frac{S_1 - S_0}{\Delta t} + S_0\frac{s^\ast_1 - s^\ast_0}{\Delta t}.
$$
Here, $S_{0,1}$ are snapshots of salinity at the beginning ($t_0$) and end ($t_1$) of the interval $\Delta t$; $s^\ast_{0,1}$ are corresponding scaling factors derived from ETAN snapshots; the LHS represents the evaluated salt tendency, the first term on the RHS is the salinity tendency scaled by $s^\ast_{1}$, and the second term on RHS is volume tendency scaled by $S_{0}$. Re-arranging this equation leads to diagnostic form of salinity budget expressed by salt/volume budget terms. When evaluated consistently with the right snapshots ($s^\ast_{1}$ and $S_{0}$), this salinity budget should be closed to machine precision (or to the same accuracy as the salt and volume budget closures).
The current ECCO_v4_Salt_and_salinity_budget.ipynb, however, uses monthly-mean ETAN and SALT in the places of $s^\ast_1$ and $S_0$, respectively (see definitions of rstarfac and G_advection_Sln_compute in the notebook). This is inconsistent with the discrete product rule above and is like a major source of error in the salinity budget closure.
Figures below are the time and full-column averaged salinity budget terms over 1993-2012 using ECCOv4r2 outputs. The first is the result using the correct snapshots of $s^\ast_1$ and $S_0$ when scaling the volume and salt budget terms. The residual is nearly machine precision, as small as those from salt and volume budgets.

This is the result using monthly means of $s^\ast$ and $S$ when scaling the volume and salt budget terms (as is done in current ECCO_v4_Salt_and_salinity_budget.ipynb). The residual is quite large.

Suggested fix: use the correct snapshots of$S$ and $s^*$ when combining salt and volume budgets to close the salinity budget. Thanks to @gaelforget for pointing this out.
The salinity budget is derived from the salt and volume budgets by applying the product rule. In the continuous sense:
However, in discrete time, care should be taken to use the correct snapshots. The first-order discrete derivative can (only) be written as:
Here,$S_{0,1}$ are snapshots of salinity at the beginning ($t_0$ ) and end ($t_1$ ) of the interval $\Delta t$ ; $s^\ast_{0,1}$ are corresponding scaling factors derived from $s^\ast_{1}$ , and the second term on RHS is volume tendency scaled by $S_{0}$ . Re-arranging this equation leads to diagnostic form of salinity budget expressed by salt/volume budget terms. When evaluated consistently with the right snapshots ($s^\ast_{1}$ and $S_{0}$ ), this salinity budget should be closed to machine precision (or to the same accuracy as the salt and volume budget closures).
ETANsnapshots; the LHS represents the evaluated salt tendency, the first term on the RHS is the salinity tendency scaled byThe current ECCO_v4_Salt_and_salinity_budget.ipynb, however, uses monthly-mean$s^\ast_1$ and $S_0$ , respectively (see definitions of
ETANandSALTin the places ofrstarfacandG_advection_Sln_computein the notebook). This is inconsistent with the discrete product rule above and is like a major source of error in the salinity budget closure.Figures below are the time and full-column averaged salinity budget terms over 1993-2012 using ECCOv4r2 outputs. The first is the result using the correct snapshots of$s^\ast_1$ and $S_0$ when scaling the volume and salt budget terms. The residual is nearly machine precision, as small as those from salt and volume budgets.

This is the result using monthly means of$s^\ast$ and $S$ when scaling the volume and salt budget terms (as is done in current ECCO_v4_Salt_and_salinity_budget.ipynb). The residual is quite large.