Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 4
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()
Exemplo n.º 5
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()
Exemplo n.º 6
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()
Exemplo n.º 7
0
from viscojapan.fault_model.fault_file_reader import FaultFileIO
from viscojapan.plots import MapPlotFault, plt, MapPlotSlab

mplt = MapPlotFault('fault_He50km_1.h5')
mplt.plot_fault()

mplt = MapPlotFault('fault_He50km_2.h5')
mplt.plot_fault(color='red')

MapPlotSlab().plot_top()

plt.show()