Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
time_epi=None
else:
time_epi=UTCDateTime(time_epi)
rise_time_depths=[rise_time_depths0,rise_time_depths1]
#hypocenter=[hypocenter_lon,hypocenter_lat,hypocenter_dep]
tMw=tMw.split(',')
target_Mw=zeros(len(tMw))
for rMw in range(len(tMw)):
target_Mw[rMw]=float(tMw[rMw])
#Should I calculate or load the distances?
if load_distances==1:
Dstrike=load(home+project_name+'/data/distances/'+distances_name+'.strike.npy')
Ddip=load(home+project_name+'/data/distances/'+distances_name+'.dip.npy')
else:
Dstrike,Ddip=fakequakes.subfault_distances_3D(home,project_name,fault_name,slab_name,UTM_zone)
save(home+project_name+'/data/distances/'+distances_name+'.strike.npy',Dstrike)
save(home+project_name+'/data/distances/'+distances_name+'.dip.npy',Ddip)
#Read fault and prepare output variable
whole_fault=genfromtxt(home+project_name+'/data/model_info/'+fault_name)
#Get structure model
vel_mod_file=home+project_name+'/structure/'+model_name
#Get TauPyModel
velmod = TauPyModel(model=home+project_name+'/structure/'+model_name.split('.')[0])
#Now loop over the number of realizations
realization=0
if rank==0:
source_time_function='cosine' # options are 'triangle' or 'cosine'
num_modes=50
rake=90.0
rise_time_depths=[10,15] #Transition depths for rise time scaling
buffer_factor=0.5
###############################################################################
#Initalize project folders
if init==1:
fakequakes.init(home,project_name)
#Generate rupture models
if make_ruptures==1:
fakequakes.generate_ruptures(home,project_name,run_name,fault_name,slab_name,
mesh_name,load_distances,distances_name,UTM_zone,target_Mw,model_name,
hurst,Ldip,Lstrike,num_modes,Nrealizations,rake,buffer_factor,
rise_time_depths,time_epi,max_slip,source_time_function,lognormal,
slip_standard_deviation)
print '-- Now making plots --\n'
viewFQ.plot_KLslip(home,project_name,run_name,mesh_name)
# Prepare waveforms and synthetics
if make_GFs==1 or make_synthetics==1:
runslip.inversionGFs(home,project_name,GF_list,None,fault_name,model_name,
dt,None,NFFT,None,make_GFs,make_synthetics,dk,pmin,
pmax,kmax,0,time_epi,0,ncpus,custom_stf,impulse=True)
if make_waveforms==1:
forward.waveforms_fakequakes(home,project_name,fault_name,rupture_list,GF_list,
model_name,run_name,dt,NFFT,G_from_file,G_name,source_time_function)
G_name='GFs'
# Displacement and velocity waveform parameters
NFFT=128 ; dt=1.0
#fk-parameters
dk=0.1 ; pmin=0 ; pmax=1 ; kmax=20
custom_stf=None
###############################################################################
#Initalize project folders
if init==1:
fakequakes.init(home,project_name)
#Generate rupture models
if make_ruptures==1:
fakequakes.generate_ruptures(home,project_name,run_name,fault_name,slab_name,
mesh_name,load_distances,distances_name,UTM_zone,target_Mw,model_name,hurst,Ldip,
Lstrike,num_modes,Nrealizations,rake,buffer_factor,rise_time_depths,time_epi,
max_slip,source_time_function,lognormal,slip_standard_deviation,scaling_law,ncpus,
force_magnitude=force_magnitude,force_area=force_area,mean_slip_name=mean_slip,
hypocenter=hypocenter,force_hypocenter=force_hypocenter,no_random=no_random,
shypo=center_subfault,use_hypo_fraction=use_hypo_fraction,shear_wave_fraction=shear_wave_fraction)
# Prepare waveforms and synthetics
if make_GFs==1 or make_synthetics==1:
runslip.inversionGFs(home,project_name,GF_list,None,fault_name,model_name,
dt,None,NFFT,None,make_GFs,make_synthetics,dk,pmin,
#fk-parameters
dk=0.1 ; pmin=0 ; pmax=1 ; kmax=20
custom_stf=None
###############################################################################
#Initalize project folders
if init==1:
fakequakes.init(home,project_name)
#Generate rupture models
if make_ruptures==1:
fakequakes.generate_ruptures(home,project_name,run_name,fault_name,slab_name,
mesh_name,load_distances,distances_name,UTM_zone,target_Mw,model_name,hurst,Ldip,
Lstrike,num_modes,Nrealizations,rake,buffer_factor,rise_time_depths,time_epi,
max_slip,source_time_function,lognormal,slip_standard_deviation,scaling_law,ncpus,
force_magnitude=force_magnitude,force_area=force_area,mean_slip_name=mean_slip,
hypocenter=hypocenter,force_hypocenter=force_hypocenter,no_random=no_random,
shypo=center_subfault,use_hypo_fraction=use_hypo_fraction,shear_wave_fraction=shear_wave_fraction)
# Prepare waveforms and synthetics
if make_GFs==1 or make_synthetics==1:
runslip.inversionGFs(home,project_name,GF_list,None,fault_name,model_name,
dt,None,NFFT,None,make_GFs,make_synthetics,dk,pmin,
pmax,kmax,0,time_epi,0,ncpus,custom_stf,impulse=True)
# Synthesize the waveforms
if make_waveforms==1:
slip_standard_deviation=0.9
# Rupture parameters
time_epi=UTCDateTime('2016-09-07T14:42:26')
source_time_function='cosine' # options are 'triangle' or 'cosine'
num_modes=50
rake=90.0
rise_time_depths=[10,15] #Transition depths for rise time scaling
buffer_factor=0.5
###############################################################################
#Initalize project folders
if init==1:
fakequakes.init(home,project_name)
#Generate rupture models
if make_ruptures==1:
fakequakes.generate_ruptures(home,project_name,run_name,fault_name,slab_name,
mesh_name,load_distances,distances_name,UTM_zone,target_Mw,model_name,
hurst,Ldip,Lstrike,num_modes,Nrealizations,rake,buffer_factor,
rise_time_depths,time_epi,max_slip,source_time_function,lognormal,
slip_standard_deviation)
print '-- Now making plots --\n'
viewFQ.plot_KLslip(home,project_name,run_name,mesh_name)
# Prepare waveforms and synthetics
if make_GFs==1 or make_synthetics==1:
runslip.inversionGFs(home,project_name,GF_list,None,fault_name,model_name,
dt,None,NFFT,None,make_GFs,make_synthetics,dk,pmin,
pmax,kmax,0,time_epi,0,ncpus,custom_stf,impulse=True)