コード例 #1
0
ファイル: rf_script.py プロジェクト: iceseismic/sito
def profile_pp_binned(stations, bin, header='plon', expr=None, xlim=None):  #, scale=0.2 @ReservedAssignment
    """ PP profile """
    log.info('***** Create piercing point binned plot')
    util.setRootLogger(logdebugfile=data.rf_results_dir + 'a_log_profile_pp.txt')
    filename = 'profile_pp_%s_%s_dif%s' % (stations, expr, bin[1] - bin[0])
    file_ = data.rf_results_dir + filename
    try:
        stream = read(file_ + '.QHD')
    except:
        stream_all = read_rf()
        stream = stream_all.select(component='Q', expr=expr).getBinnedStream(bin, header=header)
        stream.write(file_, 'Q')
    plot = stream.plotProfile(-2, 21, scale=bin[1] - bin[0], xaxis='plon', xlabel='longitude of piercing points', plotinfo=(), figtitle='profile')
    ax = plot.fig.axes[0]
    if xlim:
        ax.set_xlim(xlim)
    # second ax with depth
    ax2 = ax.twinx()
    h = np.array((0, 50, 100, 150, 200))
    h2 = np.arange(20) * 10
    t = util.depth2time(h)
    myLocator = mpl.ticker.FixedLocator(t)
    myMinorLocator = mpl.ticker.FixedLocator(util.depth2time(h2))
    myFormatter = mpl.ticker.FixedFormatter([str(i) for i in h])
    ax2.yaxis.set_major_locator(myLocator)
    ax2.yaxis.set_minor_locator(myMinorLocator)
    ax2.yaxis.set_major_formatter(myFormatter)
    ax2.set_ylim(ax.get_ylim())
    ax2.set_ylabel('depth (km)')
    plt.show()
    #plot.fig.savefig(plotdir + filename + '.eps')    #st2.plotProfile(-2, 21, scale=0.05, xaxis = 'plon')
    #plot.fig.savefig(plotdir + filename + '.png')
    plt.close(plot.fig)
コード例 #2
0
def profile_pp_binned(stations,
                      bin,
                      header='plon',
                      expr=None,
                      xlim=None):  #, scale=0.2 @ReservedAssignment
    """ PP profile """
    log.info('***** Create piercing point binned plot')
    util.setRootLogger(logdebugfile=data.rf_results_dir +
                       'a_log_profile_pp.txt')
    filename = 'profile_pp_%s_%s_dif%s' % (stations, expr, bin[1] - bin[0])
    file_ = data.rf_results_dir + filename
    try:
        stream = read(file_ + '.QHD')
    except:
        stream_all = read_rf()
        stream = stream_all.select(component='Q',
                                   expr=expr).getBinnedStream(bin,
                                                              header=header)
        stream.write(file_, 'Q')
    plot = stream.plotProfile(-2,
                              21,
                              scale=bin[1] - bin[0],
                              xaxis='plon',
                              xlabel='longitude of piercing points',
                              plotinfo=(),
                              figtitle='profile')
    ax = plot.fig.axes[0]
    if xlim:
        ax.set_xlim(xlim)
    # second ax with depth
    ax2 = ax.twinx()
    h = np.array((0, 50, 100, 150, 200))
    h2 = np.arange(20) * 10
    t = util.depth2time(h)
    myLocator = mpl.ticker.FixedLocator(t)
    myMinorLocator = mpl.ticker.FixedLocator(util.depth2time(h2))
    myFormatter = mpl.ticker.FixedFormatter([str(i) for i in h])
    ax2.yaxis.set_major_locator(myLocator)
    ax2.yaxis.set_minor_locator(myMinorLocator)
    ax2.yaxis.set_major_formatter(myFormatter)
    ax2.set_ylim(ax.get_ylim())
    ax2.set_ylabel('depth (km)')
    plt.show()
    #plot.fig.savefig(plotdir + filename + '.eps')    #st2.plotProfile(-2, 21, scale=0.05, xaxis = 'plon')
    #plot.fig.savefig(plotdir + filename + '.png')
    plt.close(plot.fig)
コード例 #3
0
ファイル: rf_pspier.py プロジェクト: iceseismic/sito
def plot_depth(ax):
    ax2 = ax.twinx()
    h = np.array((0, 50, 100, 150, 200))
    h2 = np.arange(20) * 10
    t = util.depth2time(h)
    myLocator = mpl.ticker.FixedLocator(t)
    myMinorLocator = mpl.ticker.FixedLocator(util.depth2time(h2))
    myFormatter = mpl.ticker.FixedFormatter([str(i) for i in h])
    ax2.yaxis.set_major_locator(myLocator)
    ax2.yaxis.set_minor_locator(myMinorLocator)
    ax2.yaxis.set_major_formatter(myFormatter)
    ax2.set_ylabel('depth (km)')
    ax2.set_ylim(ax.get_ylim())
    if len(plt.gcf().axes) == 3:  # dirty hack
        from mpl_toolkits.axes_grid1 import make_axes_locatable
        divider = make_axes_locatable(ax2)
        ax3 = divider.append_axes('top', pad=0, size=0.2)
コード例 #4
0
def plot_depth(ax):
    ax2 = ax.twinx()
    h = np.array((0, 50, 100, 150, 200))
    h2 = np.arange(20) * 10
    t = util.depth2time(h)
    myLocator = mpl.ticker.FixedLocator(t)
    myMinorLocator = mpl.ticker.FixedLocator(util.depth2time(h2))
    myFormatter = mpl.ticker.FixedFormatter([str(i) for i in h])
    ax2.yaxis.set_major_locator(myLocator)
    ax2.yaxis.set_minor_locator(myMinorLocator)
    ax2.yaxis.set_major_formatter(myFormatter)
    ax2.set_ylabel('depth (km)')
    ax2.set_ylim(ax.get_ylim())
    if len(plt.gcf().axes) == 3:  # dirty hack
        from mpl_toolkits.axes_grid1 import make_axes_locatable
        divider = make_axes_locatable(ax2)
        ax3 = divider.append_axes('top', pad=0, size=0.2)
コード例 #5
0
 def test_util_depth2time(self):
     test = np.array((util.depth2time(100, 'S'), util.depth2time(100, 'Sppp'), util.depth2time(100, 'Ssss')))
     np.testing.assert_array_almost_equal(test, np.array((23.75012441, 13.84042822, 47.50024882)))