コード例 #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
import h5py

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

fault_file = '../../fault_model/fault_bott60km.h5'
earth_file = 'earth.model_He63km_VisM1.0E19'
for ano in range(30):
    with h5py.File('outs/ano_%02d.h5' % ano, 'r') as fid:
        Bm = nres = fid['Bm'][...]
        slip = Bm[0:-1]
        mplt = MapPlotFault(fault_file)
        mplt.plot_slip(slip)

        mplt = vj.plots.MapPlotDisplacement()
        mplt.plot_sites_seafloor(text=False)

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

        mo, mw = vj.MomentCalculator(fault_file, earth_file).moment(slip)

        plt.title('Mo = %.5g, Mw = %.4f' % (mo, mw))
        #plt.show()
        plt.savefig('plots/ano_%02d.png' % ano)
        plt.close()
コード例 #3
0
ファイル: plot_mo.py プロジェクト: geodesy/viscojapan
import h5py

from pylab import plt

import viscojapan as vj

nreses =[]
rakes = []

com  = vj.MomentCalculator('../../fault_model/fault_bott60km.h5',
                        'earth.model_He63km_VisM1.0E19'
                        )

mos = []
mws = []
for ano in range(30):
    with h5py.File('outs/ano_%02d.h5'%ano,'r') as fid:
        Bm = fid['Bm'][...]
        slip = Bm[0:-1,:]
        mo, mw = com.moment(slip)
        mos.append(mo)
        mws.append(mw)
        
##
##        rake = fid['nlin_pars/rake'][...]
##        rakes.append(rake)
##    
##plt.semilogx(nreses, rakes,'o')
##plt.ylabel('rake')
##plt.xlabel('weighted residual norm')
##plt.xlim([0.7, 4])
コード例 #4
0
from pylab import plt

import viscojapan as vj

reader = vj.ResultFileReader('../outs/nrough_06.h5')
fault_file = '../../fault_model/fault_bott60km.h5'
earth_file = '../../earth_model_nongravity/He50km_VisM6.3E18/earth.model_He50km_VisM6.3E18'

compute = vj.MomentCalculator(fault_file, earth_file)
epochs = reader.epochs
mos = []
mws = []

for nth, epoch in enumerate(epochs):
    aslip = reader.get_total_slip_at_nth_epoch(nth)
    mo, mw = compute.compute_moment(aslip)
    mos.append(mo)
    mws.append(mw)

plt.subplot(211)
plt.plot(epochs, mos)
plt.subplot(212)
plt.plot(epochs, mws)
plt.savefig('total_slip_mo_mw_evolution.png')
plt.close()

mos = []
mws = []
for nth, epoch in enumerate(epochs):
    if nth == 0:
        continue