[cig-commits] r15807 - seismo/3D/SPECFEM3D_SESAME/trunk

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Wed Oct 14 04:09:41 PDT 2009


Author: dkomati1
Date: 2009-10-14 04:09:41 -0700 (Wed, 14 Oct 2009)
New Revision: 15807

Added:
   seismo/3D/SPECFEM3D_SESAME/trunk/ascii_2_sep.f90
Log:
added a program to convert ASCII seismograms to binary SEP format


Added: seismo/3D/SPECFEM3D_SESAME/trunk/ascii_2_sep.f90
===================================================================
--- seismo/3D/SPECFEM3D_SESAME/trunk/ascii_2_sep.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D_SESAME/trunk/ascii_2_sep.f90	2009-10-14 11:09:41 UTC (rev 15807)
@@ -0,0 +1,41 @@
+
+  program ascii_2_sep
+
+! to convert ASCII seismograms to SEP binary format
+
+  implicit none
+
+! Parameters to be defined to set the dimension of the arrays:
+! - nr = maximum number of receivers.
+! - ntime = maximum number of points of each seismogram.
+  integer, parameter :: nr = 101
+  integer, parameter :: ntime = 512
+
+  real(kind=4), dimension(ntime,nr) :: sy
+
+  integer :: it,ir,i
+
+! read seismogram component in ASCII text format
+  print *,'Reading seismograms in text format'
+
+  open(unit=11,file='U_file.txt',status='unknown')
+  do ir=1,nr
+    do it=1,ntime
+      read(11,*) sy(it,ir)
+
+! invert sign of vertical component if needed depending on the reference frame convention
+!     sy(it,ir) = - sy(it,ir)
+
+    enddo
+  enddo
+  close(11)
+
+! write seismogram component in binary SEP format
+  print *,'Saving seismograms in SEP format'
+
+  open(unit=11,file='U_file.sep',status='unknown',access='direct',recl=ntime*nr*4)
+  write(11,rec=1) (sy(i,1),i=1,ntime*nr)
+  close(11)
+
+  end program ascii_2_sep
+



More information about the CIG-COMMITS mailing list