[cig-commits] r8470 - in seismo/2D/SPECFEM2D/trunk: . DATA/util
walter at geodynamics.org
walter at geodynamics.org
Fri Dec 7 15:48:45 PST 2007
Author: walter
Date: 2007-12-07 15:48:44 -0800 (Fri, 07 Dec 2007)
New Revision: 8470
Added:
seismo/2D/SPECFEM2D/trunk/su_create_Paul.python
Removed:
seismo/2D/SPECFEM2D/trunk/DATA/util/su_create_Paul.python
Log:
moved su_create_Paul.python to main directory of SPECFEM2D
Deleted: seismo/2D/SPECFEM2D/trunk/DATA/util/su_create_Paul.python
===================================================================
--- seismo/2D/SPECFEM2D/trunk/DATA/util/su_create_Paul.python 2005-02-22 21:56:57 UTC (rev 8469)
+++ seismo/2D/SPECFEM2D/trunk/DATA/util/su_create_Paul.python 2007-12-07 23:48:44 UTC (rev 8470)
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-#
-# Python code to generate Seismic Unix files for Ux and Uz and plot them
-#
-from os import *
-import os.path, string
-#
-def createSU():
- SEM=getcwd()
- filename=SEM+'/DATA/Par_file'
- #
- # Variables to be put in SU header
- #
- if path.exists(filename):
- variables=['nt','dt']
- 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)
- if lsplit[0]=='title':
- title=' '.join(lsplit[2:])
- break
- print '#'*50
- print '# SU file creation for '+title
- print '#'*50
- # Get the variables
- for var in variables:
- for ligne in lignes:
- lsplit=string.split(ligne)
- if lsplit[0]==var:
- exec var+'='+string.replace(string.split(''.join(ligne))[2],'d','e')
- break
- #
- chdir(SEM+'/OUTPUT_FILES')
- labels='label1="Time" label2="Receivers"'
- # Create headers ans Su file
- ordres=['suaddhead < Ux_file.bin ns='+str(nt)+' | sushw key=dt a='+str(int(dt*1e6))+' > Ux_file.su']
- ordres.append('suaddhead < Uz_file.bin ns='+str(nt)+' | sushw key=dt a='+str(int(dt*1e6))+' > Uz_file.su')
- 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])
-if __name__=='__main__':
- createSU()
\ No newline at end of file
Added: seismo/2D/SPECFEM2D/trunk/su_create_Paul.python
===================================================================
--- seismo/2D/SPECFEM2D/trunk/su_create_Paul.python 2005-02-22 21:56:57 UTC (rev 8469)
+++ seismo/2D/SPECFEM2D/trunk/su_create_Paul.python 2007-12-07 23:48:44 UTC (rev 8470)
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Python code to generate Seismic Unix files for Ux and Uz and plot them
+#
+from os import *
+import os.path, string
+#
+def createSU():
+ SEM=getcwd()
+ filename=SEM+'/DATA/Par_file'
+ #
+ # Variables to be put in SU header
+ #
+ if path.exists(filename):
+ variables=['nt','dt','sismostype']
+ 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)
+ if lsplit!= []:
+ if lsplit[0]=='title':
+ title=' '.join(lsplit[2:])
+ break
+ print '#'*50
+ print '# SU file creation for '+title
+ print '#'*50
+ # Get the variables
+ for var in variables:
+ for ligne in lignes:
+ lsplit=string.split(ligne)
+ if lsplit!= []:
+ if lsplit[0]==var:
+ exec var+'='+string.replace(string.split(''.join(ligne))[2],'d','e')
+ break
+ #
+ print sismostype
+ chdir(SEM+'/OUTPUT_FILES')
+ labels='label1="Time" label2="Receivers"'
+ # Create headers ans 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']
+ 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.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])
+if __name__=='__main__':
+ createSU()
\ No newline at end of file
More information about the cig-commits
mailing list