[cig-commits] r15698 - seismo/3D/ADJOINT_TOMO/measure_adj

carltape at geodynamics.org carltape at geodynamics.org
Mon Sep 28 11:33:22 PDT 2009


Author: carltape
Date: 2009-09-28 11:33:21 -0700 (Mon, 28 Sep 2009)
New Revision: 15698

Modified:
   seismo/3D/ADJOINT_TOMO/measure_adj/mt_measure_adj.f90
   seismo/3D/ADJOINT_TOMO/measure_adj/mt_sub.f90
Log:
Updated print statements for error messages, so that the error message is sure to print to the output file.  The word "Error" is searched in the output run file to detect problems.


Modified: seismo/3D/ADJOINT_TOMO/measure_adj/mt_measure_adj.f90
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/mt_measure_adj.f90	2009-09-28 16:07:57 UTC (rev 15697)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/mt_measure_adj.f90	2009-09-28 18:33:21 UTC (rev 15698)
@@ -14,7 +14,7 @@
   character(len=150) :: out_dir,datafile,synfile,file_prefix,file_prefix0,file_prefix2,measure_file_prefix,adj_file_prefix
 
   integer :: num_files, num_meas, i, j, k, iker, iker0, &
-     ios, is_mtm, is_mtm0, npt1, npt2, npts, nn
+     ios, is_mtm, is_mtm0, npt1, npt2, npts, nn, nerr
   double precision, dimension(NDIM) :: data, syn, adj_syn_all, tr_adj_src, am_adj_src, recon_cc_all, tseis_recon_cc
   double precision :: t01, dt1, t02, dt2, t0, dt, tstart, tend, chi, tt, dtt, df
   double precision, dimension(NCHI) :: window_chi
@@ -102,11 +102,11 @@
   print *, '  DT_SIGMA_MIN, DLNA_SIGMA_MIN :',DT_SIGMA_MIN, DLNA_SIGMA_MIN
   !stop 'checking PAR file input'
 
-  if (fstart0 >= fend0) stop 'Check input frequency range of the signal'
-  if (iker == 1 .and. is_mtm /= 1) stop 'Error: make MT measurements before compute MT adjoint source'
-  if (iker == 0 .and. is_mtm /= 0) stop 'Error: iker=0 and is_mtm=0 for waveform difference'
-  if (iker /= 0 .and. is_mtm == 0) stop 'Error: iker=0 and is_mtm=0 for waveform difference'
-  if (nn > NDIM) stop 'Change interpolation nn or NDIM'
+  if (fstart0 >= fend0) then ; print *, 'Check input frequency range of the signal' ; stop ; endif
+  if (iker == 1 .and. is_mtm /= 1) then ; print *, 'Error: make MT measurements before compute MT adjoint source' ; stop ; endif
+  if (iker == 0 .and. is_mtm /= 0) then ; print *, 'Error: iker=0 and is_mtm=0 for waveform difference' ; stop ; endif
+  if (iker /= 0 .and. is_mtm == 0) then ; print *, 'Error: iker=0 and is_mtm=0 for waveform difference' ; stop ; endif
+  if (nn > NDIM) then ; print *, 'Error: Change interpolation nn or NDIM' ; stop ; endif 
 
   ! apply filter (this should EXACTLY match the filter used in the windowing code)
   !trbdndw = 0.3
@@ -116,9 +116,9 @@
 
   ! input file: MEASUREMENT.WINDOWS
   open(11,file='MEASUREMENT.WINDOWS',status='old',iostat=ios)
-  if (ios /= 0) stop 'Error opening input file: MEASUREMENT WINDOWS'
+  if (ios /= 0) then ; print *, 'Error opening input file: MEASUREMENT WINDOWS' ; stop ; endif
   read(11,*,iostat=ios) npairs
-  if (ios /= 0) stop 'Error reading number of pairs of data/syn'
+  if (ios /= 0) then ; print *, 'Error reading number of pairs of data/syn' ; stop ; endif
   print *, 'reading in the data and synthetics...'
 
   ! output files
@@ -135,10 +135,9 @@
     recon_cc_all(:) = 0.0
 
     read(11,'(a)',iostat=ios) datafile
-    if (ios /= 0) stop 'Error reading datafile'
-
+    if (ios /= 0) then ; print *, 'Error reading windows file' ; stop ; endif
     read(11,'(a)',iostat=ios) synfile
-    if (ios /= 0) stop 'Error reading synfile'
+    if (ios /= 0) then ; print *, 'Error reading windows file' ; stop ; endif
 
 !!$    ! read in data (SAC format)
 !!$    !call dread_ascfile_f(datafile,t01,dt1,npt1,data) ! ASCII format
@@ -153,10 +152,13 @@
     call drsac1(synfile,syn,npt2,t02,dt2)
     !print *, npt1,t01,dt1,NDIM    ! check: double precision
 
-    if (max(npt1,npt2) > NDIM) stop 'Too many number of points in data or syn'
+    if (max(npt1,npt2) > NDIM) then
+        print *, 'Error: Too many number of points in data or syn'
+        stop
+    endif
 
     ! check if t0 and dt match
-    if (abs(dt1-dt2) > TOL) stop 'Check if dt match'
+    if (abs(dt1-dt2) > TOL) then ; print *, 'Error: check if dt match' ; stop ; endif
     dt = dt1
     npts = min(npt1,npt2) 
 
@@ -208,18 +210,20 @@
       adj_file_prefix = trim(file_prefix2) // '.bdcc'
     else
       print *, 'iker = ', iker
-      stop 'iker must be 0, 1, 2, or 3'
+      print *, 'Error: iker must be 0, 1, 2, or 3'
+      stop
     endif
     print *
     print *, trim(file_prefix2), ' --- '
 
     read(11,*,iostat=ios) num_meas
-    if (ios /= 0) stop 'Error reading num_meas'
+    if (ios /= 0) then ; print *, 'Error reading num_meas' ; stop ; endif
 
     do j = 1, num_meas   
 
       read(11,*,iostat=ios) tstart, tend
-      if (ios /= 0) stop 'Error reading tstart and tend'
+      if (ios /= 0) then ; print *, 'Error reading tstart and tend' ; stop ; endif
+
       tstart = max(tstart,t0)
       tend = min(tend, t0+(npts-1)*dt)
       nlen = floor((tend-tstart)/dt) + 1   ! see subroutine interpolate_data_and_syn
@@ -402,7 +406,7 @@
 
     ! write SAC file
     call dwsac1(trim(file_prefix2)//'.recon.cc.sac',recon_cc_all,npts,t0,dt)
-    
+    if (nerr > 0) then ; print *, 'Error writing reconstructed CC file' ; stop ; endif
     !call dwrite_sacfile_f(trim(datafile),trim(file_prefix2)//'.recon.cc',t0,npts,recon_cc_all)
 
   enddo ! npairs

Modified: seismo/3D/ADJOINT_TOMO/measure_adj/mt_sub.f90
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/mt_sub.f90	2009-09-28 16:07:57 UTC (rev 15697)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/mt_sub.f90	2009-09-28 18:33:21 UTC (rev 15698)
@@ -936,7 +936,10 @@
     
     ! read file as single precision
     call rsac1(datafile,dat_sngl,npt1,b1_sngl,dt1_sngl,NDIM,nerr)
-    if (nerr > 0) stop ' Error reading sac file'
+    if (nerr > 0) then 
+       print *, 'Error reading sac file', trim(datafile)
+       stop
+    endif
 
     ! return double precision quantities
     b1 = dble(b1_sngl)
@@ -988,7 +991,10 @@
     else
        call wsac1(datafile,dat_sngl,npt1,b1_sngl,dt1_sngl,nerr)
     endif
-    if (nerr > 0) stop ' Error writing sac file'
+    if (nerr > 0) then
+        print *, 'Error writing sac file', trim(datafile)
+        stop
+    endif
 
   end subroutine dwsac1
 



More information about the CIG-COMMITS mailing list