[cig-commits] r14563 - seismo/3D/SPECFEM3D_SESAME/trunk/UTILS/sac2000_alpha_convert

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Wed Apr 1 17:43:30 PDT 2009


Author: dkomati1
Date: 2009-04-01 17:43:30 -0700 (Wed, 01 Apr 2009)
New Revision: 14563

Modified:
   seismo/3D/SPECFEM3D_SESAME/trunk/UTILS/sac2000_alpha_convert/convert_files_sacalpha_ascii.f90
Log:
added an option to suppress negative times


Modified: seismo/3D/SPECFEM3D_SESAME/trunk/UTILS/sac2000_alpha_convert/convert_files_sacalpha_ascii.f90
===================================================================
--- seismo/3D/SPECFEM3D_SESAME/trunk/UTILS/sac2000_alpha_convert/convert_files_sacalpha_ascii.f90	2009-04-01 23:08:31 UTC (rev 14562)
+++ seismo/3D/SPECFEM3D_SESAME/trunk/UTILS/sac2000_alpha_convert/convert_files_sacalpha_ascii.f90	2009-04-02 00:43:30 UTC (rev 14563)
@@ -5,8 +5,12 @@
 
   implicit none
 
-  integer it,nstep,istep
+! output only positive times, or also output negative times (that can happen
+! for instance due to the time shift of the source)
+  logical, parameter :: ALSO_OUTPUT_NEGATIVE_TIMES = .false.
 
+  integer i,it,nstep,istep
+
   double precision dt,t0,val1,val2,val3,val4,val5
   double precision dummy1,dummy2,dummy3,dummy4
 
@@ -15,35 +19,38 @@
   read(5,*) dt
   read(5,*) t0
 
-  do it=1,13
+  do i = 1,13
     read(5,*)
   enddo
 
   read(5,*) dummy1,dummy2,dummy3,dummy4,nstep
 
-  do it=1,14
+  do i = 1,14
     read(5,*)
   enddo
 
 !! DK DK in sac2000 ALPHA format, there are 5 ASCII values per line
+!! DK DK in this simple code, if nstep is not a multiple of 5 the last values
+!! DK DK are ignored, but this is negligible because nstep is always large
+!! DK DK therefore nstep and nstep - 4 are almost the same
   it = 0
   do istep = 1,nstep/5
     read(5,*) val1,val2,val3,val4,val5
 
     it = it + 1
-    write(*,*) sngl(t0 + (it-1)*dt),sngl(val1)
+    if(t0 + (it-1)*dt >= 0 .or. ALSO_OUTPUT_NEGATIVE_TIMES) write(*,*) sngl(t0 + (it-1)*dt),sngl(val1)
 
     it = it + 1
-    write(*,*) sngl(t0 + (it-1)*dt),sngl(val2)
+    if(t0 + (it-1)*dt >= 0 .or. ALSO_OUTPUT_NEGATIVE_TIMES) write(*,*) sngl(t0 + (it-1)*dt),sngl(val2)
 
     it = it + 1
-    write(*,*) sngl(t0 + (it-1)*dt),sngl(val3)
+    if(t0 + (it-1)*dt >= 0 .or. ALSO_OUTPUT_NEGATIVE_TIMES) write(*,*) sngl(t0 + (it-1)*dt),sngl(val3)
 
     it = it + 1
-    write(*,*) sngl(t0 + (it-1)*dt),sngl(val4)
+    if(t0 + (it-1)*dt >= 0 .or. ALSO_OUTPUT_NEGATIVE_TIMES) write(*,*) sngl(t0 + (it-1)*dt),sngl(val4)
 
     it = it + 1
-    write(*,*) sngl(t0 + (it-1)*dt),sngl(val5)
+    if(t0 + (it-1)*dt >= 0 .or. ALSO_OUTPUT_NEGATIVE_TIMES) write(*,*) sngl(t0 + (it-1)*dt),sngl(val5)
 
   enddo
 



More information about the CIG-COMMITS mailing list