[cig-commits] r22634 - seismo/2D/SPECFEM2D/trunk/UTILS

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Wed Jul 17 04:04:05 PDT 2013


Author: dkomati1
Date: 2013-07-17 04:04:05 -0700 (Wed, 17 Jul 2013)
New Revision: 22634

Modified:
   seismo/2D/SPECFEM2D/trunk/UTILS/su_Seismic_Unix_seismograms_create.py
Log:
committed an improved version of UTILS/su_Seismic_Unix_seismograms_create.py from Jungrak Son


Modified: seismo/2D/SPECFEM2D/trunk/UTILS/su_Seismic_Unix_seismograms_create.py
===================================================================
--- seismo/2D/SPECFEM2D/trunk/UTILS/su_Seismic_Unix_seismograms_create.py	2013-07-17 11:02:28 UTC (rev 22633)
+++ seismo/2D/SPECFEM2D/trunk/UTILS/su_Seismic_Unix_seismograms_create.py	2013-07-17 11:04:05 UTC (rev 22634)
@@ -1,3 +1,7 @@
+# Jungrak Son (J.Son) from Korea
+# MS student at Texas A&M University, July 2013
+# based on an initial script by Paul Cristini (CNRS, LMA, Marseille, France)
+#
 #!/usr/bin/env python
 #
 #  Python code to generate Seismic Unix files for Ux and Uz and plot them
@@ -10,18 +14,18 @@
 	filename=SEM+'/DATA/Par_file'
 	#
 	# Variables to be put in SU header
-	# 
 	if path.exists(filename):
-		variables=['nt','dt','sismostype']
+		variables=['nt','deltat','seismotype']
 	else:
 		print 'No Par_file found !'
 		return 
-	#     
+
+		
 	# Open the file and get the lines
-	# 
 	f = file(filename,'r')
 	lignes= f.readlines()
 	f.close()
+	
 	# Get the title
 	for ligne in lignes:
 		lsplit=string.split(ligne)
@@ -32,6 +36,7 @@
 	print '#'*50
 	print '#  SU file creation for '+title
 	print  '#'*50
+	
 	#  Get the variables
 	for var in variables:
 		for ligne in lignes:
@@ -40,21 +45,26 @@
 				if lsplit[0]==var:
 					exec var+'='+string.replace(string.split(''.join(ligne))[2],'d','e') 
 					break
-	# 
-	print sismostype
+	#
+	print seismotype
 	chdir(SEM+'/OUTPUT_FILES')
 	labels='label1="Time" label2="Receivers"'
+	
 	# Create headers and Su file
-	if sismostype==4:
-		ordres=['suaddhead < pressure_file_single.bin ns='+str(nt)+' | sushw key=dt a='+str(int(dt*1e6))+' > pressure_file.su']
+	if seismotype==4:
+		ordres=['suaddhead < pressure_file_single.bin ns='+str(nt)+' | sushw key=dt a='+str(int(deltat*1e6))+' > pressure_file.su']
 		ordres.append('suxwigb < pressure_file.su perc=96 '+labels+' title=" Pressure : '+title+'"&')
 	else:
-		ordres=['suaddhead < Ux_file_single.bin ns='+str(nt)+' | sushw key=dt a='+str(int(dt*1e6))+' > Ux_file.su']
-		ordres.append('suaddhead < Uz_file_single.bin ns='+str(nt)+' | sushw key=dt a='+str(int(dt*1e6))+' > Uz_file.su')
+		ordres=['suaddhead < Ux_file_single.bin ns='+str(nt)+' | sushw key=dt a='+str(int(deltat*1e6))+' > Ux_file.su']
+		ordres.append('suaddhead < Uz_file_single.bin ns='+str(nt)+' | sushw key=dt a='+str(int(deltat*1e6))+' > Uz_file.su')
+		ordres.append('supswigp < Ux_file.su > Ux_file.ps '+labels+' title=" Ux : '+title+'"&')
+		ordres.append('supswigp < Uz_file.su > Uz_file.ps '+labels+' title=" Uz : '+title+'"&')
 		ordres.append('suxwigb < Ux_file.su perc=96 '+labels+' title=" Ux : '+title+'"&')
 		ordres.append('suxwigb < Uz_file.su xbox=600 perc=96 '+labels+' title=" Uz : '+title+'"&')
 	# 
 	for i in range(len(ordres)):
-		 system(ordres[i]) 
+		system(ordres[i])
+		print system
+
 if __name__=='__main__':
 	createSU()



More information about the CIG-COMMITS mailing list