## 2 Materials and Methods
### Methodology--Continuous Wavelet Transformation  
After homogenization, verification of data quality, and filling the data gaps, the Wavelet Power Spectrum (WPS) method was used to analyze the spatiotemporal variability of rainfall at the scale of the Moulouya watershed. Spectral wavelet methods can be used to show the evolution of rainfall over different temporal scales [58; 59]. Continuous wavelet analyses, which we chose in this study, allow temporal localization of the variability of a given signal. The choice of this type of wavelet transform is justified by its robustness for climatic time series due to the wide range of possible dominant frequencies. Moreover, it is an efficient method to analyze non-stationary signals. The signal is decomposed in both time and frequency, which allows the correct description of climatic fluctuations, periodic or not [60]. [PERSON] and [PERSON] [61] introduced the wavelet transform, which, unlike the Fourier transform, decomposes the signal into a sum of finite size functions localized in time for each frequency identified in the signal [62; 63]. For this, a parent wavelet is dissociated into daughter wavelets to find the given frequency and then translated to analyze neighboring frequencies. Thus, these analyses were developed to overcome the disadvantages of classical Fourier analysis, which assumes that the periodic behavior is the same across all parts of the time series [44]. The daughter wavelets are the result of the decomposition of the reference wavelet (mother wavelet). Each wavelet has a finite length (a scale) and is strongly localized in time [37; 64; 65]. The wavelet can be characterized by its location in time (\(t\)) and frequency (\(\omega\) or bandwidth). The parent wavelet \(\psi(t)\) includes two parameters for time-frequency exploration: a scale parameter a and a temporal localization parameter \(b\) (Equation (1)):  
\[\psi_{a,b}(t)=\frac{1}{\sqrt{a}}\psi\left(\frac{t-b}{a}\right) \tag{1}\]  
where \(a\) is the scale parameter that measures the degree of compression, and b is the translation parameter that determines the temporal location of the wavelet. If \(\left|a\right|<1\), then the wavelet in Equation (1) is the compressed version (smaller time-domain support) of the parent wavelet and corresponds primarily to higher frequencies. When \(\left|a\right|>1\), then \(\psi_{a,b}(t)\) has a larger time width than \(\psi(t)\) and corresponds to lower frequencies. The success of Morlet wavelets in signal processing and time-frequency analysis of the signal depends on matching the time widths to their frequencies. In other words, the product of a complex exponential wave and a Gaussian envelope gives the Morlet wavelet:  
\[\psi_{0}(^{\eta})=\pi^{-1/4}e^{ia\omega_{0}\eta}e^{-\eta^{2}/2} \tag{2}\] \begin{table}
\begin{tabular}{c c c c c} \hline
**Name** & **ID** & **Longitude** & **Latitude** & **Elevation** \\ \hline Tighezratine & S33 & \(-\)3.899818 & 34.683683 & 1115 \\ Elmers & S34 & \(-\)4.393494 & 33.458244 & 1242 \\ \hline Ait Khabbach & S35 & \(-\)4.823201 & 33.385776 & 1491 \\ \hline \end{tabular}
\end{table} 
Table 1: _Cont._where \(\psi_{0}(^{\eta})\) is the wavelet value at dimensionless time \(\eta\), and \(\omega_{0}\) is the dimensionless frequency. In order to satisfy an admissibility condition for this study, \(\omega_{0}=6\). This implies that the function must have zero mean and be localized in both time and frequency space to be \"admissible\" as a wavelet. This is the basic wavelet function, but it is also necessary to change the overall size of the wavelet and drag the entire wavelet in time. Thus, the \"scaled wavelets\" are defined as:  
\[\psi\bigg{[}\frac{(n^{\prime}-n)\delta t}{s}\bigg{]}=\bigg{(}\frac{\delta t}{s }\bigg{)}^{1/2}\psi_{0}\bigg{[}\frac{(n^{\prime}-n)\delta t}{s}\bigg{]} \tag{3}\]  
where \(s\) is the \"dilation\" parameter used to change the scale, and n is the translation parameter used to slide in time. The factor \(s^{-1/2}\) is a normalization to keep the total energy of the scaled wavelet constant.