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()
#nth = 34 nth = 15 point_source_file = './outs_He63km_Rake81/day_0000_flt_%04d.out'%nth tp = np.loadtxt(point_source_file) disp0 = tp[:,2:5].flatten() disp1 = G1[:,nth] #scale = 2e-3 scale = 4e-5 bm = vj.MyBasemap(region_code='I') mplt = vj.MapPlotFault(fault_file,basemap=bm) mplt.plot_fault(fno=nth) mplt = vj.MapPlotDisplacement(basemap=bm) mplt.plot_disp(disp0, sites, scale=scale, X=0.2, Y=0.8, U=1e-6, label='point source') mplt.plot_disp(disp1, sites,color='r', scale=scale, X=0.2, Y=0.9, U=1e-6, label='reg source') plt.savefig('~compare.pdf') plt.show()
def _set_basemap(self, region_code): self.basemap = vj.MyBasemap(region_code=region_code)
import numpy as np import viscojapan as vj sites = np.loadtxt('sites_with_seafloor','4a') sites_far_field = np.loadtxt('sites_far_field','4a') bm = vj.MyBasemap( region_code = 'all', ) mplt = vj.MapPlotDisplacement(basemap=bm) mplt.plot_sites(sites, marker='.', color='blue') mplt.plot_sites(sites_far_field,color='red') vj.plot_regions_on_basemap(bm) vj.plt.savefig('regions_and_far_field_sites.png') vj.plt.show() vj.plt.close()
dy = dist.mean() Mo = dx * dy * slip.sum() * 40e9 Mw = 2 / 3 * np.log10(Mo) - 6. return Mo, Mw tp = np.loadtxt('Pollitz-slipmodel.txt') lons = tp[:, 0].reshape([42, -1]) lats = tp[:, 1].reshape([42, -1]) slip = tp[:, 3].reshape([42, -1]) plt.subplot(121) bm = vj.MyBasemap() bm.pcolor(lons, lats, slip, latlon=True) bm.colorbar() mplt = vj.MapPlotSlab() mplt.plot_top() Mo, Mw = compute_moment(lons, lats, slip) plt.title('Mo=%g, Mw=%.2f' % (Mo, Mw)) plt.subplot(122) bm = vj.MyBasemap() bm.colorbar() mplt = vj.MapPlotSlab() mplt.plot_top() with h5py.File(