Пример #1
0
def main(iargs=None):
    inps = cmd_line_parse(iargs)
    inps = read_network_info(inps)

    # Plot
    if not inps.disp_fig:
        plt.switch_backend('Agg')
    inps.cbar_label = 'Average Spatial Coherence'
    figNames = [i+inps.fig_ext for i in ['BperpHistory', 'CoherenceMatrix', 'CoherenceHistory', 'Network']]

    # Fig 1 - Baseline History
    fig, ax = plt.subplots(figsize=inps.fig_size)
    ax = pp.plot_perp_baseline_hist(ax,
                                    inps.dateList,
                                    inps.pbaseList,
                                    vars(inps),
                                    inps.dateList_drop)
    if inps.save_fig:
        fig.savefig(figNames[0], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
        print('save figure to {}'.format(figNames[0]))

    if inps.cohList is not None:
        # Fig 2 - Coherence Matrix
        fig, ax = plt.subplots(figsize=inps.fig_size)
        ax = pp.plot_coherence_matrix(ax,
                                      inps.date12List,
                                      inps.cohList,
                                      inps.date12List_drop,
                                      plot_dict=vars(inps))[0]
        if inps.save_fig:
            fig.savefig(figNames[1], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
            print('save figure to {}'.format(figNames[1]))

        # Fig 3 - Min/Max Coherence History
        fig, ax = plt.subplots(figsize=inps.fig_size)
        ax = pp.plot_coherence_history(ax,
                                       inps.date12List,
                                       inps.cohList,
                                       plot_dict=vars(inps))
        if inps.save_fig:
            fig.savefig(figNames[2], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
            print('save figure to {}'.format(figNames[2]))

    # Fig 4 - Interferogram Network
    fig, ax = plt.subplots(figsize=inps.fig_size)
    ax = pp.plot_network(ax,
                         inps.date12List,
                         inps.dateList,
                         inps.pbaseList,
                         vars(inps),
                         inps.date12List_drop)
    if inps.save_fig:
        fig.savefig(figNames[3], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
        print('save figure to {}'.format(figNames[3]))

    if inps.disp_fig:
        print('showing ...')
        plt.show()
Пример #2
0
def main(iargs=None):
    inps = cmd_line_parse(iargs)

    # Plot
    inps.cbar_label = 'Average Spatial Coherence'
    figNames = [i+'.pdf' for i in ['BperpHistory', 'CoherenceMatrix', 'CoherenceHistory', 'Network']]

    # Fig 1 - Baseline History
    fig, ax = plt.subplots(figsize=inps.fig_size)
    ax = pp.plot_perp_baseline_hist(ax,
                                    inps.dateList,
                                    inps.pbaseList,
                                    vars(inps),
                                    inps.dateList_drop)
    if inps.save_fig:
        fig.savefig(figNames[0], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
        print('save figure to {}'.format(figNames[0]))

    if inps.cohList is not None:
        # Fig 2 - Coherence Matrix
        fig, ax = plt.subplots(figsize=inps.fig_size)
        ax = pp.plot_coherence_matrix(ax,
                                      inps.date12List,
                                      inps.cohList,
                                      inps.date12List_drop,
                                      plot_dict=vars(inps))[0]
        if inps.save_fig:
            fig.savefig(figNames[1], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
            print('save figure to {}'.format(figNames[1]))

        # Fig 3 - Min/Max Coherence History
        fig, ax = plt.subplots(figsize=inps.fig_size)
        ax = pp.plot_coherence_history(ax,
                                       inps.date12List,
                                       inps.cohList,
                                       plot_dict=vars(inps))
        if inps.save_fig:
            fig.savefig(figNames[2], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
            print('save figure to {}'.format(figNames[2]))

    # Fig 4 - Interferogram Network
    fig, ax = plt.subplots(figsize=inps.fig_size)
    ax = pp.plot_network(ax,
                         inps.date12List,
                         inps.dateList,
                         inps.pbaseList,
                         vars(inps),
                         inps.date12List_drop)
    if inps.save_fig:
        fig.savefig(figNames[3], bbox_inches='tight', transparent=True, dpi=inps.fig_dpi)
        print('save figure to {}'.format(figNames[3]))

    if inps.disp_fig:
        print('showing ...')
        plt.show()
Пример #3
0
def plot_network_info(inps):
    if not inps.disp_fig:
        plt.switch_backend('Agg')

    out_fig_name = os.path.join(inps.out_dir, 'network{}'.format(inps.figext))
    log('plot network / pairs to file: ' + os.path.basename(out_fig_name))
    fig1, ax1 = plt.subplots(figsize=inps.fig_size)
    ax1 = pp.plot_network(ax1,
                          inps.date12_list,
                          inps.date_list,
                          inps.pbase_list,
                          p_dict=vars(inps),
                          print_msg=False)
    plt.savefig(out_fig_name, bbox_inches='tight', dpi=inps.figdpi)

    out_fig_name = os.path.join(inps.out_dir,
                                'bperpHistory{}'.format(inps.figext))
    log('plot baseline history to file: ' + os.path.basename(out_fig_name))
    fig2, ax2 = plt.subplots(figsize=inps.fig_size)
    ax2 = pp.plot_perp_baseline_hist(ax2, inps.date_list, inps.pbase_list)
    plt.savefig(out_fig_name, bbox_inches='tight', dpi=inps.figdpi)

    out_fig_name = os.path.join(inps.out_dir,
                                'coherenceMatrix{}'.format(inps.figext))
    if inps.cohList:
        log('plot predicted coherence matrix to file: ' +
            os.path.basename(out_fig_name))
        fig3, ax3 = plt.subplots(figsize=inps.fig_size)
        ax3 = pp.plot_coherence_matrix(ax3,
                                       inps.date12_list,
                                       inps.cohList,
                                       p_dict=vars(inps))[0]
        plt.savefig(out_fig_name, bbox_inches='tight', dpi=inps.figdpi)

    if inps.disp_fig:
        plt.show()
    return
Пример #4
0
def main(iargs=None):
    inps = cmd_line_parse(iargs)

    # read / calculate
    inps = read_network_info(inps)

    # Plot settings
    inps = check_colormap(inps)
    if inps.dsetName == 'coherence':
        inps.ds_name = 'Coherence'
        figNames = [
            i + '.pdf' for i in
            ['bperpHistory', 'coherenceMatrix', 'coherenceHistory', 'network']
        ]
    elif inps.dsetName == 'offsetSNR':
        inps.ds_name = 'SNR'
        figNames = [
            i + '.pdf'
            for i in ['bperpHistory', 'SNRMatrix', 'SNRHistory', 'network']
        ]
    inps.cbar_label = 'Average Spatial {}'.format(inps.ds_name)

    # Fig 1 - Baseline History
    fig, ax = plt.subplots(figsize=inps.fig_size)
    ax = pp.plot_perp_baseline_hist(ax, inps.dateList, inps.pbaseList,
                                    vars(inps), inps.dateList_drop)
    if inps.save_fig:
        fig.savefig(figNames[0],
                    bbox_inches='tight',
                    transparent=True,
                    dpi=inps.fig_dpi)
        print('save figure to {}'.format(figNames[0]))

    if inps.cohList is not None:
        # Fig 2 - Coherence Matrix
        fig, ax = plt.subplots(figsize=inps.fig_size)
        ax = pp.plot_coherence_matrix(ax,
                                      inps.date12List,
                                      inps.cohList,
                                      inps.date12List_drop,
                                      p_dict=vars(inps))[0]
        if inps.save_fig:
            fig.savefig(figNames[1],
                        bbox_inches='tight',
                        transparent=True,
                        dpi=inps.fig_dpi)
            print('save figure to {}'.format(figNames[1]))

        # Fig 3 - Min/Max Coherence History
        fig, ax = plt.subplots(figsize=inps.fig_size)
        ax = pp.plot_coherence_history(ax,
                                       inps.date12List,
                                       inps.cohList,
                                       p_dict=vars(inps))
        if inps.save_fig:
            fig.savefig(figNames[2],
                        bbox_inches='tight',
                        transparent=True,
                        dpi=inps.fig_dpi)
            print('save figure to {}'.format(figNames[2]))

    # Fig 4 - Interferogram Network
    fig, ax = plt.subplots(figsize=inps.fig_size)
    ax = pp.plot_network(ax, inps.date12List, inps.dateList, inps.pbaseList,
                         vars(inps), inps.date12List_drop)
    if inps.save_fig:
        fig.savefig(figNames[3],
                    bbox_inches='tight',
                    transparent=True,
                    dpi=inps.fig_dpi)
        print('save figure to {}'.format(figNames[3]))

    if inps.disp_fig:
        print('showing ...')
        plt.show()
    else:
        plt.close()

    return