Gamma DIFF: mk_diff_2d scripts for differential interferometry


mk_diff_2d, mk_int_2d, mk_adf_2d, mk_unw_2d, mk_base_2d, mk_hgt_2d, mk_quad_2d

Perl Script: mk_diff_2d, mk_int_2d, mk_adf_2d, mk_unw_2d, mk_base_2d, mk_hgt_2d, mk_quad_2d

NAMES

mk_diff_2d     Calculate 2D diff. interferograms using RSLC_tab, itab, DEM and deformation rate in Range-Doppler Coordinates (RDC), either using baseline model or orbits
mk_int_2d      Calculate 2D interferograms (*.int, *.diff) without subtraction of simulated phase
mk_adf_2d      Adaptive filtering (adf) of a set of differential interferograms
mk_unw_2d      Unwrap a stack of differential interferograms
mk_base_2d     Estimate precision baselines from unwrapped phase and DEM in range-Doppler coordinates
mk_hgt_2d      Calculate height maps from a stack of unwrapped differential interferograms
mk_quad_2d     Estimate and subtract a quadratic polynomial fit from a stack of interferograms and SLCs

Descriptions:

The DIFF/scripts directory contains a set of Perl scripts that can be used in concert to process a stack of differential interferograms starting from  the coregistered SLC data and proceeding through to differential interferograms, deformation maps, and height maps. These products can be terrain geocoded. Coregistration of the SLC data can be accomplised with the SLC_resamp_lt and SLC_resamp_lt_all scripts. Also required is a DEM in the SAR image geometry with the same pixel spacing as the differential interferogram. This DEM in range-doppler coordinates (RDC) can be produced using the mk_geo script.

The input resampled and coregistered SLCs used for the interferograms should be all located in a single directory. The starting point of the processing is an text format table of the resampled SLCs (*.rslc) and SLC parameter files (*.rslc.par) that can be created using the mk_tab script. An example of the SLC_tab used for this example is shown here:

mk_tab slc slc slc.par SLC_tab

SLC_tab:
slc/19990915.slc    slc/19990915.slc.par
slc/19991020.slc    slc/19991020.slc.par


Throughout this document commands entered on the keyboard are magenta, computer program names and screen output from running programs are in blue.

The mk_diff_2d script produces a set of differential interferograms using pairs of SLC images as specified in the ITAB text file. The ITAB file has 4 columns of text, with each line of the file specifying a single interferogram. The numbers in the first two columns of the ITAB refer to line numbers in the SLC_tab. In this example there are only 2 SLCs entries in the SLC_tab and the ITAB file has only single line:

cat itab
1  2  1  1


The numbers in column 3 and 4 are a counter of the number of interferograms in the ITAB starting with 1 and an active flag (0 or 1)  respectively .  If the value of the active flag is set to one, then this interferogram will be used in later time series calculations,  otherwise not.  The ITAB file can be created using a text editor or as output from the script base_calc.

mk_diff_2d

*** /Users/cw/gamma_software/DIFF/scripts/mk_diff_2d
*** Copyright 2015, Gamma Remote Sensing, v4.4 8-Apr-2015 clw ***
*** Calculate 2D diff. interferograms using RSLC_tab, itab, DEM and deformation rate in Range-Doppler Coordinates (RDC) ***

usage: /Users/cw/gamma_software/DIFF/scripts/mk_diff_2d <RSLC_tab> <itab> <bflag> <DEM_rdc> <def> <mli> <mli_dir> <diff_dir> <rlks> <azlks> <cc_win> [rsflag] [azflag] [mflag] [r_samp] [az_line]

    RSLC_tab  (input) two column list of resampled SLC filenames and SLC parameter filenames (including paths) (text)
                1. SLC filename  (includes path)
                2. SLC parameter filename (includes path)
    itab      (input) table associating interferogram stack records with pairs of SLC stack records (text)
                1. row number in SLC_tab of the reference SLC
                2. row number in SLC_tab of SLC-2 of the interferogram
                3. line number in the itab
                4. flag used to indicate if this interferogram is used for IPTA processing (0:not used  1:used)
    bflag     baseline flag:
                0: use initial baseline in the baseline file
                1: use precision baseline in the baseline file
    DEM_rdc   (input) terrain height in radar range-Doppler coordinates (meters, float, enter - for none)
    def       (input) deformation rate (m/year) (enter - for none)
    mli       (input) reference MLI image with same rlks and azlks as the interferogram
    mli_dir   directory containing MLI images of the coregistered SLCs                     
    diff_dir  differential interferograms after subtraction of simulated unwrapped phase  
    rlks      range looks for interferogram generation
    azlks     azimuth looks for interferogram generation
    cc_win    correlation estimation window size in pixels with linear weighting (default: 3)
    rsflag    range spectral shift filtering flag:
                0: off
                1: on (default)
    azflag    azimuth common-band filtering flag:
                0: off
                1: on (default)  
    mflag     initial baseline estimation and refinement flag:
                0: orbit state vector data (default)
                1: orbit state vector data + baseline refinement using 2-D FFT
                2: use existing baseline file
    r_samp    range pixel offset to center of FFT window for baseline refinement using 2-D FFT (default: image center)
    az_line   azimuth line offset to center of FFT window for baseline refinement using 2-D FFT (default: image center)
   
    -s scale  (option) set image display scale factor (default: 1)  
    -e exp    (option) set image display exponent (default: 0.35)
    -c        (option) use of cc_ad rather than cc_wave to estimate correlation
    -o        (option) simulate interferogram phase using orbit state vectors with phase_sim_orb
    -a        (option) when using orbit state vectors for simulation of the phase, add phase calculated from residual baseline obtained by base_ls
    -r        (option) SLC parameter file from the scene used for coregistration, required by phase_sim_orb
    -t        (option) Tandem-X single-pass interferometry mode


This is the main script for generation of differential interferograms.  As an example:

mk_diff_2d RSLC_tab itab 0 geo/hector_dem.rdc - rmli_2_10/rmli_2_10.ave rmli_2_10 diff0_2d 2 10

The interferogram filenames are generated from the SLC names with an "_" between the SLC root name. The names are the SLC are usually the date given in the form YYYYMMDD.  An extension ".diff" is appended to the end of the filename. In this example the differential interferogram is named:

19990915_1991020.diff

The interferometric products produced by running the scripts are placed in the directory specified on the command line as the diff_dir parameter.
RSLC_tab is the list of SLCs, the itab file is called itab, and the initial baseline is used in the baseline file calculated by base_calc by setting the value of bflag  to 0. The DEM in RDC coordinates is given by the DEM_rdc parameter.  If  a map of the linear deformation rate is available that matches the size of the differential interferogram it is specfied by the def filename parameter, otherwise a "-" can be entered.  The MLI image for the background of the differential interferogram images given by the rmli parameter. This is usually the MLI_ave image produced by the mk_mli_all script that generated the mli image for the stack of SLCs.   The stack of rmli images is in the rmli_dir directory.  mk_mli_all generates the names of the rmli images from the SLC_names by removing .slc and appending .mli or .rmli depending if the SLC file name ended in .slc or .rslc. 

diff_dir is the directory for the differential interferograms and is the same directory where the baseline calculated by base_calc are placed. The number of range and azimuth looks for the differential interferograms are the rlks and azlks parameters respectively.  The size of the rectangular window used by the program cc_wave to estimate the correlation coefficent is given by the cc_win parameter.  The script allows specifying if range and azimuth common band filtering can be switched on or off in the call to program SLC_diff_intf via the rsflag and azflag parameters.  In some cases the state vectors used to calculate the initial baseline are inaccurate and the interferogram itself can be used to improve the estimate of the perpendicular baseline using the ISP program base_init.  If the mflag parameter is set to 1,  then
base_init will improve the baseline estimate using an FFT of a section of the interferogram centered on the point specified by r_samp and az_line

The program phase_sim in the DIFF&GEO is used to calculate the simulated interferometric phase from the DEM and a polynomial model for the baseline obtained with program base_orbit. The program SLC_diff_intf is used to calculate the differential interferogram after subtraction of the simulated phase using the coregistered SLCs as input. mk_diff_2d uses program  cc_wave to calculate the correlation map using a window size  specified by the cc_win parameter.

The -o option selects using state vector orbit data rather than the polynomial baseline model to calculate the simulated interferometric phase  If state vector orbit data are selected then the SLC parameter file of the scene used for geometric coregistration must be provided using the -r option. The reason for this is that resampling of the SLCs means that there are shifts in time for one scene relative to the other. To calculate the actual baseline, the baselines relative to the reference scene are calculated for the two SLCs and their difference is used. 

The program phase_sim_orb is used to calculate the simulated phase from the orbit state vectors and DEM in radar coordinates. In cases were estimation of the residual baseline error has been performed on differential interferograms after subtraction of the simulated phase obtained from the orbit state vectors (phase_sim_orb), then providing the -a option will subtract the phase due to this residual baseline in addition to the phase calculated with phase_sim_orb.  

The use can also specify that the data are from single-pass interferometry from the Tandem-X mission via the -t option.

The raster image  of the complex differential interferogram is produced using rasmph_pwr and the correlation map using rascc.  Both programs are in the DISP package. The scale factor and display exponent can be specified using the -s and -e flags followed by a value. These parameters are specified not by the order in the command line, but at the end of the parameter list. Only those parameters in [] brackets must be specified.  Required parameters on the command line are surrounded by <> and optional parameters on the command line are surrounded by [ ].

mk_int_2d

*** /Users/cw/gamma_software/DIFF/scripts/mk_int_2d
*** Copyright 2017, Gamma Remote Sensing, v2.7 10-Apr-2015 clw ***
*** Calculate 2D interferograms without subtraction of simulated phase ***

usage: /Users/cw/gamma_software/DIFF/scripts/mk_int_2d <RSLC_tab> <itab> <mli> <mli_dir> <int_dir> <rlks> <azlks> <cc_win> [rsflg] [azflg] [ext] [scale] [exp]

    RSLC_tab  (input) two column list of resampled SLC filenames and SLC parameter filenames (including paths) (text)
                1. SLC filename  (includes path)
                2. SLC parameter filename (includes path)
    itab      (input) table associating interferogram stack records with pairs of SLC stack records (text)
                1. row number in SLC_tab of the reference SLC
                2. row number in SLC_tab of SLC-2 of the interferogram
                3. line number in the itab
                4. flag used to indicate if this interferogram is used for IPTA processing (0:not used  1:used)
    mli       (input) reference MLI image with the same rlks and azlks as the interferogram
    mli_dir   directory containing MLI images of the coregistered SLCs                     
    int_dir   interferogram directory
    rlks      range looks for interferogram generation
    azlks     azimuth looks for interferogram generation
    cc_win    correlation estimation window size in pixels with linear weighting (default: 3)
    rsflg     range spectral shift filtering flag:
                0: off (default)
                1: on
    azflg     azimuth common-band filtering flag:
                0: off (default)
                1: on

    -s scale  (option) set image display scale factor (default: 0.7)  
    -e exp    (option) set image display exponent (default: 0.35)
    -m        (option) use MLI2 as the background image rather than rmli image on the command line
    -c        (option) use cc_ad to estimate correlation rather than cc_wave


This script generates interferograms without subtraction of topographic phase generated using phase_sim or phase_sim_orb.  The output interferograms are placed in the int_dir specified on the command line. This script is used primarily for generation of differential interferograms using the GPRI-II (Gamma Portable Radar Interferometer) where the topographic phase contribution is essentially 0.  Other command line parameters are are described in mk_diff_2d.

mk_adf_2d

*** /Users/cw/gamma_software/DIFF/scripts/mk_adf_2d
*** Copyright 2013, Gamma Remote Sensing, v2.7 19-Jul-2013 clw ***
*** Adaptive filtering (adf) of a set of differential interferograms ***

usage: /Users/cw/gamma_software/DIFF/scripts/mk_adf_2d <RSLC_tab> <itab> <mli> <diff_dir> [cc_win] [adf_exp] [adf_win] [adf_step]

    RSLC_tab    (input) two column list of resampled SLC filenames and SLC parameter filenames
                  1. SLC filename  (includes path)
                  2. SLC parameter filename (includes path)
    itab        (input) table associating interferogram stack records with pairs of RSLC_tab records (text)       
                  1. row number in SLC_tab of the reference SLC
                  2. row number in SLC_tab of SLC-2 of the interferogram
                  3. line number in the itab
                  4. flag used to indicate if this interferogram is used for IPTA processing (0:not used  1:used)
    mli         (input) MLI background image derived from the resampled SLCs with the same dimensions as the interferogram
    diff_dir    differential interferogram directory containing *.diff differential interferogram files   
    cc_win      correlation estimation window range and azimuth size (linear weighting) in pixels, (default: 7)
    adf_exp     exponent parameter for adf interferogram filter, (nominal range 0.2-->1.0, default: 0.4)
    adf_win     window size for adf filter (default: 32)
    adf_step    range and azimuth filter step size (1 < adf_step <= adf_win/2, default: 4)
   
    -m mli_dir  (option) use MLI2 as the background image rather than mli image specified on the command line
                mli_dir is the directory containing the mli images
    -s scale    (option) set image display scale factor (default: 0.7)  
    -e exp      (option) set image display exponent (default: 0.35)

This script is used to apply the ISP program adf to filter the differential interferograms produced using mk_diff_2d, mk_diff_orb_2d or mk_int_2d. Further information on setting the adf specific parameters (adf_exp, adf_win, adf_step) are in the HTML documentation for adf in the ISP.  The adf_exp parameter corresponds to the alpha exponent value in the call to adf.

The relative intensity scale factor parameter -s value and exponent -e value are used to set the brightness and contrast of the Sun raster format images produced by the script using program rasmph_pwr. The -m option permits using the MLI2 image as the background rather than the mli background image supplied on the command line.  For scenes that are rapidly changing as with the GPRI-II data, using the actual background image may be useful. To use this option the directory were the MLI images are stored must also be specified.

mk_unw_2d

*** /Users/cw/gamma_software/DIFF/scripts/mk_unw_2d
*** Copyright 2015, Gamma Remote Sensing, v4.4 6-Apr-2015 clw ***
*** Unwrap the phase of a stack of interferograms using minimum cost flow (MCF) algorithm ***

usage: /Users/cw/gamma_software/DIFF/scripts/mk_unw_2d <RSLC_tab> <itab> <rmli> <diff_dir> [cc_thres] [pwr_thres] [nlks] [npat_r] [npat_az] [mode] [r_init] [az_init] [tri_mode] [unw_mask] [roff] [loff] [nr] [nlines]

    RSLC_tab    (input) two column list of resampled SLC filenames and SLC parameter filenames (including paths)
                  1. SLC filename  (includes path)
                  2. SLC parameter filename (includes path)
    itab        (input) table associating interferograms with pairs of SLCs listed in the RSLC_tab
                  1. row number in SLC_tab of the reference SLC
                  2. row number in SLC_tab of SLC-2 of the interferogram
                  3. line number in the itab
                  4. flag used to indicate if this interferogram is to be considered in time-series processing (0:not used  1:used)
    rmli        (input) MLI reference image derived from the resampled SLCs with the same dimensions as the interferogram
    diff_dir    differential interferogram directory containing *.diff differential interferogram files
    cc_thres    threshold for correlation for creating the unwrapping mask (0.0 --> 1.0) (default: 0.4)
    pwr_thres   threshold for relative intensity for creating the unwrapping mask (0.0 --> 1.0) (default: 0)
    nlks        number of looks in range and azimuth to scale before unwrapping (default: 1)
    npat_r      number of patches in range (default: 1)
    npat_az     number of patches in azimuth (default: 1)
    mode        processing mode:
                  0: unwrap unfiltered data (*.diff)
                  1: (default) unwrap adf filtered data (*.adf.diff) using adf correlation (*.adf.cc)
    r_init      phase reference range offset (default: -)
    az_init     phase reference azimuth offset (default: -)
    tri_mode    MCF triangulation mode:
                  0: filled triangular mesh
                  1: Delaunay triangulation (default)
    unw_mask1   mask file to specify unwrap region rather than using a mask generated using cc_thres and pwr_thres
                parameters (enter - for none) (Sun raster or BMP format)
    roff        offset to starting range of region to unwrap (default: 0)
    loff        offset to starting line of region to unwrap (default: 0)
    nr          number of range samples of region to unwrap (default(-): width - roff)
    nlines      number of lines of region to unwrap (default(-): total number of lines - loff)
   
    -b rmli_dir  (option) use MLI2 as the background image for display rather than MLI image specified on the command line
    -d diff_tab (option) output a DIFF_tab file containing 2 column list of unwrapped diff. interferograms and delta_T values in decimal days
    -n          (option) generate DIFF_tab only, no interferometric processing
    -s scale    (option) set image display scale factor (default: 0.7)  
    -e exp      (option) set image display exponent (default: 0.35)
    -p pscale   (option) set phase scaling for output display, 1 cycle = 2PI/pscale (default: 0.5)
    -m mask     (option) mask to apply to the unwrapped phase (Sun raster or BMP format)

This script unwraps the phase of the differential interferograms and is run after generating the interferograms and possibly filtering using mk_adf_2d. The script will either unwrap the *.diff or *.adf.diff files depending on the value of the mode command line parameter:  0: unwrap unfiltered data  1: unwrap adf filtered data. The directory containing the differential interferograms is specified  by the diff_dir parameter. The RSLC_tab and itab files are required to determine the names of the differential interferogram files.

The ISP program mcf is used to perform the unwrapping using the minimum cost-flow algorithm. One input is an unwrapping mask. This mask in the script is calculated by the ISP program rascc_mask that uses the correlation coefficient and relative intensity as separate criteria for unwrapping. If the correlation coefficient is above cc_thres and the relative intensity above pwr_thres, then the current pixel will be unwrapped. Entering 0 for pwr_thres and cc_thres unwraps the entire scene. The relative power intensity is calculated relative to the average scene intensity in the MLI reference image entered as the rmli parameter.

One of the features of mk_unw_2d is that the user can specify that the unwrapping is performed by partitioning the image into patches in order to use less system resources. The number of patches in range and azimuth (npat_r and npat_az) are passed to mcf directly. Patching can lead to phase discontinuities in noisy interferograms and a useful alternative is to unwrap a smaller interferogram that has been averaged in range and azimuth by the parameter nlks using the LAT program reallks. Setting nlks to 1 means that no averaging is performed and is usually preferred if the computer has sufficent memory to handle the interferogram. The amount of memory required is dependent on the number of points. A image of 5000x5000 that is completely filled requires approximately 6 GB of memory if no averaging is performed.  Unwrapping the smaller averaged interferogram has the advantages that the interferogram is smaller and because it has been averaged, there is generally less phase noise. The smaller unwrapped interferogram is then restored to its original dimensions using reallks that has the ability both to decimate and interpolate images. The interpolated image is used as phase model to unwrap the original interferogram at full resolution using the program unw_model.

The starting pixel coordinates for unwrapping the interferogram are specified by the r_init and az_init that 0 by default.

The method for triangulation of the points used by mcf can be specified to be either Delauney triangulation or a filled rectangular mesh by setting the tri_mode parameter to 0 or 1. 

Instead of setting the unwrapping mask using thresholds set by the pwr_thres and cc_thres parameters, it is possible to specify a unw_mask file  on the command line. This file must be 8-bit Sun Raster format (without run-length encoding!).  Areas to masked out must be set to 0. The GIMP graphic editing program can be used to  editing one of the raster differential interferogram raster files to serve as a unwrapping mask file. 

Alternately it is possible to mask the data after unwrapping using the
-m mask option. In this case the the mask file in BMP or Sun raster format is applied to the unwrapped data after running mcf . Often the phase unwrapping results are better when the entire scene is unwrapped without masking and the masking operation is applied to the unwrapped data. Masking before unwrapping can create residues that lead to incorrect unwrapping.

Raster image files are calculated for the unwrapped phase using the program rasrmg.
The relative intensity scale factor option -s  and exponent option -e are used to set the brightness and contrast of the BMP raster format images produced by the script.  These options are followed by the specified values for these parameters. The phase display scale parameter -p  <value> determines the number of 2pi phase cycles per color cycle. Setting the -p value to 0.5 results in a display of 4pi/cycle.

The unwrapped phase generated by
mk_unw_2d can be used as input to the IPTA program mb and DIFF program stacking. These programs require a list of the unwrapped phase files and in the case of stacking, the time interval in days between the acquisitions.  mk_unw_2d permits creating a DIFF_tab file by using the -d option followed by the name of the DIFF_tab file.  If this is combined with a -n option, then no processing of data is performed and only the DIFF_tab is created. This can be useful if processing has already been completed and only the DIFF_tab is required.

The -b option permits using the actual MLI images of the second SLC as the background image. For this reason the directory containing these MLI images must be provided

mk_base_2d

*** ./mk_base_2d
*** Copyright 2015, Gamma Remote Sensing, v2.5 10-Apr-2015 clw ***
*** Estimate precision baselines from unwrapped phase and DEM in range-Doppler coordinates  ***

usage: ./mk_base_2d <RSLC_tab> <itab> <DEM_rdc> <diff_dir> <pbase> [mask] [nr] [naz] [gcp_win] [type]

    RSLC_tab  (input) two column list of resampled SLC filenames and SLC parameter filenames (including paths) (ascii)
                1. SLC filename  (includes path)
                2. SLC parameter filename (includes path)
    itab      (input) table associating interferogram stack records with pairs of SLC stack records (ascii)
                1. row number in SLC_tab of the reference SLC
                2. row number in SLC_tab of SLC-2 of the interferogram
                3. line number in the itab
                4. flag used to indicate if this interferogram is used for IPTA processing (0:not used  1:used)
    DEM_rdc   (input) terrain height in radar range-Doppler coordinates (meters, float format)  
    diff_dir  directory containing unwrapped differential interferograms and baselines 
    pbase     (output) baseline parameter stack (enter - for none)
    mask      (input) mask for selection of valid GCPs (Sun raster or BMP format, enter - for none)
    nr        number of GCP selection points in range
    naz       number of GCP selection points in azimuth
    gcp_win   window size for averaging unwrapped phase, must be odd (default = 3)
    type      differential interferogram type:
                 0: unfiltered differential interferogram (*.unw)
                 1: (default) adf filtered differential interferogram (*.adf.unw)

This script calls the ISP program base_ls for each interferogram defined by the itab file to generate an improved baseline estimate.  base_ls uses the phase of the unwrapped interferogram and DEM heights for a set of points selected on a grid to determine the polynomial coefficients of the baseline using minumum least-squares estimation (MLSE). The number of points on the grid are determined from the nr and nz parameters. The size of the square window around each point is specified by the gcp_win parameter.  The unwrapped interferograms can be either derived from the unfiltered or adf filtered interferograms by specifying the interferogram type parameter.

The user has the option to specify a mask file  that excludes regions of deformation for GCPs. This raster file must be set to 0 for those regions to be excluded. The 8-bit SUN raster format mask file can be created using the GIMP image editor.  Not masking out regions with significant deformation leads to an inaccurate baseline and distortion of the deformation signal by the topographic phase model derived from the baseline.

Once the precision baselines for the stack of interferograms has been determined the next step is usually to generate a new set of differential interferograms now using the precision baselines. To do this first create a new directory to store the new set of interferograms.  Assume that the first set of differential interferograms that use the initial basesline are in the directory diff0_2d, then:

#improve baselines using GCPs, use scene_mask.ras as the mask for excluding GCPs
mk_base_2d
RSLC_tab itab geo/scene_dem_rdc diff0_2d - scene_mask.ras 32 32 3 1

#create new directory to contain differential interferograms from the improved baseline
mkdir diff1_2d

#copy baseline files from diff0_2d to diff1_2d. These baseline files contain both the initial and improved baseline models
cp diff0_2d/*.base diff1_2d

#generate new set of differential interferograms using improved baselines calculated using mk_base_2d
mk_diff_2d RSLC_tab itab 1 geo/scene_dem.rdc - rmli_2_10/scene_ave.rmli rmli_2_10 diff0_2d 2 10

mk_hgt_2d

*** /Users/cw/gamma_software/DIFF/scripts/mk_hgt_2d
*** Copyright 2013, Gamma Remote Sensing, v1.4 19-Jul-2013 clw ***
*** Calculate height maps from a stack of unwrapped differential interferograms ***

usage: /Users/cw/gamma_software/DIFF/scripts/mk_hgt_2d <RSLC_tab> <itab> <mli> <diff_dir> [type] [m/cycle]

    RSLC_tab  (input) two column list of resampled SLC filenames and SLC parameter filenames (including paths) (ascii)
                1. SLC filename  (includes path)
                2. SLC parameter filename (includes path)
    itab      (input) table associating interferogram stack records with pairs of SLC stack records (ascii)
                1. row number in SLC_tab of the reference SLC
                2. row number in SLC_tab of SLC-2 of the interferogram
                3. line number in the itab
                4. flag used to indicate if this interferogram is used for IPTA processing (0:not used  1:used)
    mli       (input) MLI image file with same range and azimuth looks as the interferogram (float)
    diff_dir  differential interferogram directory    
    type      unwrapped differential interferogram type:
                0: unfiltered differential interferogram (*.unw)
            1: (default) adf filtered differential interferogram (*.adf.unw)
    m/cycle   meters per color cycle (default=100.)
    -s scale  (option) set image display scale factor (default: 0.7)  
    -e exp    (option) set image display exponent (default: 0.35)      

This script calculates a set of DEMS in slant-range coordinates using the unwrapped phase and updated baselines. It applies the ISP program hgt_map to each unwrapped interferogram in the stack. The Sun raster images of the individual height maps are displayed with color cycle set by the m/cycle parameter. The relative intensity scale factor parameter -s value and exponent -e value are used to set the brightness and contrast of the Sun raster format images produced by the script using program rashgt.

mk_quad_2d

*** ./mk_quad_2d
*** Copyright 2015, Gamma Remote Sensing, v1.8 10-Apr-2015 clw ***
*** Estimate and subtract quadratic polynomial phase model from a stack of differential interferograms ***

usage: ./mk_quad_2d <SLC_tab> <itab> <mli> <diff_dir1> <diff_dir2> <unw_type> <model> <mode> <roff> <loff> [nr] [nl] [mask] [dr] [daz]

    SLC_tab    (input) two column list of co-registered SLC filenames and SLC parameter filenames
                  1. SLC filename  (includes path)
             2. SLC parameter filename (includes path)
    itab       (input) table associating interferogram stack records with pairs of RSLC_tab records (text)        
                  1. row number in SLC_tab of the reference SLC
                  2. row number in SLC_tab of SLC-2 of the interferogram
                  3. line number in the itab
                  4. flag used to indicate if this interferogram is used for IPTA processing (0:not used  1:used)
    mli        (input) MLI image file with same range and azimuth looks as the interferogram (float)
    diff_dir1  input directory containing input differential interferograms
    diff_dir2  output directory containing detrended differential interferograms
    unw_type   unwrapped phase data used for L.S. model fit:
                 0: unwrapped phase (*.diff.unw)
                 1: unwrapped phase with adf filter (*.adf.diff.unw)
    model      polynomial phase model:
                 0: a0 + a1*y + a2*x + a3*x*y + a4*x^2 + a5*y^2 (default)
                 1: a0 + a4*x^2 + a5*y^2
                 2: a0 + a1*y + a2*x + a3*x*y
                 3: a0 + a1*y + a2*x
                 4: a0 + a2*x + a4*x^2
                 5: a0 + a2*x
    mode       processing mode:
                 0: subtract the phase model from the fcomplex differential interferogram (default)
                 1: subtract the phase model from the unwrapped interferogram
    roff       offset to starting sample for the reference region (samples)
    loff       offset to starting line (lines)
    nr         number of range samples for the reference region (enter - for default: 3)
    nl         number of lines to copy (enter - for default: 3)
    mask       raster mask file (Sun raster or BMP), 0 valued pixels are excluded from the L.S. fit (enter - for none)
    dr         range sample increment for fit values (default: 1)
    daz        azimuth line increment (default: 1)

    -b rmli_dir (option) use MLI2 as the background image for display rather than MLI image specified on the command line
    -d diff_tab (option) output a DIFF_tab file containing 2 column list of unwrapped diff. interferograms and delta_T values in decimal days
    -p pcycle   (option) set phase cycle for output display,  (default: 6.28318530718)
    -s scale  (option) set image display scale factor (default: 0.7)  
    -e exp    (option) set image display exponent (default: 0.35)                         

This script calculates a 2D polynomial phase trend in the unwrapped phase and subtracts this trend from the complex differential interferograms in the stack.  This approach is sometimes necessary to remove residual phase trends. These trends can be due to processing of long tracks where the  linear baseline polynomial is insufficient to model the  orbital phase trends.  The  unwrapped phase  has either been filtered with  mk_adf_2d (*.adf.unw) or not (*.diff.unw).  The script can be set to estimate the 2D polynomial parameters of the phase model by setting the mode parameter to 0.  In this case the program quad_fit is applied to each differential interferogram to calculate the polynomial coefficients. These coefficients are stored in the DIFF_par associated with each differential interferogram.

The program quad_sub then calculates the unwrapped phase values of the model and subtracts this phase from the differential interferogram.  The user can select the differential interferogram type, either the complex interferogram (mode: 0) or unwrapped phase (mode: 1).

The relative intensity scale factor parameter -s value and exponent -e value are used to set the brightness and contrast raster bitmap images produced by the script using program rasmph_pwr or rasdt_pwr24. When applying quad_fit to unwrapped phase interferograms the color cycle parameter for the display program rasdt_pwr24 can specified using the -p pcycle option. By default the value of the pcycle parameter is 2PI.

Processing Example

This is an example of processing a single interferometric pair using the SLC_resamp_lt_all and mk_diff_2d set of scripts. Input is 2 SLC files from the ERS-2 instrument that show the deformation from the Hector Mine earthquake in 1999. The SLC images are coregistered using the DEM resampled to slant-range coordinates using the geocode program called by mk_geo. The baseline was not improved using mk_base_2d because the deformation field from the earthquake covered the entire frame.


###### resampling using a lookup table and DEM in radar coordinates ######
#mode 0: generate lookup table and resample MLI-1 image into the geometry of MLI-2

SLC_resamp_lt_all SLC_tab slc/19990915.slc slc/19990915.slc.par mli_2_10/19990915.mli.par geo/hector_dem.rdc mli_2_10 rslc RSLC_tab 0

cp slc/19990915.slc rslc/19990915.rslc

rdc_trans mli_2_10/19990915.mli.par geo/hector_dem.rdc mli_2_10/19991020.mli.par rslc/19990915_19991020.lt0

geocode rslc/19990915_19991020.lt0 mli_2_10//19990915.mli 2456 rslc/19990915_lt0.mli 2456 2886 2 0 - - 4

raspwr rslc/19990915_lt0.mli 2456 1 0 1 1 0.6 0.4


#mode 1: refine lookup table based on measured offsets between MLI-1 resampled to the geometry of MLI-2
#refine lookup table based on measured offsets between MLI-1 resampled to the geometry of MLI-2
SLC_resamp_lt_all SLC_tab slc/19990915.slc slc/19990915.slc.par mli_2_10/19990915.mli.par geo/hector_dem.rdc mli_2_10 rslc RSLC_tab

#init_offsetm rslc/19990915_lt0.mli mli_2_10/19991020.mli rslc/19990915_19991020_lt0.diff_par 1 1 1228 1343
#offset_pwrm rslc/19990915_lt0.mli mli_2_10/19991020.mli rslc/19990915_19991020_lt0.diff_par rslc/19990915_19991020_lt0.offs rslc/19990915_19991020_lt0.snr
#offset_fitm rslc/19990915_19991020_lt0.offs rslc/19990915_19991020_lt0.snr rslc/19990915_19991020_lt0.diff_par rslc/19990915_19991020_lt0.coffs -  3
#gc_map_fine rslc/19990915_19991020.lt0 2456 rslc/19990915_19991020_lt0.diff_par rslc/19990915_19991020.lt1

#mode 2: resample SLC-2 to the geometry of the reference SLC using lookup table
SLC_resamp_lt_all SLC_tab slc/19990915.slc slc/19990915.slc.par mli_2_10/19990915.mli.par geo/hector_dem.rdc mli_2_10 rslc RSLC_tab 2

SLC_interp_lt slc/19991020.slc slc/19990915.slc.par slc/19991020.slc.par rslc/19990915_19991020.lt1 mli_2_10/19990915.mli.par mli_2_10/19991020.mli.par - rslc/19991020.rslc rslc/19991020.rslc.par


#mode 3:  create offset parameter files for SLC resampling refinement, measure offsets, and calculate the SLC offset fit polynomials
SLC_resamp_lt_all SLC_tab slc/19990915.slc slc/19990915.slc.par mli_2_10/19990915.mli.par geo/hector_dem.rdc mli_2_10 rslc RSLC_tab 3

create_offset rslc/19990915.rslc.par rslc/19991020.rslc.par rslc/19990915_19991020.off < create_offset.in

offset_pwr rslc/19990915.rslc rslc/19991020.rslc rslc/19990915.rslc.par rslc/19991020.rslc.par rslc/19990915_19991020.off rslc/19990915_19991020.offs rslc/19990915_19991020.snr

offset_fit rslc/19990915_19991020.offs rslc/19990915_19991020.snr rslc/19990915_19991020.off rslc/19990915_19991020.coffs - - 3

#mode 4: resample SLC images using lookup table offsets determined in mode 3 and generate RSLC_tab 
SLC_resamp_lt_all SLC_tab slc/19990915.slc slc/19990915.slc.par mli_2_10/19990915.mli.par geo/hector_dem.rdc mli_2_10 rslc RSLC_tab 4

SLC_interp_lt slc/19991020.slc rslc/19990915.rslc.par slc/19991020.slc.par rslc/19990915_19991020.lt1 mli_2_10/19990915.mli.par mli_2_10/19991020.mli.par rslc/19990915_19991020.off rslc/19991020.rslc rslc/19991020.rslc.par

create_offset rslc/19990915.rslc.par rslc/19991020.rslc.par rslc/19990915_19991020_2.off < create_offset.in

offset_pwr rslc/19990915.rslc rslc/19991020.rslc rslc/19990915.rslc.par rslc/19991020.rslc.par rslc/19990915_19991020_2.off rslc/19990915_19991020_2.offs rslc/19990915_19991020_2.snr

offset_fit rslc/19990915_19991020_2.offs rslc/19990915_19991020_2.snr rslc/19990915_19991020_2.off rslc/19990915_19991020_2.coffs - - 3
residual offset polynomials 1:

#range_offset_polynomial: 0.02029 -2.7001e-06 -4.1267e-07 0.0000e+00 0.0000e+00 0.0000e+00
#azimuth_offset_polynomial: 0.01604 4.3426e-09 -1.0120e-06 0.0000e+00 0.0000e+00 0.0000e+00

########
$ mk_tab rslc rslc rslc.par RSLC_tab
RSLC_tab:
rslc/19990915.rslc    rslc/19990915.rslc.par
rslc/19991020.rslc    rslc/19991020.rslc.par

#make multilook image of resample MLI scenes
mk_mli_all RSLC_tab rmli_2_10 2 10 1
display rmli_2_10/rmli_2_10.ave.ras

#estimate baseline to generate itab file

$ base_calc RSLC_tab rslc/19990915.rslc.par hector.bperp itab 0 1

./base_calc processing started: Tue May 24 11:07:31 2011
SLC_tab table SLC images and parameter files: RSLC_tab
reference SLC parameter file: rslc/19990915.rslc.par
bperp textfile:    hector.bperp
output itab file:  itab
itab generation mode: single SLC reference scene
minimum bperp magnitude (m): 1
reference frame date: 1999 9 15
reference sensor: ERS2

reference SLC start time (s): 66323.94287
reference SLC MJD: 2451437.76764
  1  ref.: 19990915  19990915  Bperp:   -0.0000  delta_T:     0.00000
  2  ref.: 19990915  19991020  Bperp:  -20.8284  delta_T:    35.00001


##### generate differential interferogram
mk_diff_2d RSLC_tab itab 0 geo/hector_dem.rdc - rmli_2_10/rmli_2_10.ave rmli_2_10 diff0_2d 2 10

#commands generated by mk_diff_2d
phase_sim rslc/19990915.rslc.par diff0_2d/19990915_19991020.off diff0_2d/19990915_19991020.base geo/hector_dem.rdc diff0_2d/19990915_19991020.sim_unw 0 0 - 35


SLC_diff_intf rslc/19990915.rslc rslc/19991020.rslc rslc/19990915.rslc.par rslc/19991020.rslc.par diff0_2d/19990915_19991020.off diff0_2d/19990915_19991020.sim_unw diff0_2d/19990915_19991020.diff 2 10 1
 
rasmph_pwr diff0_2d/19990915_19991020.diff rmli_2_10/hector_ave.rmli 2456 1 1 0 1 1 0.7 0.35

cc_wave diff0_2d/19990915_19991020.diff rmli_2_10/19990915.rmli rmli_2_10/19991020.rmli diff0_2d/19990915_19991020.cc 2456 5 5 1

rascc diff0_2d/19990915_19991020.cc rmli_2_10/hector_ave.rmli 2456 1 1 0  1 1 .1 .9 0.7 0.35

####### filter interferogram with adf
mk_adf_2d RSLC_tab itab rmli_2_10/hector_ave.rmli diff0_2d 3 .4 16 4

adf diff0_2d/19990915_19991020.diff diff0_2d/19990915_19991020.adf.diff diff0_2d/19990915_19991020.adf.cc 2456 .4 16 3 2 0 0 .2

rasmph_pwr diff0_2d/19990915_19991020.adf.diff rmli_2_10/hector_ave.rmli 2456 1 1 0 1 1 1.0 .35

rascc   diff0_2d/19990915_19991020.adf.cc rmli_2_10/hector_ave.rmli 2456 1 1 0 1 1 0.1 0.9 0.7 0.35

dis2ras 19990915_19991020.adf.diff.ras 19990915_19991020.diff.ras

####### unwrap the phase
mk_unw_2d RSLC_tab itab rmli_2_10/hector_ave.rmli diff0_2d 0.7 0 1 1 1 1 100 100 0 -d diff_tab

rascc_mask diff0_2d/19990915_19991020.adf.cc rmli_2_10/hector_ave.rmli 2456 1 1 0 1 1 0.7 0 .3 1.0 0.7 0.35 1 diff0_2d/19990915_19991020.adf.cc_mask.ras

#unwrap the phase using minimum cost flow
mcf diff0_2d/19990915_19991020.adf.diff diff0_2d/19990915_19991020.adf.cc diff0_2d/19990915_19991020.adf.cc_mask.ras diff0_2d/19990915_19991020.adf.unw #2456 0 0 0 2456 2687 1 1 128 100 100 1


#########
#positive phase means motion along the LOS is away from the radar
disrmg diff0_2d/19990915_19991020.adf.unw rmli_2_10/rmli_2_10.ave 2456 1 1 0  .02

#generate JPG format image of the filtered interferogram and SAR image into geographic coordinates
create_dem_par geo/hector_eqa_seg.dem_par rmli_2_10/19990915.rmli.par 0. -.0004 .0004

#terrain geocode the filtered interferogram into UTM
mk_geo_data rmli_2_10/19990915.rmli.par geo/hector_utm_seg.dem_par geo/hector_1.map_to_rdc diff0_2d/19990915_19991020.adf.diff diff0_2d/19990915_19991020_utm.adf.diff 3 1 diff0_2d/mk_geo_data.log

#generate terrain geocoded raster image of the filtered differential interferogram
rasmph_pwr24 diff0_2d/19990915_19991020_utm.adf.diff geo/hector_map.mli 3016 1 1 0

#display interactively
disras_dem_par diff0_2d/19990915_19991020_utm.adf.diff.ras geo/hector_utm_seg.dem_par&

eog diff0_2d/19990915_19991020_utm.adf.diff.ras

#convert the MLI image into EQA
map_trans geo/hector_utm_seg.dem_par geo/hector_map.mli geo/hector_eqa_seg.dem_par geo/hector_eqa.mli 1 1 2 0

#generate raster image and display
raspwr geo/hector_eqa.mli 3800 1 0 1 1 .7 .4
eog geo/hector_eqa.mli.ras

#convert differential phase from UTM to EQA geographic coordinates
map_trans geo/hector_utm_seg.dem_par diff0_2d/19990915_19991020_utm.adf.diff geo/hector_eqa_seg.dem_par diff0_2d/19990915_19991020_eqa.adf.diff 1 1 3 1

rasmph_pwr24 diff0_2d/19990915_19991020_eqa.adf.diff geo/hector_eqa.mli 3800 1 1 0

eog diff0_2d/19990915_19991020_eqa.adf.diff.ras

#convert to JPEG format, Imagemagick convert utility
convert diff0_2d/19990915_19991020_eqa.adf.diff.ras geo/19990915_19991020_eqa.adf.diff.jpg

#generate kml file
cd geo
mk_kml hector_eqa_seg.dem_par 19990915_19991020_eqa.adf.diff.jpg hector.kml

#run google earth and display the differential interferogram in map coordiantes
googleearth hector.kml



Copyright for Documentation, Users Guide and Reference Manual by Gamma Remote Sensing, 2015. CW,
last change 10-Apr-2015 clw.