1
1
#!/usr/bin/env python3
2
2
"""
3
- v1.6 20210311 Yu Morishita, GSI
3
+ v1.6.1 20210405 Yu Morishita, GSI
4
4
5
5
========
6
6
Overview
65
65
"""
66
66
#%% Change log
67
67
'''
68
+ v1.6.1 20210405 Yu Morishita, GSI
69
+ - Bug fix when all pixels are nan in loop phase
68
70
v1.6 20210311 Yu Morishita, GSI
69
71
- Add --rm_ifg_list option
70
72
v1.5.3 20201118 Yu Morishita, GSI
102
104
import numpy as np
103
105
import datetime as dt
104
106
import multiprocessing as multi
105
- import SCM
106
107
import LiCSBAS_io_lib as io_lib
107
108
import LiCSBAS_loop_lib as loop_lib
108
109
import LiCSBAS_tools_lib as tools_lib
@@ -124,7 +125,7 @@ def main(argv=None):
124
125
argv = sys .argv
125
126
126
127
start = time .time ()
127
- ver = "1.6" ; date = 20210311 ; author = "Y. Morishita"
128
+ ver = "1.6.1 " ; date = 20210405 ; author = "Y. Morishita"
128
129
print ("\n {} ver{} {} {}" .format (os .path .basename (argv [0 ]), ver , date , author ), flush = True )
129
130
print ("{} {}" .format (os .path .basename (argv [0 ]), ' ' .join (argv [1 :])), flush = True )
130
131
@@ -506,8 +507,8 @@ def main(argv=None):
506
507
#%% Output loop info, move bad_loop_png
507
508
loop_info_file = os .path .join (loopdir , 'loop_info.txt' )
508
509
f = open (loop_info_file , 'w' )
509
- print ('# loop_thre: {} rad. *: Removed w/o ref, **: Removed w/ ref ' .format (
510
- loop_thre ) , file = f )
510
+ print ('# loop_thre: {} rad' .format (loop_thre ), file = f )
511
+ print ( '# *: Removed w/o ref, **: No ref, ***: Removed w/ ref' , file = f )
511
512
if rm_ifg_list :
512
513
print ('# +: Removed by manually indicating in {}' .format (rm_ifg_list ),
513
514
file = f )
@@ -539,9 +540,12 @@ def main(argv=None):
539
540
elif ifgd12 in rm_ifg or ifgd23 in rm_ifg or ifgd13 in rm_ifg :
540
541
badloopflag1 = '+'
541
542
shutil .move (looppngfile , badlooppngfile )
542
- elif ifgd12 in bad_ifg2 or ifgd23 in bad_ifg2 or ifgd13 in bad_ifg2 :
543
+ elif ifgd12 in noref_ifg or ifgd23 in noref_ifg or ifgd13 in noref_ifg :
543
544
badloopflag2 = '**'
544
545
shutil .move (looppngfile , badlooppngfile )
546
+ elif ifgd12 in bad_ifg2 or ifgd23 in bad_ifg2 or ifgd13 in bad_ifg2 :
547
+ badloopflag2 = '***'
548
+ shutil .move (looppngfile , badlooppngfile )
545
549
elif ifgd12 in bad_ifg_cand_res or ifgd23 in bad_ifg_cand_res or ifgd13 in bad_ifg_cand_res :
546
550
badloopflag1 = '/'
547
551
if os .path .exists (looppngfile ):
@@ -730,14 +734,19 @@ def loop_closure_1st_wrapper(i):
730
734
731
735
## Calculate loop phase and check n bias (2pi*n)
732
736
loop_ph = unw12 + unw23 - unw13
733
- loop_2pin = int (np .round (np .nanmedian (loop_ph )/ (2 * np .pi )))* 2 * np .pi
734
- loop_ph = loop_ph - loop_2pin #unbias 2pi x n
735
737
736
- if multi_prime :
737
- bias = np .nanmedian (loop_ph )
738
- loop_ph = loop_ph - bias # unbias inconsistent fraction phase
738
+ if np .all (np .isnan (loop_ph )):
739
+ bias = np .nan
740
+ rms = np .inf
741
+ else :
742
+ loop_2pin = np .round (np .nanmedian (loop_ph )/ (2 * np .pi ))* 2 * np .pi
743
+ loop_ph = loop_ph - loop_2pin #unbias 2pi x n
739
744
740
- rms = np .sqrt (np .nanmean (loop_ph ** 2 ))
745
+ if multi_prime :
746
+ bias = np .nanmedian (loop_ph )
747
+ loop_ph = loop_ph - bias # unbias inconsistent fraction phase
748
+
749
+ rms = np .sqrt (np .nanmean (loop_ph ** 2 ))
741
750
742
751
### Output png. If exist in old, move to save time
743
752
imd1 = ifgd12 [:8 ]
@@ -784,12 +793,14 @@ def loop_closure_2nd_wrapper(args):
784
793
785
794
## Calculate loop phase and rms at points
786
795
loop_ph = unw12 + unw23 - unw13
787
- loop_2pin = int (np .round (np .nanmedian (loop_ph )/ (2 * np .pi )))* 2 * np .pi
788
- loop_ph = loop_ph - loop_2pin #unbias
789
796
790
- if multi_prime :
791
- bias = np .nanmedian (loop_ph )
792
- loop_ph = loop_ph - bias # unbias inconsistent fraction phase
797
+ if not np .all (np .isnan (loop_ph )):
798
+ loop_2pin = np .round (np .nanmedian (loop_ph )/ (2 * np .pi ))* 2 * np .pi
799
+ loop_ph = loop_ph - loop_2pin #unbias 2pi x n
800
+
801
+ if multi_prime :
802
+ bias = np .nanmedian (loop_ph )
803
+ loop_ph = loop_ph - bias # unbias inconsistent fraction phase
793
804
794
805
ns_loop_ph1 = ns_loop_ph1 + ~ np .isnan (loop_ph )
795
806
0 commit comments