Skip to content

Commit 02b7e68

Browse files
committed
Exit if suffix is not set
1 parent f3c7572 commit 02b7e68

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

bin/LiCSBAS11_check_unw.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
"""
3-
v1.3.1 20200911 Yu Morishita, GSI
3+
v1.3.2 20201116 Yu Morishita, GSI
44
55
========
66
Overview
@@ -44,6 +44,8 @@
4444
"""
4545
#%% Change log
4646
'''
47+
v1.3.2 20201116 Yu Morioshita, GSI
48+
- Exit if suffix is not set
4749
v1.3.1 20200911 Yu Morioshita, GSI
4850
- Change default to -c 0.05 -u 0.3
4951
v1.3 20200703 Yu Morioshita, GSI
@@ -83,7 +85,7 @@ def main(argv=None):
8385
argv = sys.argv
8486

8587
start = time.time()
86-
ver="1.3.1"; date=20200911; author="Y. Morishita"
88+
ver="1.3.2"; date=20201116; author="Y. Morishita"
8789
print("\n{} ver{} {} {}".format(os.path.basename(argv[0]), ver, date, author), flush=True)
8890
print("{} {}".format(os.path.basename(argv[0]), ' '.join(argv[1:])), flush=True)
8991

@@ -247,19 +249,28 @@ def main(argv=None):
247249
print('# unw_cov_thre: {0}, coh_thre: {1}'.format(unw_cov_thre, coh_thre), file=fstats)
248250
print('# ifg dates bperp dt unw_cov coh_av', file=fstats)
249251

250-
### Identify suffix of raster image (ras or bmp?)
252+
### Identify suffix of raster image (png, ras or bmp?)
251253
unwfile = os.path.join(ifgdir, ifgdates[0], ifgdates[0]+'.unw')
252254
if os.path.exists(unwfile+'.ras'):
253255
suffix = '.ras'
254256
elif os.path.exists(unwfile+'.bmp'):
255257
suffix = '.bmp'
256258
elif os.path.exists(unwfile+'.png'):
257259
suffix = '.png'
260+
else:
261+
print('\nERROR: No browse image available for {}!\n'
262+
.format(unwfile), file=sys.stderr)
263+
return 2
258264

259265
for i, ifgd in enumerate(ifgdates):
260266
rasname = ifgdates[i]+'.unw'+suffix
261267
rasorg = os.path.join(ifgdir, ifgdates[i], rasname)
262-
268+
269+
if not os.path.exists(rasorg):
270+
print('\nERROR: No browse image {} available!\n'
271+
.format(rasorg), file=sys.stderr)
272+
return 2
273+
263274
### Identify bad ifgs and link ras
264275
if rate_cov[i] < unw_cov_thre or coh_avg_ifg[i] < coh_thre:
265276
bad_ifgdates.append(ifgdates[i])

0 commit comments

Comments
 (0)