#process the quadtree file #home='/Users/dmelgar/Slip_inv/' #project_name='Ixtepec' #file_in=u'/Users/dmelgar/Ixtepec2017/InSAR/T107_Ascending/ascending_quadtree.los' #gf_list=home+project_name+'/data/station_info/ascending.gflist' #prefix='AS' # #insartools.quadtree2mudpy(home,project_name,file_in,gf_list,prefix) # making the fault geometry fault_file='/Users/dmelgar/Slip_inv/Ixtepec/data/model_info/usgs_NP1.fault' strike=79 dip=55 num_columns=20 dx_strike=2.0 dx_dip=2.0 hypocenter=[-95.168597, 16.494261,10.0] number_updip=5 number_downdip=5 rise_time=1.0 forward.makefault(fault_file,strike,dip,num_columns,dx_strike, dx_dip,hypocenter,number_updip,number_downdip,rise_time)
fout_rupt = '/Users/dmelgar/Iquique2014/GFZ_model/iquique_gfz.rupt' n = len(f) / 2 #split in two f1 = f[0:n, :] f2 = f[n:, :] lonlat = f1[:, 0:2] lonlat = fliplr(lonlat) ss = f1[:, 8] ds = f2[:, 8] S = (ss**2 + ds**2)**0.5 #now make geometry of finely discretized fault #forward.makefault(fout,strike,dip,45,3.0,3.0,[-70.593,-19.70,29.36],13,13,0.5) forward.makefault(fout, strike, dip, 65, 3.0, 3.0, [-70.593, -19.70, 29.36], 30, 30, 0.5) f = genfromtxt(fout) #Make mean rupture model slip_out = zeros((len(f), 1)) for k in range(len(f)): if k % 100 == 0: print k dist = sqrt((f[k, 1] - lonlat[:, 0])**2 + (f[k, 2] - lonlat[:, 1])**2) slip_out[k, 0] = S[argmin(dist)] out = c_[f[:, 0:8], zeros((len(f), 1)), slip_out, f[:, -2:], zeros((len(f), 2))] savetxt( fout_rupt,
strike = 163 dip = 74 rake = 180 f = genfromtxt( '/Users/dmelgar/Napa2014/stochastic/inversion/v_fine1.0014.inv.total') fout = '/Users/dmelgar/Napa2014/stochastic/inversion/napa_200m.fault' fout_rupt = '/Users/dmelgar/Napa2014/stochastic/inversion/napa_200m.rupt' lonlat = f[:, 1:3] ss = f[:, 8] ds = f[:, 9] S = (ss**2 + ds**2)**0.5 #now make geometry of finely discretized fault forward.makefault(fout, strike, dip, 173, 0.2, 0.2, [-122.3174, 38.2118, 10.729], 55, 22, 0.5) f = genfromtxt(fout) #Make mean rupture model slip_out = zeros((len(f), 1)) for k in range(len(f)): if k % 100 == 0: print k dist = sqrt((f[k, 1] - lonlat[:, 0])**2 + (f[k, 2] - lonlat[:, 1])**2) slip_out[k, 0] = S[argmin(dist)] #trim edges i = arange(50, 173) iout = i.copy() for k in range(1, 78): iout = r_[iout, i + (173 * k)]
fout2 = '/Users/dmelgar/Slip_inv/wenc_2008/data/model_info/wenc_unilateral.fault' #Number of subfaults along strike nstrike = 74 #Number of subfaults ABOVE the hypocenter num_updip = 2 #Number of subfaults BELOW the hypocenter num_downdip = 5 #Define size of subfaults dx_strike = 7 #In km dx_dip = 7 #In km # epicenter = array([103.36, 31.0, 12]) #I used the USGS one #Rise time rise_time = 3.0 #Make the fault makefault(strike, dip, nstrike, dx_dip, dx_strike, epicenter, num_updip, num_downdip, rise_time, fout) #Read the model you just made so you can make a plot and some editting fault = genfromtxt(fout) #Make a quick plot so you can see the model plt.figure() plt.scatter(fault[:, 1], fault[:, 2]) plt.scatter(epicenter[0], epicenter[1], c='r', s=80) plt.title('Bilateral model') plt.show() # Ok now make unialteral model, we will keep all subfaults north of the hypocenter # but we will only keep 2 columns of faults to the south. This is determined # by looking at the plot of the subfaults ndip = num_updip + num_downdip + 1 #Total number of rows of subfaults
# Script used to ############################################################################### import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from numpy import genfromtxt from mudpy import forward fout = '/Users/tnye/FakeQuakes/Mentawai2010_fine/data/model_info/mentawai_fine.fault' strike = 324 dip = 7.5 rise_time = 8 epicenter = [99.805960, -3.348720, 9.079] nstrike = 78 dx_dip = 2 dx_strike = 2 num_updip = 19 num_downdip = 17 forward.makefault(fout, strike, dip, nstrike, dx_dip, dx_strike, epicenter, num_updip, num_downdip, rise_time) o = genfromtxt( '/Users/tnye/FakeQuakes/Mentawai2010/data/model_info/Mentawai_model.fault') f = genfromtxt( '/Users/tnye/FakeQuakes/Mentawai2010_fine/data/model_info/mentawai_fine.fault' ) fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(f[:, 1], f[:, 2], -f[:, 3], c='blue') ax.scatter(o[:, 1], o[:, 2], -o[:, 3], c='red')