示例#1
0
def plot_file(file):
    name = basename(file)
    fname = 'plots/%s.pdf' % name
    #fname = 'plots/%s.png'%name
    if exists(fname):
        print('Skip %s!' % fname)
        return
    print(fname)
    with h5py.File(file, 'r') as fid:
        slip = nres = fid['Bm'][...]

    mplt = MapPlotSlab()
    mplt.plot_top()

    mplt = MapPlotFault(fault_file)
    mplt.plot_slip(slip)

    mplt = vj.MapPlotDisplacement()
    mplt.plot_sites_seafloor(sites_seafloor=sites_seafloor)

    mo, mw = vj.MomentCalculator(fault_file, earth_file).moment(slip)
    plt.title('Mo=%g, Mw=%.2f' % (mo, mw))
    #plt.show()
    plt.savefig(fname)
    plt.close()
示例#2
0
 def _plot_d(self, scale, X, Y, U, label_len, sites_subset=None):
     mplt = vj.MapPlotDisplacement(self.basemap)
     mplt.plot_disp(self.d_obs,
                    self.sites,
                    sites_subset=sites_subset,
                    scale=scale,
                    X=X,
                    Y=Y,
                    U=U,
                    label='obs. ' + label_len)
     mplt.plot_disp(self.d_pred,
                    self.sites,
                    sites_subset=sites_subset,
                    scale=scale,
                    color='red',
                    X=X,
                    Y=Y + 0.08,
                    U=U,
                    label='pred. ' + label_len)
示例#3
0
def plot_file(file):
    name = basename(file)
    fname = 'plots/%s.png' % name
    if exists(fname):
        print('Skip %s!' % fname)
        return
    print(fname)
    with h5py.File(file, 'r') as fid:
        slip = nres = fid['Bm'][...]

    mplt = MapPlotSlab()
    mplt.plot_top()

    mplt = MapPlotFault('../fault_bott40km.h5')
    mplt.plot_slip(slip)

    mplt = vj.MapPlotDisplacement()
    mplt.plot_sites_seafloor(sites_seafloor=sites_seafloor)
    #plt.show()
    plt.savefig(fname)

    plt.close()
示例#4
0
import viscojapan as vj

f1 = vj.EpochalG('../G_Rake66.h5')
G1 = f1[0]

f2 = vj.EpochalG('../G_Rake90.h5')
G2 = f2[0]

f3 = vj.EpochalG('../G_Rake95.h5')
G3 = f3[0]

fno = 285

bm = vj.MyBasemap(region_code='near')
scale = 2e-2
mplt = vj.MapPlotDisplacement(basemap=bm)
mplt.plot_disp(G1[:, fno], f1.sites, scale=scale)
mplt.plot_disp(G2[:, fno], f2.sites, scale=scale, color='red')
mplt.plot_disp(G3[:, fno], f3.sites, scale=scale, color='blue')

vj.MapPlotFault('../fault_He50km.h5', basemap=bm).plot_fault(fno)

vj.plt.show()
示例#5
0
 def _mark_seafloor_sites(self):
     mplt = vj.MapPlotDisplacement(self.basemap)
     mplt.plot_sites_seafloor()
示例#6
0
sites = np.loadtxt('../sites', '4a')
##ep = vj.EpochalDisplacement('../../cumu_post_with_seafloor.h5','../sites')
##slip_co = ep[0]
##
##
##mplt = vj.MapPlotDisplacement()
##
##mplt.plot_disp(slip_co,sites)
##plt.show()

ep = vj.EpochalSlip('../slip0/incr_slip0.h5')
slip_co = ep[0]

##mplt = vj.MapPlotFault('../fault_model/fault_bott50km.h5')
##mplt.plot_slip(slip_co)

ep_obs = vj.EpochalDisplacement('../../cumu_post_with_seafloor.h5', '../sites')

f_G = '../green_function/G_He50km_Vis5.8E18_Rake90.h5'
ep_co_disp = vj.EpochalG(f_G, filter_sites=sites)
for epoch in epochs:
    G = ep_co_disp[epoch]
    disp = np.dot(G, slip_co)
    disp_obs = ep_obs[epoch]

    mplt = vj.MapPlotDisplacement()
    mplt.plot_disp(disp_obs, sites, color='red')
    mplt.plot_disp(disp, sites)
    plt.title('%d' % epoch)
    plt.show()