def prune_network(date12_list, inps): """Pruning network candidates based on temp/perp baseline and DOP overlap""" # Turn off pruning for some methods if inps.referenceFile or inps.method in ['star', 'hierarchical', 'mst']: inps.threshold = False if inps.threshold: # Temporal baseline date12_list = pnet.threshold_temporal_baseline(date12_list, inps.tempBaseMax, inps.keepSeasonal, inps.tempBaseMin) log('number of interferograms with temporal baseline in <{}, {}> days: {}' .format(inps.tempBaseMin, inps.tempBaseMax, len(date12_list))) if inps.keepSeasonal: log('\tkeep seasonal pairs, i.e. pairs with temporal baseline == N*years +/- one month' ) # Perpendicular spatial baseline date12_list = pnet.threshold_perp_baseline(date12_list, inps.date_list, inps.pbase_list, inps.perpBaseMax) log('number of interferograms with perp baseline <= {} meters: {}'. format(inps.perpBaseMax, len(date12_list))) # Doppler Overlap Percentage if inps.sensor and inps.dop_list: bandwidth_az = sensor.azimuth_bandwidth(inps.sensor) date12_list = pnet.threshold_doppler_overlap( date12_list, inps.date_list, inps.dop_list, bandwidth_az, inps.dopOverlapMin / 100.0) log('number of interferograms with azimuth Doppler frequency overlap >= {}%: {}' .format(inps.dopOverlapMin, len(date12_list))) if not date12_list: raise Exception('No interferogram left after pruning!') # print stat info m_dates = [ date12.replace('_', '-').split('-')[0] for date12 in date12_list ] s_dates = [ date12.replace('_', '-').split('-')[1] for date12 in date12_list ] log('number of acquisitions input : {}'.format(len(inps.date_list))) log('number of acquisitions selected: {}'.format( len(list(set(m_dates + s_dates))))) log('number of interferograms selected: {}'.format(len(date12_list))) return date12_list
def simulate_coherence(date12_list, baseline_file='bl_list.txt', sensor_name='Env', inc_angle=22.8, decor_time=200.0, coh_resid=0.2, display=False): """Simulate coherence for a given set of interferograms Inputs: date12_list - list of string in YYMMDD-YYMMDD format, indicating pairs configuration baseline_file - string, path of baseline list text file sensor_name - string, SAR sensor name inc_angle - float, incidence angle decor_time - float / 2D np.array in size of (1, pixel_num) decorrelation rate in days, time for coherence to drop to 1/e of its initial value coh_resid - float / 2D np.array in size of (1, pixel_num) long-term coherence, minimum attainable coherence value display - bool, display result as matrix or not Output: cohs - 2D np.array in size of (ifgram_num, pixel_num) Example: date12_list = pnet.get_date12_list('ifgram_list.txt') cohs = simulate_coherences(date12_list, 'bl_list.txt', sensor_name='Tsx') References: Zebker, H. A., & Villasenor, J. (1992). Decorrelation in interferometric radar echoes. IEEE-TGRS, 30(5), 950-959. Hanssen, R. F. (2001). Radar interferometry: data interpretation and error analysis (Vol. 2). Dordrecht, Netherlands: Kluwer Academic Pub. Morishita, Y., & Hanssen, R. F. (2015). Temporal decorrelation in L-, C-, and X-band satellite radar interferometry for pasture on drained peat soils. IEEE-TGRS, 53(2), 1096-1104. Parizzi, A., Cong, X., & Eineder, M. (2009). First Results from Multifrequency Interferometry. A comparison of different decorrelation time constants at L, C, and X Band. ESA Scientific Publications(SP-677), 1-5. """ date_list, pbase_list, dop_list = read_baseline_file(baseline_file)[0:3] tbase_list = ptime.date_list2tbase(date_list)[0] # Thermal decorrelation (Zebker and Villasenor, 1992, Eq.4) SNR = sensor.signal2noise_ratio(sensor_name) coh_thermal = 1. / (1. + 1./SNR) pbase_c = critical_perp_baseline(sensor_name, inc_angle) bandwidth_az = sensor.azimuth_bandwidth(sensor_name) date12_list = ptime.yyyymmdd_date12(date12_list) ifgram_num = len(date12_list) if isinstance(decor_time, (int, float)): pixel_num = 1 decor_time = float(decor_time) else: pixel_num = decor_time.shape[1] if decor_time == 0.: decor_time = 0.01 cohs = np.zeros((ifgram_num, pixel_num), np.float32) for i in range(ifgram_num): if display: sys.stdout.write('\rinterferogram = %4d/%4d' % (i, ifgram_num)) sys.stdout.flush() m_date, s_date = date12_list[i].split('_') m_idx = date_list.index(m_date) s_idx = date_list.index(s_date) pbase = pbase_list[s_idx] - pbase_list[m_idx] tbase = tbase_list[s_idx] - tbase_list[m_idx] # Geometric decorrelation (Hanssen, 2001, Eq. 4.4.12) coh_geom = (pbase_c - abs(pbase)) / pbase_c if coh_geom < 0.: coh_geom = 0. # Doppler centroid decorrelation (Hanssen, 2001, Eq. 4.4.13) if not dop_list: coh_dc = 1. else: coh_dc = calculate_doppler_overlap(dop_list[m_idx], dop_list[s_idx], bandwidth_az) if coh_dc < 0.: coh_dc = 0. # Option 1: Temporal decorrelation - exponential delay model (Parizzi et al., 2009; Morishita and Hanssen, 2015) coh_temp = np.multiply((coh_thermal - coh_resid), np.exp(-1*abs(tbase)/decor_time)) + coh_resid coh = coh_geom * coh_dc * coh_temp cohs[i, :] = coh #epsilon = 1e-3 #cohs[cohs < epsilon] = epsilon if display: print('') if display: print(('critical perp baseline: %.f m' % pbase_c)) cohs_mat = coherence_matrix(date12_list, cohs) plt.figure() plt.imshow(cohs_mat, vmin=0.0, vmax=1.0, cmap='jet') plt.xlabel('Image number') plt.ylabel('Image number') cbar = plt.colorbar() cbar.set_label('Coherence') plt.title('Coherence matrix') plt.show() return cohs
def simulate_coherence(date12_list, baseline_file='bl_list.txt', sensor_name='Env', inc_angle=22.8, decor_time=200.0, coh_resid=0.2, display=False): """Simulate coherence for a given set of interferograms Inputs: date12_list - list of string in YYMMDD-YYMMDD format, indicating pairs configuration baseline_file - string, path of baseline list text file sensor_name - string, SAR sensor name inc_angle - float, incidence angle decor_time - float / 2D np.array in size of (1, pixel_num) decorrelation rate in days, time for coherence to drop to 1/e of its initial value coh_resid - float / 2D np.array in size of (1, pixel_num) long-term coherence, minimum attainable coherence value display - bool, display result as matrix or not Output: cohs - 2D np.array in size of (ifgram_num, pixel_num) Example: date12_list = pnet.get_date12_list('ifgram_list.txt') cohs = simulate_coherences(date12_list, 'bl_list.txt', sensor_name='Tsx') References: Zebker, H. A., & Villasenor, J. (1992). Decorrelation in interferometric radar echoes. IEEE-TGRS, 30(5), 950-959. Hanssen, R. F. (2001). Radar interferometry: data interpretation and error analysis (Vol. 2). Dordrecht, Netherlands: Kluwer Academic Pub. Morishita, Y., & Hanssen, R. F. (2015). Temporal decorrelation in L-, C-, and X-band satellite radar interferometry for pasture on drained peat soils. IEEE-TGRS, 53(2), 1096-1104. Parizzi, A., Cong, X., & Eineder, M. (2009). First Results from Multifrequency Interferometry. A comparison of different decorrelation time constants at L, C, and X Band. ESA Scientific Publications(SP-677), 1-5. """ date_list, pbase_list, dop_list = read_baseline_file(baseline_file)[0:3] tbase_list = ptime.date_list2tbase(date_list)[0] # Thermal decorrelation (Zebker and Villasenor, 1992, Eq.4) SNR = sensor.signal2noise_ratio(sensor_name) coh_thermal = 1. / (1. + 1. / SNR) pbase_c = critical_perp_baseline(sensor_name, inc_angle) bandwidth_az = sensor.azimuth_bandwidth(sensor_name) date12_list = ptime.yyyymmdd_date12(date12_list) ifgram_num = len(date12_list) if isinstance(decor_time, (int, float)): pixel_num = 1 decor_time = float(decor_time) else: pixel_num = decor_time.shape[1] if decor_time == 0.: decor_time = 0.01 cohs = np.zeros((ifgram_num, pixel_num), np.float32) for i in range(ifgram_num): if display: sys.stdout.write('\rinterferogram = %4d/%4d' % (i, ifgram_num)) sys.stdout.flush() m_date, s_date = date12_list[i].split('_') m_idx = date_list.index(m_date) s_idx = date_list.index(s_date) pbase = pbase_list[s_idx] - pbase_list[m_idx] tbase = tbase_list[s_idx] - tbase_list[m_idx] # Geometric decorrelation (Hanssen, 2001, Eq. 4.4.12) coh_geom = (pbase_c - abs(pbase)) / pbase_c if coh_geom < 0.: coh_geom = 0. # Doppler centroid decorrelation (Hanssen, 2001, Eq. 4.4.13) if not dop_list: coh_dc = 1. else: coh_dc = calculate_doppler_overlap(dop_list[m_idx], dop_list[s_idx], bandwidth_az) if coh_dc < 0.: coh_dc = 0. # Option 1: Temporal decorrelation - exponential delay model (Parizzi et al., 2009; Morishita and Hanssen, 2015) coh_temp = np.multiply( (coh_thermal - coh_resid), np.exp( -1 * abs(tbase) / decor_time)) + coh_resid coh = coh_geom * coh_dc * coh_temp cohs[i, :] = coh #epsilon = 1e-3 #cohs[cohs < epsilon] = epsilon if display: print('') if display: print(('critical perp baseline: %.f m' % pbase_c)) cohs_mat = coherence_matrix(date12_list, cohs) plt.figure() plt.imshow(cohs_mat, vmin=0.0, vmax=1.0, cmap='jet') plt.xlabel('Image number') plt.ylabel('Image number') cbar = plt.colorbar() cbar.set_label('Coherence') plt.title('Coherence matrix') plt.show() return cohs