Skip to content

Commit

Permalink
Merge pull request #643 from yunjunz/arg_group
Browse files Browse the repository at this point in the history
stackSentinel: group arguments + bugfix
  • Loading branch information
rtburns-jpl authored Apr 18, 2023
2 parents 3a05a83 + 734c2dc commit 65f1770
Show file tree
Hide file tree
Showing 6 changed files with 248 additions and 244 deletions.
17 changes: 10 additions & 7 deletions contrib/stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To use a stack processor you need to:

The stack processors do not show up in the install directory of your isce software. They can be found in the isce source directory. Thus, extra path setup is needed.

2.1 Add the following path to your `${PYTHON_PATH}` environment vavriable:
2.1 Add the following path to your `${PYTHONPATH}` environment vavriable:

```bash
export ISCE_STACK={full_path_to_your_contrib/stack}
Expand Down Expand Up @@ -53,24 +53,27 @@ Users who use the stack processors may refer to the following literatures:

For TOPS stack processing:

+ H. Fattahi, P. Agram, and M. Simons, “A network-based enhanced spectral diversity approach for TOPS time-series analysis,” IEEE Trans. Geosci. Remote Sens., vol. 55, no. 2, pp. 777–786, Feb. 2017. (https://ieeexplore.ieee.org/abstract/document/7637021/)
+ Fattahi, H., Agram, P., & Simons, M. (2017). A Network-Based Enhanced Spectral Diversity Approach for TOPS Time-Series Analysis. _IEEE Trans. Geosci. Remote Sens., 55_(2), 777-786, doi: [10.1109/TGRS.2016.2614925](https://doi.org/10.1109/TGRS.2016.2614925)

1. Ionospheric correction

+ Liang, C., Agram, P., Simons, M., & Fielding, E. J. (2019). Ionospheric Correction of InSAR Time Series Analysis of C-band Sentinel-1 TOPS Data. _IEEE Trans. Geosci. Remote Sens., 59_(9), 6755-6773, doi: [10.1109/TGRS.2019.2908494](https://doi.org/10.1109/TGRS.2019.2908494).

For StripMap stack processor and ionospheric phase estimation:

+ H. Fattahi, M. Simons, and P. Agram, "InSAR Time-Series Estimation of the Ionospheric Phase Delay: An Extension of the Split Range-Spectrum Technique", IEEE Trans. Geosci. Remote Sens., vol. 55, no. 10, 5984-5996, 2017. (https://ieeexplore.ieee.org/abstract/document/7987747/)
+ Fattahi, H., Simons, M., & Agram, P. (2017). InSAR Time-Series Estimation of the Ionospheric Phase Delay: An Extension of the Split Range-Spectrum Technique. _IEEE Trans. Geosci. Remote Sens., 55_(10), 5984-5996, doi: [10.1109/TGRS.2017.2718566](https://doi.org/10.1109/TGRS.2017.2718566)

For ALOS and ALOS-2 stack processing:

1. ScanSAR or multi-mode InSAR processing

+ C. Liang and E. J. Fielding, "Interferometry with ALOS-2 full-aperture ScanSAR data," IEEE Transactions on Geoscience and Remote Sensing, vol. 55, no. 5, pp. 2739-2750, May 2017.
+ Liang, C., & Fielding, E. J. (2017). Interferometry With ALOS-2 Full-Aperture ScanSAR Data. _IEEE Trans. Geosci. Remote Sens., 55_(5), 2739-2750, doi: [10.1109/TGRS.2017.2653190](https://doi.org/10.1109/TGRS.2017.2653190)

2. Ionospheric correction, burst-by-burst ScanSAR processing, and burst-mode spectral diversity (SD) or
multi-aperture InSAR (MAI) processing

+ C. Liang and E. J. Fielding, "Measuring azimuth deformation with L-band ALOS-2 ScanSAR interferometry," IEEE Transactions on Geoscience and Remote Sensing, vol. 55, no. 5, pp. 2725-2738, May 2017.
+ Liang, C., & Fielding, E. J. (2017). Measuring Azimuth Deformation With L-Band ALOS-2 ScanSAR Interferometry. _IEEE Trans. Geosci. Remote Sens., 55_(5), 2725-2738, doi: [10.1109/TGRS.2017.2653186](https://doi.org/10.1109/TGRS.2017.2653186)

3. Ionospheric correction

+ C. Liang, Z. Liu, E. J. Fielding, and R. Bürgmann, "InSAR time series analysis of L-band wide-swath SAR data acquired by ALOS-2," IEEE Transactions on Geoscience and Remote Sensing, vol. 56, no. 8, pp. 4492-4506, Aug. 2018.

+ Liang, C., Liu, Z., Fielding, E. J., & Bürgmann, R. (2018). InSAR Time Series Analysis of L-Band Wide-Swath SAR Data Acquired by ALOS-2. _IEEE Trans. Geosci. Remote Sens., 56_(8), 4492-4506, doi: [10.1109/TGRS.2018.2821150](https://doi.org/10.1109/TGRS.2018.2821150)
4 changes: 2 additions & 2 deletions contrib/stack/topsStack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ In all workflows, coregistration (-C option) can be done using only geometry (se

The following calibration auxliary (AUX_CAL) file is used for **antenna pattern correction** to compensate the range phase offset of SAFE products with **IPF verison 002.36** (mainly for images acquired before March 2015). If all your SAFE products are from another IPF version, then no AUX files are needed. Check [ESA document](https://earth.esa.int/documents/247904/1653440/Sentinel-1-IPF_EAP_Phase_correction) for details.

Run the command below to download the AUX_CAL file once and store it somewhere (_i.e._ ~/aux/aux_cal) so that you can use it all the time, for `stackSentinel.py -a` or `auxiliary data directory` in `topsApp.py`.
The AUX_CAL file is available on [Sentinel-1 Mission Performance Center](https://sar-mpc.eu/ipf-adf/aux_cal/?sentinel1__mission=S1A&validity_start=2014&validity_start=2014-09&adf__active=True). We recommend download it using the web brower or the `wget` command below, and store it somewhere (_i.e._ ~/aux/aux_cal) so that you can use it all the time, for `stackSentinel.py -a` or `auxiliary data directory` in `topsApp.py`.

```
wget https://qc.sentinel1.groupcls.com/product/S1A/AUX_CAL/2014/09/08/S1A_AUX_CAL_V20140908T000000_G20190626T100201.SAFE.TGZ
wget https://sar-mpc.eu/download/ca97845e-1314-4817-91d8-f39afbeff74d/ -O S1A_AUX_CAL_V20140908T000000_G20190626T100201.SAFE.zip
```

#### 1. Create your project folder somewhere ####
Expand Down
77 changes: 34 additions & 43 deletions contrib/stack/topsStack/generateIgram.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
# Author: Piyush Agram
# Heresh Fattahi: Adopted for stack

import os
import argparse
import copy
import numpy as np
from osgeo import gdal

import isce
import isceobj
import numpy as np
from isceobj.Util.Poly2D import Poly2D
import argparse
import os
import copy
from isceobj.Sensor.TOPS import createTOPSSwathSLCProduct
from mroipac.correlation.correlation import Correlation
import s1a_isce_utils as ut
from osgeo import gdal


def createParser():
Expand Down Expand Up @@ -49,25 +50,24 @@ def cmdLineParse(iargs = None):
return parser.parse_args(args=iargs)


def multiply(masname, slvname, outname, rngname1, rngname2, fact, referenceFrame,
flatten=False):
def multiply(referencename, secondaryname, outname, rngname1, rngname2, fact, referenceFrame, flatten=False):

print('multiply')
masImg = isceobj.createSlcImage()
masImg.load( masname + '.xml')
referenceImg = isceobj.createSlcImage()
referenceImg.load(referencename + '.xml')

width = masImg.getWidth()
length = masImg.getLength()
width = referenceImg.getWidth()
length = referenceImg.getLength()

ds = gdal.Open(masname + '.vrt', gdal.GA_ReadOnly)
ds = gdal.Open(referencename + '.vrt', gdal.GA_ReadOnly)
reference = ds.GetRasterBand(1).ReadAsArray()
ds = None
ds = gdal.Open(slvname + '.vrt', gdal.GA_ReadOnly)
ds = gdal.Open(secondaryname + '.vrt', gdal.GA_ReadOnly)
secondary = ds.GetRasterBand(1).ReadAsArray()
ds = None
print('read')
#reference = np.memmap(masname, dtype=np.complex64, mode='r', shape=(length,width))
#secondary = np.memmap(slvname, dtype=np.complex64, mode='r', shape=(length, width))
print('read')
#reference = np.memmap(referencename, dtype=np.complex64, mode='r', shape=(length,width))
#secondary = np.memmap(secondaryname, dtype=np.complex64, mode='r', shape=(length, width))

if os.path.exists(rngname1):
rng1 = np.memmap(rngname1, dtype=np.float32, mode='r', shape=(length,width))
Expand Down Expand Up @@ -137,7 +137,7 @@ def main(iargs=None):

os.makedirs(ifgdir, exist_ok=True)

####Load relevant products
####Load relevant products
if inps.overlap:
topReference = ut.loadProduct(os.path.join(inps.reference , 'overlap','IW{0}_top.xml'.format(swath)))
botReference = ut.loadProduct(os.path.join(inps.reference ,'overlap', 'IW{0}_bottom.xml'.format(swath)))
Expand Down Expand Up @@ -189,25 +189,21 @@ def main(iargs=None):
secondaryname = os.path.splitext(secondaryname)[0] + inps.secondary_suffix + os.path.splitext(secondaryname)[1]

if inps.overlap:
rdict = { 'rangeOff1' : os.path.join(inps.reference, 'overlap', IWstr, 'range_top_%02d_%02d.off'%(ii,ii+1)),
'rangeOff2' : os.path.join(inps.secondary, 'overlap', IWstr, 'range_top_%02d_%02d.off'%(ii,ii+1)),
'azimuthOff': os.path.join(inps.secondary, 'overlap', IWstr, 'azimuth_top_%02d_%02d.off'%(ii,ii+1))}

rdict = {'rangeOff1' : os.path.join(inps.reference, 'overlap', IWstr, 'range_top_%02d_%02d.off'%(ii,ii+1)),
'rangeOff2' : os.path.join(inps.secondary, 'overlap', IWstr, 'range_top_%02d_%02d.off'%(ii,ii+1)),
'azimuthOff': os.path.join(inps.secondary, 'overlap', IWstr, 'azimuth_top_%02d_%02d.off'%(ii,ii+1))}
intname = os.path.join(ifgdir, '%s_top_%02d_%02d.int'%(inps.intprefix,ii,ii+1))

else:

rdict = {'rangeOff1' : os.path.join(inps.reference, IWstr, 'range_%02d.off'%(ii)),
'rangeOff2' : os.path.join(inps.secondary, IWstr, 'range_%02d.off'%(ii)),
'azimuthOff1': os.path.join(inps.secondary, IWstr, 'azimuth_%02d.off'%(ii))}

else:
rdict = {'rangeOff1' : os.path.join(inps.reference, IWstr, 'range_%02d.off'%(ii)),
'rangeOff2' : os.path.join(inps.secondary, IWstr, 'range_%02d.off'%(ii)),
'azimuthOff1': os.path.join(inps.secondary, IWstr, 'azimuth_%02d.off'%(ii))}
intname = os.path.join(ifgdir, '%s_%02d.int'%(inps.intprefix,ii))


ut.adjustCommonValidRegion(reference,secondary)
fact = 4 * np.pi * secondary.rangePixelSize / secondary.radarWavelength
intimage = multiply(referencename, secondaryname, intname,
rdict['rangeOff1'], rdict['rangeOff2'], fact, reference, flatten=inps.flatten)
rdict['rangeOff1'], rdict['rangeOff2'], fact, reference, flatten=inps.flatten)

burst = copy.deepcopy(reference)
burst.image = intimage
Expand All @@ -220,28 +216,24 @@ def main(iargs=None):
reference = botReference.bursts[ii-minReference]
secondary = botCoreg.bursts[ii-minSecondary]


referencename = reference.image.filename
referencename = reference.image.filename
secondaryname = secondary.image.filename
# rdict = {'rangeOff' : os.path.join(coregdir, 'range_bot_%02d_%02d.off'%(ii,ii+1)),
# 'azimuthOff': os.path.join(coregdir, 'azimuth_bot_%02d_%02d.off'%(ii,ii+1))}

rdict = { 'rangeOff1' : os.path.join(inps.reference, 'overlap', IWstr, 'range_bot_%02d_%02d.off'%(ii,ii+1)),
'rangeOff2' : os.path.join(inps.secondary, 'overlap', IWstr, 'range_bot_%02d_%02d.off'%(ii,ii+1)),
'azimuthOff': os.path.join(inps.secondary, 'overlap', IWstr, 'azimuth_bot_%02d_%02d.off'%(ii,ii+1))}

#rdict = {'rangeOff' : os.path.join(coregdir, 'range_bot_%02d_%02d.off'%(ii,ii+1)),
# 'azimuthOff': os.path.join(coregdir, 'azimuth_bot_%02d_%02d.off'%(ii,ii+1))}

rdict = {'rangeOff1' : os.path.join(inps.reference, 'overlap', IWstr, 'range_bot_%02d_%02d.off'%(ii,ii+1)),
'rangeOff2' : os.path.join(inps.secondary, 'overlap', IWstr, 'range_bot_%02d_%02d.off'%(ii,ii+1)),
'azimuthOff': os.path.join(inps.secondary, 'overlap', IWstr, 'azimuth_bot_%02d_%02d.off'%(ii,ii+1))}
print ('rdict: ', rdict)

ut.adjustCommonValidRegion(reference,secondary)
intname = os.path.join(ifgdir, '%s_bot_%02d_%02d.int'%(inps.intprefix,ii,ii+1))
fact = 4 * np.pi * secondary.rangePixelSize / secondary.radarWavelength

#intimage = multiply(referencename, secondaryname, intname,
# rdict['rangeOff'], fact, reference, flatten=True)

#intimage = multiply(referencename, secondaryname, intname,
# rdict['rangeOff'], fact, reference, flatten=True)
intimage = multiply(referencename, secondaryname, intname,
rdict['rangeOff1'], rdict['rangeOff2'], fact, reference, flatten=inps.flatten)
rdict['rangeOff1'], rdict['rangeOff2'], fact, reference, flatten=inps.flatten)

burst = copy.deepcopy(reference)
burst.burstNumber = ii
Expand All @@ -254,7 +246,6 @@ def main(iargs=None):
topIfg.reference = topCoreg.reference
else:
topIfg.reference = topReference.reference

print('Type: ',type(topIfg.reference))

if inps.overlap:
Expand Down
Loading

0 comments on commit 65f1770

Please sign in to comment.