From 02b7e681fc337463b0fe42dac27dc8c6492a2d34 Mon Sep 17 00:00:00 2001 From: Yu Morishita Date: Mon, 16 Nov 2020 09:59:47 +0900 Subject: [PATCH] Exit if suffix is not set --- bin/LiCSBAS11_check_unw.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/bin/LiCSBAS11_check_unw.py b/bin/LiCSBAS11_check_unw.py index 6989dd3..8b4e207 100755 --- a/bin/LiCSBAS11_check_unw.py +++ b/bin/LiCSBAS11_check_unw.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -v1.3.1 20200911 Yu Morishita, GSI +v1.3.2 20201116 Yu Morishita, GSI ======== Overview @@ -44,6 +44,8 @@ """ #%% Change log ''' +v1.3.2 20201116 Yu Morioshita, GSI + - Exit if suffix is not set v1.3.1 20200911 Yu Morioshita, GSI - Change default to -c 0.05 -u 0.3 v1.3 20200703 Yu Morioshita, GSI @@ -83,7 +85,7 @@ def main(argv=None): argv = sys.argv start = time.time() - ver="1.3.1"; date=20200911; author="Y. Morishita" + ver="1.3.2"; date=20201116; author="Y. Morishita" print("\n{} ver{} {} {}".format(os.path.basename(argv[0]), ver, date, author), flush=True) print("{} {}".format(os.path.basename(argv[0]), ' '.join(argv[1:])), flush=True) @@ -247,7 +249,7 @@ def main(argv=None): print('# unw_cov_thre: {0}, coh_thre: {1}'.format(unw_cov_thre, coh_thre), file=fstats) print('# ifg dates bperp dt unw_cov coh_av', file=fstats) - ### Identify suffix of raster image (ras or bmp?) + ### Identify suffix of raster image (png, ras or bmp?) unwfile = os.path.join(ifgdir, ifgdates[0], ifgdates[0]+'.unw') if os.path.exists(unwfile+'.ras'): suffix = '.ras' @@ -255,11 +257,20 @@ def main(argv=None): suffix = '.bmp' elif os.path.exists(unwfile+'.png'): suffix = '.png' + else: + print('\nERROR: No browse image available for {}!\n' + .format(unwfile), file=sys.stderr) + return 2 for i, ifgd in enumerate(ifgdates): rasname = ifgdates[i]+'.unw'+suffix rasorg = os.path.join(ifgdir, ifgdates[i], rasname) - + + if not os.path.exists(rasorg): + print('\nERROR: No browse image {} available!\n' + .format(rasorg), file=sys.stderr) + return 2 + ### Identify bad ifgs and link ras if rate_cov[i] < unw_cov_thre or coh_avg_ifg[i] < coh_thre: bad_ifgdates.append(ifgdates[i])