Esempio n. 1
0
def simulate_network(ts_sim,
                     date12_list,
                     decor_day,
                     coh_resid,
                     L=75,
                     num_sample=int(1e4),
                     baseline_file='bl_list.txt',
                     sensor_name='Sen',
                     inc_angle=33.4):
    """Simulate coherence --> decorrelation noise --> ifgram phase and estimated coherence"""
    coh_sim = pnet.simulate_coherence(date12_list,
                                      baseline_file='bl_list.txt',
                                      sensor_name=sensor_name,
                                      inc_angle=inc_angle,
                                      decor_time=decor_day,
                                      coh_resid=coh_resid)

    decor_noise = simulate_decorrelation_noises(date12_list,
                                                coh_sim,
                                                L=int(L),
                                                size=num_sample)

    m_dates = [i.split('_')[0] for i in date12_list]
    s_dates = [i.split('_')[1] for i in date12_list]
    date_list = sorted(list(set(m_dates + s_dates)))
    ifgram_sim = timeseries2ifgram(ts_sim,
                                   date_list,
                                   date12_list,
                                   display=False)
    ifgram_est = decor_noise + np.tile(ifgram_sim.reshape(-1, 1),
                                       (1, num_sample))
    coh_est = estimate_coherence(ifgram_est, L=L, win_size=25)
    return ifgram_est, coh_est, ifgram_sim, coh_sim
Esempio n. 2
0
def simulate_network(ts_sim, date12_list, decor_day, coh_resid, L=75, num_repeat=int(1e4),
                     baseline_file='bl_list.txt', sensor_name='Sen', inc_angle=33.4):
    """Simulate the InSAR stack for one pixel, including:
        simulated coherence --> decorrelation noise
        simulated ifgram phase with / without decorrelation noise
        estimated coherence"""
    # simulated (true) phase
    m_dates = [i.split('_')[0] for i in date12_list]
    s_dates = [i.split('_')[1] for i in date12_list]
    date_list = sorted(list(set(m_dates + s_dates)))
    ifgram_sim = timeseries2ifgram(ts_sim, date_list, date12_list, display=False)

    # simulated (true) coherence
    coh_sim = pnet.simulate_coherence(date12_list,
                                      baseline_file='bl_list.txt',
                                      sensor_name=sensor_name,
                                      inc_angle=inc_angle,
                                      decor_time=decor_day,
                                      coh_resid=coh_resid)

    # simulated (estimated) phase
    decor_noise = coherence2decorrelation_phase(coh_sim, L=int(L), num_repeat=num_repeat)
    ifgram_est = decor_noise + np.tile(ifgram_sim.reshape(-1,1), (1, num_repeat))

    # estimated coherence
    coh_est = estimate_coherence(ifgram_est, L=L, win_size=25)

    return ifgram_est, coh_est, ifgram_sim, coh_sim
Esempio n. 3
0
def simulate_network(ts_sim, date12_list, decor_day, coh_resid, L=75, num_sample=int(1e4),
                     baseline_file='bl_list.txt', sensor_name='Sen', inc_angle=33.4):
    """Simulate coherence --> decorrelation noise --> ifgram phase and estimated coherence"""
    coh_sim = pnet.simulate_coherence(date12_list,
                                      baseline_file='bl_list.txt',
                                      sensor_name=sensor_name,
                                      inc_angle=inc_angle,
                                      decor_time=decor_day,
                                      coh_resid=coh_resid)

    decor_noise = simulate_decorrelation_noises(date12_list, coh_sim, L=int(L), size=num_sample)

    m_dates = [i.split('_')[0] for i in date12_list]
    s_dates = [i.split('_')[1] for i in date12_list]
    date_list = sorted(list(set(m_dates + s_dates)))
    ifgram_sim = timeseries2ifgram(ts_sim, date_list, date12_list, display=False)
    ifgram_est = decor_noise + np.tile(ifgram_sim.reshape(-1,1), (1, num_sample))
    coh_est = estimate_coherence(ifgram_est, L=L, win_size=25)
    return ifgram_est, coh_est, ifgram_sim, coh_sim
Esempio n. 4
0
def write_ifgram_list(inps):
    # Output directory/filename
    inps.outfile = os.path.abspath(inps.outfile)
    inps.out_dir = os.path.dirname(inps.outfile)
    if not os.path.isdir(inps.out_dir):
        os.makedirs(inps.out_dir)

    # Calculate ifgram's temp/perp baseline
    ifgram_num = len(inps.date12_list)
    ifgram_pbase_list = []
    ifgram_tbase_list = []
    for i in range(ifgram_num):
        m_date, s_date = inps.date12_list[i].split('-')
        m_idx = inps.date_list.index(m_date)
        s_idx = inps.date_list.index(s_date)
        pbase = inps.pbase_list[s_idx] - inps.pbase_list[m_idx]
        tbase = inps.tbase_list[s_idx] - inps.tbase_list[m_idx]
        ifgram_pbase_list.append(pbase)
        ifgram_tbase_list.append(tbase)

    # calculate ifgram's predicted coherence
    try:
        inps.cohList = pnet.simulate_coherence(
            inps.date12_list, inps.baseline_file,
            sensor_name=inps.sensor).flatten().tolist()
    except:
        inps.cohList = None

    # Write txt file
    f = open(inps.outfile, 'w')
    f.write('#Interferograms configuration generated by select_network.py\n')
    f.write('#   Date12      Btemp(days)    Bperp(m)    sim_coherence\n')
    for i in range(ifgram_num):
        line = '{}   {:6.0f}         {:6.1f}'.format(inps.date12_list[i],
                                                     ifgram_tbase_list[i],
                                                     ifgram_pbase_list[i])
        if inps.cohList:
            line += '       {:1.4f}'.format(inps.cohList[i])
        f.write(line + '\n')
    f.close()
    log('write network/pairs info into file: {}'.format(inps.outfile))
    return inps.outfile