Esempio n. 1
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()
Esempio n. 2
0
from viscojapan.inversion.inversion_test import GaussianSlip, gen_error_for_sites
from viscojapan.plots import MapPlotFault, plt, MapPlotDisplacement
from viscojapan import EpochalG
import viscojapan as vj

if_plot = False

fault_file = '../fault_model/fault_He50km.h5'
gslip = GaussianSlip.create_from_fault_file(fault_file)

slip = gslip(0)

if if_plot:
    mplt = MapPlotFault(fault_file)
    mplt.plot_slip(slip)
    plt.show()

file_G = '../greens_function/G_Rake80.h5'
g = EpochalG(file_G)
sites = g.sites

G = g(0)

d_pred = dot(G, slip.reshape([-1, 1]))

if if_plot:
    mplt = MapPlotDisplacement()
    mplt.plot_disp(d_pred, sites)
    plt.show()
Esempio n. 3
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()
Esempio n. 4
0
import glob
from os.path import basename, exists

import h5py

from viscojapan.plots import MapPlotFault, plt

files = glob.glob('outs/ano_??_edg_??.h5')

for ano in range(30):
    for file in files:
        name = basename(file)
        fname = 'plots/%s.png'%name
        if exists(fname):
            print('Skip %s!'%fname)
            continue
        print(fname)
        with h5py.File(file,'r') as fid:
            slip = nres = fid['Bm'][...]
        mplt = MapPlotFault('fault_bott40km.h5')
        mplt.plot_slip(slip)
        #plt.show()
        plt.savefig(fname)
        plt.close()
Esempio n. 5
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()
Esempio n. 6
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()
Esempio n. 7
0
import h5py
import glob
import os

import viscojapan as vj
from viscojapan.plots import MapPlotFault, plt

files = sorted(glob.glob('outs/dip3_stk4_ano_??.h5'))

for file in files:
    f1 = os.path.basename(file)
    with h5py.File(file, 'r') as fid:
        slip = nres = fid['Bm'][...]
        mplt = MapPlotFault('../../fault_model/fault_bott80km.h5')
        mplt.plot_slip(slip, zorder=-2, cb_shrink=0.7, cb_pad=0.1)

        mplt = vj.plots.MapPlotSlab()
        mplt.plot_top()

        plt.clim([0, 2])
        #plt.show()

        plt.savefig(os.path.join('plots', f1.split('.')[0] + '.png'))

        plt.savefig(os.path.join('plots', f1.split('.')[0] + '.pdf'))

        plt.close()
Esempio n. 8
0
import h5py
import glob
import os

import viscojapan as vj
from viscojapan.plots import MapPlotFault, plt

files = sorted(glob.glob('outs/dip3_stk4_ano_??.h5'))

for file in files:
    f1 = os.path.basename(file)
    with h5py.File(file ,'r') as fid:
        slip = nres = fid['Bm'][...]
        mplt = MapPlotFault('../../fault_model/fault_bott80km.h5')
        mplt.plot_slip(slip, zorder=-2,
                       cb_shrink=0.7,
                       cb_pad = 0.1)

        mplt = vj.plots.MapPlotSlab()
        mplt.plot_top()
        
        
        plt.clim([0,2])
        #plt.show()
        
        plt.savefig(
            os.path.join('plots',f1.split('.')[0]+'.png')
            )

        plt.savefig(
            os.path.join('plots',f1.split('.')[0]+'.pdf')
 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()