예제 #1
0
f_table=open('run_MECA.tbl','w')
f_table.write('Cluster# lon lat depth num_polarities STR DIP RAKE error_F error_A pol_mis STDR\n')

##### Go through each index_file in a loop

for index_file in list_index:
	
	clus_number=int(index_file[-8:-4])
	f_log.write('Processing Cluster %i associated with file %s\n' %(clus_number,index_file))
	if clus_number>22:
		continue
		
	##### Run HASH 1st time to get number of polarity pspolar.inp
	
	print 'running HASH for cluster number %i' %clus_number
	run_HASH(data_path+index_file,parameter=None)
	os.system('read_FOCMEC.py focmec.dat')

	f_scratch=open('foc_polar.out','r')
	total_pol=len(f_scratch.readlines())
	f_scratch.close()
	f_log.write('Total number of polarities: %i \n' %total_pol)
	
	print total_pol
	if total_pol!=0:
	
		#### RUN HASH 2nd time with correct parameter
		#### Define parameters for HASH
	
		grid_angle=5
		max_pol_error=np.floor(0.1*total_pol)
예제 #2
0
파일: get_FOC.py 프로젝트: ChrisBail/NEW
os.system(cmd)
list_index=glob.glob('index*[0-9][0-9][0-9][0-9].out')
print list_index

#######  Start loop in index files

for file in list_index:

	event_number=int(file[-8:-4])

	###### Compute Focal Mechanism

	##### Run HASH 1st time to get number of polarity pspolar.inp

	print 'running HASH 1st time to get number of polarities'
	run_HASH('./'+file,parameter=None)

	##### Read hyp.out to get lon/lat/depth of event
	
	cmd='nor2xyz hyp.out > tmp/temp_hyp.xyz' 
	os.system(cmd)

	fat=open('tmp/temp_hyp.xyz','r')
	for line in fat:
		B=line.split()
		lon=float(B[0])
		lat=float(B[1])
		depth=float(B[2])
		print lon,lat,depth
	fat.close()
	os.remove('tmp/temp_hyp.xyz')