The Tropical Rainfall Measuring Mission (TRMM) is a joint U.S.-Japan   satellite mission to monitor tropical and subtropical precipitation   and to estimate its associated latent heating.
                                    
The primary objective of the 2A21 is to compute the path integrated attenuation (PIA), using the surface reference technique (SRT).  The SRT relies on the assumption that the difference between the measurements of the normalized surface cross section within and outside the rain provides a measure of the PIA. 
                                    
Two types of non-rain surface cross section (sigma-zero) reference estimates are used: spatial and temporal.  In the spatial surface reference data set, the mean and standard deviation of the surface cross sections are calculated over a running window of Ns fields of view before rain is encountered.  These operations are performed separately for each of the 49+2 incidence angles of TRMM (corresponding to the cross-track scan from -17 degrees to + 17 degrees with respect to nadir).  The two additional angle bins (making the total 51 rather than 49) are to account for non-zero pitch/roll angles that can shift the incidence angle with respect to nadir outside the normal range.
                                    
For the temporal surface reference data set, the running mean and standard deviation are computed over a 1 degree x 1 degree (latitude, longitude) grid.  Within each 1 degree x 1 degree grid cell, the data are further categorized into incidence angle categories (26).  The number of observations in each category, Nt, are also recorded.  Note that, for the temporal reference data set, no distinction is made between the port and starboard incidence angles.  So, instead of 49 incidence angles, there are only 25 + 1, where the additional bin corresponds to angles greater than the normal range. 
                                    
When rain is encountered, the mean and standard deviations of the reference sigma-zero values are retrieved from the spatial and temporal surface reference data sets.  To determine which reference measurement is to be used, the algorithm checks whether Nt >= Ntmin and Ns >= Nsmin, where Ntmin and Nsmin are the minimum number of samples that are needed to be considered a valid reference estimate for the temporal and spatial reference data sets, respectively. (Presently, Ntmin = 50 and Nsmin = 8).  If neither condition is satisfied, no estimate of the PIA is made and the flags are set accordingly.  If only one condition is met, then the surface reference data which corresponds to this is used.  If both conditions are satisfied, the surface reference data is taken from that set which has the smaller standard deviation.
                                    
If a valid surface reference data set exists (i.e., either Nt >= Ntmin or Ns >= Nsmin or both) then the 2-way path attenuation (PIA) is estimated from the equation:
                                    
PIA  = <sigma-zero(reference value)> - sigma-zero(in rain)
                                    
where sigma-zero(in rain) is the value of the surface cross section over the rain volume of interest and <sigma-zero(reference value)> is the mean value obtained from either the temporal or spatial reference data sets, the choice of which depends on the considerations discussed above.
                                    
To obtain information as to the reliability of this PIA estimate we consider the difference between the PIA, as derived in the above equation, and the standard deviation as calculated from the no-rain sigma-zero values and stored in the reference data set.  Labeling this as std dev(reference value), then the reliability factor of the PIA estimate is obtained from:
                                    
reliabFactor = PIA - std dev(reference value)
                                    
When this quantity is large, the reliability is considered high and conversely. This is the basic...