## 2 Model Development
### Method for Roughness Solution  
The optimization model for roughness inversion was solved through an iterative process. The whole solution process is shown in Figure 2:  
Figure 1: Example of (**b**) smoothing matrix for (**a**) a simulated river network. Figure 2: Workflow diagram. 1. Initial roughness \(\mathbf{n}^{0}\) was set according to the river section characteristics. 2. A 1D hydrodynamic river model was utilized to calculate the hydrodynamic simulation values \(g(\mathbf{n}^{k-1})\) for \(\mathbf{n}^{k-1}\) conditions. The current iteration step is denoted by \(k\), starting from 1. 3. The gradient of the objective function (Equation (1)) can be obtained with the following equation: \[\
abla F(\mathbf{n}^{k})=\frac{\partial g(\mathbf{n}^{k})}{\partial\mathbf{n}^{k}}(\mathbf{C} _{d}^{-1}[g(\mathbf{n}^{k})-\mathbf{d}_{obs}])+\mathbf{L}^{T}\mathbf{C}_{n}^{-1}\mathbf{L}\mathbf{n}^{k}\] (4) Combining \(g(\mathbf{n}^{k})\approx g(\mathbf{n}^{k-1})+\frac{\partial g(\mathbf{n}^{k})}{\partial \mathbf{n}^{k}}(\mathbf{n}^{k}-\mathbf{n}^{k-1})\) with Equation (4), we can obtain the following: \[ \begin{array}{ll}\
abla F(\mathbf{n}^{k})&=\frac{\partial g(\mathbf{n}^{k})}{ \partial\mathbf{n}^{k}}(\mathbf{C}_{d}^{-1}[g(\mathbf{n}^{k})-\mathbf{d}_{obs}])+\mathbf{L}^{T}\bm {C}_{n}^{-1}\mathbf{L}\mathbf{n}^{k}\\ &=\frac{\partial g(\mathbf{n}^{k})}{\partial\mathbf{n}^{k}}(\mathbf{C}_{d}^{-1}[g(\mathbf{n}^ {k-1})+\frac{\partial g(\mathbf{n}^{k})}{\partial\mathbf{n}^{k}}(\mathbf{n}^{k}-\mathbf{n}^{k -1})-\mathbf{d}_{obs}])+\mathbf{L}^{T}\mathbf{C}_{n}^{-1}\mathbf{L}\mathbf{n}\end{array} \] (5) where \(\frac{\partial g(\mathbf{n}^{k})}{\partial\mathbf{n}^{k}}\) is the gradient of \(g\left(\mathbf{n}\right)\) with respect to \(\mathbf{n}^{k}\) at the \(k\)-th iteration, which can be replaced with sensitivity matrix \(\mathbf{G}^{k}\). Therefore, Equation (5) can be simplified as follows: \[\
abla F(\mathbf{n}^{k})=\mathbf{G}^{k}(\mathbf{C}_{d}^{-1}[g(\mathbf{n}^{k-1})+\mathbf{G}^{k}( \mathbf{n}^{k}-\mathbf{n}^{k-1})-\mathbf{d}_{obs}])+\mathbf{L}^{T}\mathbf{C}_{n}^{-1}\mathbf{L}\mathbf{n}\] (6) where sensitivity matrix \(\mathbf{G}^{k}\) is solved using a single-factor perturbation method. 4. For the convex programming problem without boundary constraints, in this paper, the gradient at the extremum point was 0 when the roughness was equal to the optimization value, i.e., \(\
abla F(\mathbf{n}^{k})=0\). The optimal solution of roughness at the \(k\) iteration is obtained as follows: \[ \begin{array}{ll}\mathbf{n}^{k}=&((\mathbf{G}^{k})^{T}\mathbf{C}_{d}^{-1}\mathbf{G}^{k}+\bm {L}^{T}\mathbf{C}_{n}^{-1}\mathbf{L})^{-1}(\mathbf{G}^{k})^{T}\mathbf{C}_{d}^{-1}\\ &[\mathbf{d}_{obs}-g(\mathbf{n}^{k-1})]+(\mathbf{G}^{k})^{T}\mathbf{C}_{d}^{-1}\mathbf{G}^{k}\mathbf{n} ^{k-1}\end{array} \] (7)
5. The roughness correction at the \(k\)-th iteration can also be obtained as follows: \[ \begin{array}{ll}\Delta\mathbf{n}^{k}=&\{[(\mathbf{G}^{k})^{T}\mathbf{C}_{d}^{-1}\mathbf{G }^{k}+\mathbf{L}^{T}\mathbf{C}_{n}^{-1}\mathbf{L}]^{-1}(\mathbf{G}^{k})^{T}\mathbf{C}_{d}^{-1}\mathbf{ G}^{k}-\\ &\mathbf{I}\}\mathbf{n}^{k-1}+[(\mathbf{G}^{k})^{T}\mathbf{C}_{d}^{-1}\mathbf{G}^{k}+\mathbf{L}^{T}\mathbf{ C}_{n}^{-1}\mathbf{L}]^{-1}(\mathbf{G}^{k})^{T}\mathbf{C}_{d}^{-1}\\ &[\mathbf{d}_{obs}-g(\mathbf{n}^{k-1})]\end{array} \] (8)
6. To enhance the stability of the iterative calculation, the roughness of the \(k\)-th iteration is denoted by \(\mathbf{n}^{k}=\mathbf{n}^{k-1}+\rho\Delta\mathbf{n}^{k}\), where \(\rho\in(0,1)\). The iteration process was repeated from Steps (2) to (6) until the convergence criterion had been met, which is defined as Max \((\Delta\mathbf{n}^{k})<0.0001\), meaning that the iteration terminates when the maximal correction value of the roughness is below 0.0001.