# The Summertime Diurnal Cycle of Precipitation Derived from IMERG
## 2 Materials and Methods
### Methodology  
Four years of IMERG data from June 2014 to May 2018 are used to determine the diurnal cycle of precipitation. At each grid box, histograms of precipitation for each half hour of the day are computed by binning seasonal rain rates from across the four-year period into 101 logarithmically spaced classes. For this analysis, summertime is considered to occur in June-July-August in the Northern Hemisphere and December-January-February in the Southern Hemisphere (although it should be noted that summertime is not well defined in the tropics). Rainfall occurrence, intensity, and accumulation are computed directly from each rain rate histogram. Occurrence is the ratio of rainfall counts to total (zero and positive rain rate) measurements:  
\[\text{Occurrence}(\phi,\lambda,t)=\frac{\sum_{R_{i}\geq 0}N_{i}}{\sum_{R_{i} \geq 0}N_{i}} \tag{1}\]  
where \(\phi\) and \(\lambda\) are the latitude and longitude of the grid box centre, respectively, \(t\) is the time of day, and \(N_{i}\) and \(R_{i}\) are the count and average rain rate for the \(i\)th rain rate class, respectively. Note that the IMERG threshold for rainfall is 0.1 mm/h. Accumulation is the mean of all rain rates (including zeros):  
\[\text{Accumulation}(\phi,\lambda,t)=\frac{\sum_{R_{i}\geq 0}N_{i}R_{i}}{ \sum_{R_{i}\geq 0}N_{i}}\bigg{(}\pm\frac{\sqrt{\sum_{R_{i}\geq 0}N_{i}\epsilon_{i} ^{2}}}{\sum_{R_{i}\geq 0}N_{i}}\bigg{)}. \tag{2}\]Intensity is the mean of all positive rain rates, i.e., it is the accumulation conditioned to positive rain rates (same as Equation (2) but with \(R_{i}>0\) replacing \(R_{i}\geq 0\)). If more than 20% of the rainfall estimates in the histogram for a specific grid box and half hour are classed as \"missing\" then occurrence, intensity and accumulation are not calculated. Random errors are calculated for accumulation and intensity (see the term in brackets in Equation (2)). The random error (\(\epsilon_{i}\)) for each rainfall class (\(R_{i}\)) at each grid box and for each half hour is computed as:  
\[\epsilon_{i}=\frac{\sqrt{\sum_{j}\epsilon_{i,j}^{2}}}{N_{i}} \tag{3}\]  
where \(\epsilon_{i,j}\) is the random error on the \(j\)th rainfall estimate that falls within the \(i\)th rain rate class. No random error is calculated for occurrence as there is assumed to be zero error in the count per rain rate class (\(N_{i}\)). The diurnal cycles of occurrence, intensity and accumulation are determined at each grid box by conducting a harmonic analysis [4; 17; 14; 28]. As the diurnal cycle of precipitation can be affected by sub-daily processes, it may not be fully represented by a 24 h harmonic, and may be influenced by higher-order (\(\frac{24}{n}\)h) harmonics. Only the first two harmonics are considered as they explain the majority of the diurnal variation in precipitation [4]. Harmonics are fitted to the half hour estimates of occurrence, intensity and accumulation (see Figures 1 and 2) via a non-linear least squares method weighted by the random errors using the harmonic function \(F(t)\) defined by:  
\[F(t)=f_{0}+A_{1}\text{cos}\frac{2\pi(t-T_{1})}{24}+A_{2}\text{cos}\frac{2\pi( t-T_{2})}{12} \tag{4}\]  
where \(t\) is the time of day, \(f_{0}\) is the mean, \(A_{1}\) and \(A_{2}\) are the diurnal (first/24 h harmonic) and semi-diurnal (second/12 h harmonic) mean-to-peak amplitudes, respectively, and \(T_{1}\) and \(T_{2}\) are the phases of the diurnal and semi-diurnal peaks, respectively. The goodness of fit of the harmonic function to the IMERG estimates is assessed using the correlation coefficient (\(R\)) between the values assumed by the fitting function in Equation (4) and the estimates, and the ratio of the variance of the function values to the variance of the estimates (\(V_{F(t)}/V_{d}\)). Errors are determined for each of the fit parameters (\(f_{0}\), \(A_{1}\), \(A_{2}\), \(T_{1}\), \(T_{2}\)) from the fitting procedure.