# Generation of Complete SAR Geometric Distortion Maps Based on DEM and Neighbor Gradient Algorithm
## 2 Methodology
### P-NG Method for Simulating Passive Distortion  
The P-NG method defines for each cell whether it belongs to a passive layover region, a passive shadow region, or neither. Therefore, it is represented in the DEM geometry, which is generally a map projection. In the following algorithm, the values of the discrete points are determined on a pixel-by-pixel basis.  
In this subsection, we focus on the P-NG method for defining the passive distortion. For obtaining the passive distortion, we need to determine the neighbor gradient between the active and passive distortions. In this paper, the mentioned neighbor gradient refers to the ratio of the height difference and ground distance between the two ground points, which can be approximated by  
\[NG=\frac{\Delta h_{ij,ik}}{\Delta l_{ij,ik}} \tag{2}\]  
where  
\[\Delta h_{ij,ik}=\left|h_{ij}-h_{ik}\right| \tag{3}\]\[\Delta l_{ij,ik}=g\tau\cdot|j-k| \tag{4}\]  
where \(\theta_{ij}\) and \(h_{ij}\) are the incidence angle and elevation value of the climacteric point \((i,j)\) of the active distortion, respectively, \(\Delta h_{ij,ik}\) is the height difference between the climacteric point \((i,j)\) of the active distortion and the point \((i,k)\), \(\Delta l_{ij,ik}\) is the ground range from the point \((i,k)\) to the climacteric point of the active distortion, and \(g\tau\) is the ground range resolution of the DEM.  
The point \((i,k)\) can be defined as the passive layover distortion when  
\[NG>\tan\theta_{ij} \tag{5}\]  
The point \((i,k)\) can be defined as the passive shadow distortion when  
\[\frac{1}{NG}<\tan\theta_{ij} \tag{6}\]  
\(\bullet\)  Algorithm P-NG Generation:  
Phase 1: For each point \(p_{ij}\), incidence angle \(\theta_{ij}\) and slope angle \(\chi_{ij}\) are calculated by using the F-ALS method. For active layover, if \(\chi_{ij}>\theta_{ij}\) and towards the sensor (whereas, for active shadow, if \(\chi_{ij}>90-\theta_{ij}\) and away from the sensor), which are the conditions for an active distortion pixel, \(p_{ij}\) is marked as being active distortion. After phase 1, the P-NG contains all active distortion pixels. It is the input for phase 2 where the areas of the passive distortion are searched.  
Phase 2: Column searching the passive distortion pixels for passive layover with Equation (5), and for passive shadow, with Equation (6). The searching starts with the climacteric point of an active distortion region. When the pixel is not satisfied with Equations (5) or (6), it acts as the boundary point of the passive distortion region and we search for the next passive distortion region. The intermediate pixels on the way from an active boundary to the corresponding passive boundary yield the passive distortion pixels.  
Algorithm P-NG Generation is a point operation. Phase 2 should be done in parallel for every column and for every active distortion on that column.  
During the procedure, it is necessary to pay attention to the selection of the search area starting from the climacteric point that is separated from the passive region. This greatly reduces the time burden of the calculation. In addition, for the passive layover, it should be calculated in two parts for the region, which is composed of the near and far passives.