Example #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()
Example #2
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()
Example #3
0
 def plot_slip(self, slip, fn):
     mplt = MapPlotFault(
         '/home/zy/workspace/viscojapan/inversions/static_inversion/coseismic_inversion_wider/fault_model/fault_He50km_east.h5'
     )
     mplt.plot_slip(slip)
     plt.savefig(join(self.outs_dir, fn))
     plt.close()
Example #4
0
 def test_dip(self):
     dips = self.read_pars('dip')
     MapPlotFault(fault_file=self.original_fault_file).plot_slip(
         dips.reshape([-1, 1]))
     plt.title('dip')
     plt.savefig(join(self.outs_dir, 'dip.png'))
     plt.close()
Example #5
0
    def test_lonlat_grids(self):
        lons = self.read_pars('lons')
        lats = self.read_pars('lats')

        self.plot_original_fault()

        mplt = MapPlot()
        mplt.basemap.plot(lons,lats,
                          latlon=True,marker='.', ls='', color='red')

        MapPlotSlab().plot_top()
        plt.savefig(join(self.outs_dir, 'lonlat.png'))
        plt.close()
Example #6
0
    def test_lonlat_grids(self):
        lons = self.read_pars('lons')
        lats = self.read_pars('lats')

        self.plot_original_fault()

        mplt = MapPlot()
        mplt.basemap.plot(lons,
                          lats,
                          latlon=True,
                          marker='.',
                          ls='',
                          color='red')

        MapPlotSlab().plot_top()
        plt.savefig(join(self.outs_dir, 'lonlat.png'))
        plt.close()
Example #7
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()
Example #8
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()
Example #9
0
for file in files:    
    print(file)
    bn = os.path.basename(file).split('.')[0]
    plot_dir = 'plots/%s'%bn
    if not exists(plot_dir):
        makedirs(plot_dir)
    
    with h5py.File(file) as fid:
        Bm = fid['Bm'][...]
        d_pred = fid['d_pred'][...]

    for nth, epoch in enumerate(epochs[1:]):    
        print(epoch)
        mplt = MapPlotFault(fault_file)
        mplt.plot_slip(Bm[nth*num_subflts:
                          (nth+1)*num_subflts])

##        mplt = vj.MapPlotDisplacement()
##        mplt.plot_disp(d_pred[nth*num_obs:
##                              (nth+1)*num_obs],sites, scale=scale)
##        sites = [ii.decode() for ii in d_ep.sites]
##        mplt.plot_disp(d_ep[epoch], sites, color='red', scale=scale)
        
        mplt = MapPlotSlab()
        mplt.plot_top()
        
        savefig(join(plot_dir, 'incr_slip_%04d.png'%epoch))
        # plt.show()
        plt.close()
Example #10
0
for file in files:    
    print(file)
    bn = os.path.basename(file).split('.')[0]
    plot_dir = 'plots/%s'%bn
    if not exists(plot_dir):
        makedirs(plot_dir)
    
    with h5py.File(file) as fid:
        Bm = fid['Bm'][...]
        d_pred = fid['d_pred'][...]

    for nth, epoch in enumerate(epochs[1:]):    
        print(epoch)
        mplt = MapPlotFault(fault_file)
        mplt.plot_slip(Bm[nth*num_subflts:
                          (nth+1)*num_subflts])

##        mplt = vj.MapPlotDisplacement()
##        mplt.plot_disp(d_pred[nth*num_obs:
##                              (nth+1)*num_obs],sites, scale=scale)
##        sites = [ii.decode() for ii in d_ep.sites]
##        mplt.plot_disp(d_ep[epoch], sites, color='red', scale=scale)
        
        mplt = MapPlotSlab()
        mplt.plot_top()
        
        savefig(join(plot_dir, 'incr_slip_%04d.png'%epoch))
        # plt.show()
        plt.close()
Example #11
0
 def plot_slip(self, slip, fn):
     fault_file = '/home/zy/workspace/viscojapan/tests/share/fault_bott80km.h5'
     mplt = MapPlotFault(fault_file)
     mplt.plot_slip(slip)
     plt.savefig(join(self.outs_dir, fn))
     plt.close()
Example #12
0
 def test_dep_top(self):
     dips = self.read_pars('top')
     MapPlotFault(fault_file=self.original_fault_file).pcolor_on_fault(dips)
     plt.title('top')
     plt.savefig(join(self.outs_dir, 'dep_top.png'))
     plt.close()
 def plot_slip(self, slip, fn):
     fault_file = '/home/zy/workspace/viscojapan/tests/share/fault_bott80km.h5'
     mplt = MapPlotFault(fault_file)
     mplt.plot_slip(slip)
     plt.savefig(join(self.outs_dir,fn))
     plt.close()
 def plot_slip(self, slip, fn):
     mplt = MapPlotFault('/home/zy/workspace/viscojapan/inversions/static_inversion/coseismic_inversion_wider/fault_model/fault_He50km_east.h5')
     mplt.plot_slip(slip)
     plt.savefig(join(self.outs_dir,fn))
     plt.close()
Example #15
0
 def test_dip(self):
     dips = self.read_pars('dip')
     MapPlotFault(fault_file = self.original_fault_file).plot_slip(dips.reshape([-1,1]))
     plt.title('dip')
     plt.savefig(join(self.outs_dir, 'dip.png'))
     plt.close()
Example #16
0
 def test_dep_top(self):
     dips = self.read_pars('top')
     MapPlotFault(fault_file = self.original_fault_file).pcolor_on_fault(dips)
     plt.title('top')
     plt.savefig(join(self.outs_dir, 'dep_top.png'))
     plt.close()