extractCommonValidRegion: check stack/*.xml file existance
Otherwise, if 'stack' folder exists but is empty, the script will return ERROR as below:
```
/net/kraken/nobak/zyunjun/TonopahSenAT64/stack already exists.
Replacing master with existing stack.
updating the valid overlap region of:
/net/kraken/nobak/zyunjun/TonopahSenAT64/stack
******************
swath: 1
Traceback (most recent call last):
File "/home/zyunjun/tools/isce2/contrib/stack/topsStack/extractCommonValidRegion.py", line 109, in <module>
main()
File "/home/zyunjun/tools/isce2/contrib/stack/topsStack/extractCommonValidRegion.py", line 95, in main
topMaster = ut.loadProduct(os.path.join(inps.master , 'IW{0}.xml'.format(swath)))
File "/home/zyunjun/tools/isce2/contrib/stack/topsStack/s1a_isce_utils.py", line 26, in loadProduct
obj = pm.loadProduct(xmlname)
File "/net/kraken/home1/geomod/apps/rhel7/isce2-github/isce/components/iscesys/Component/ProductManager.py", line 25, in loadProduct
self.load(filename)
File "/net/kraken/home1/geomod/apps/rhel7/isce2-github/isce/components/iscesys/Component/Configurable.py", line 1407, in load
tmpProp, tmpFact, tmpMisc = FP.parse(filename)
File "/net/kraken/home1/geomod/apps/rhel7/isce2-github/isce/components/iscesys/Parsers/XmlParser.py", line 41, in parse
root = ET.parse(filename)
File "/net/kraken/home1/geomod/apps/anaconda3/lib/python3.7/xml/etree/ElementTree.py", line 1197, in parse
tree.parse(source, parser)
File "/net/kraken/home1/geomod/apps/anaconda3/lib/python3.7/xml/etree/ElementTree.py", line 587, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/net/kraken/nobak/zyunjun/TonopahSenAT64/stack/IW1.xml'
```
LT1AB
parent
eadacbdf7a
commit
89839bc453
|
|
@ -2,16 +2,17 @@
|
||||||
|
|
||||||
#Author: Heresh Fattahi
|
#Author: Heresh Fattahi
|
||||||
|
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
import glob
|
||||||
|
import numpy as np
|
||||||
|
import gdal
|
||||||
import isce
|
import isce
|
||||||
import isceobj
|
import isceobj
|
||||||
import numpy as np
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
from isceobj.Sensor.TOPS import createTOPSSwathSLCProduct
|
from isceobj.Sensor.TOPS import createTOPSSwathSLCProduct
|
||||||
from mroipac.correlation.correlation import Correlation
|
from mroipac.correlation.correlation import Correlation
|
||||||
import s1a_isce_utils as ut
|
import s1a_isce_utils as ut
|
||||||
import gdal
|
|
||||||
import glob
|
|
||||||
|
|
||||||
def createParser():
|
def createParser():
|
||||||
parser = argparse.ArgumentParser( description='Extract valid overlap region for the stack')
|
parser = argparse.ArgumentParser( description='Extract valid overlap region for the stack')
|
||||||
|
|
@ -76,7 +77,7 @@ def main(iargs=None):
|
||||||
if not os.path.exists(stackDir):
|
if not os.path.exists(stackDir):
|
||||||
print('creating ', stackDir)
|
print('creating ', stackDir)
|
||||||
os.makedirs(stackDir)
|
os.makedirs(stackDir)
|
||||||
else:
|
elif len(glob.glob(os.path.join(stackDir, '*.xml'))) > 0:
|
||||||
print(stackDir , ' already exists.')
|
print(stackDir , ' already exists.')
|
||||||
print('Replacing reference with existing stack.')
|
print('Replacing reference with existing stack.')
|
||||||
inps.reference = stackDir
|
inps.reference = stackDir
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue