[cig-commits] r13113 - seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS

carltape at geodynamics.org carltape at geodynamics.org
Tue Oct 21 11:20:59 PDT 2008


Author: carltape
Date: 2008-10-21 11:20:58 -0700 (Tue, 21 Oct 2008)
New Revision: 13113

Modified:
   seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl
Log:
Minor update to make_pdf_by_station.pl


Modified: seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl	2008-10-21 10:07:05 UTC (rev 13112)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl	2008-10-21 18:20:58 UTC (rev 13113)
@@ -21,7 +21,7 @@
 #================================================================
 # USER INPUT
 
-$emin = 10;         # number of events recorded by a station required to make a composite PDF
+$emin = 1;         # number of events recorded by a station required to make a composite PDF
 $smodel = "m12";
 $Ttag = "T006_T030";
 $isort = 2;         # sorted stations by distance (1) or azimuth (2)
@@ -59,7 +59,7 @@
 #--------------------------------------
 
 $imin = 1; $imax = $nrec;
-#$imin = 139; $imax = $imin;
+#$imin = 308; $imax = $imin;
 
 # loop over all the stations in the sorted list
 for ($ik = $imin; $ik <= $imax; $ik = $ik+1) {
@@ -78,41 +78,50 @@
   open(IN,"${event_sort}"); @elines = <IN>; close(IN); $nevent = @elines;
   print "$nevent events in the list \n";
 
-  # loop over all possible events
-  for ($j = 1; $j <= $nevent; $j = $j+1) {
+  # output file
+  $ofile = "${station}_${network}_${Ttag}_${smodel}_ALL.pdf";
 
-    # get the event ID in the sorted list
-    ($eid,$elon,$elat,undef,undef,undef,undef,undef) = split(" ",$elines[$j-1]);
+  if (-f $ofile) {
+    print "--> $ofile already exists\n";
 
-    # EXAMPLE: 9828889_T006_T030_GSC_CI_m12_cc_win_adj.pdf
-    @files = glob("${eid}_${Ttag}_${station}_${network}_${smodel}*pdf");
-    $numf = @files;
-    if ($numf == 0) {
-      #print "--> no pdf file exists\n";
+  } else {    
+    # loop over all possible events
+    for ($j = 1; $j <= $nevent; $j = $j+1) {
 
-    } elsif ($numf == 1) {
-      #print "--> pdf file exists\n";
-      $pdffile = $files[0]; chomp($pdffile);
-      $pdcat[$k] = $pdffile; $k = $k+1;
+      # get the event ID in the sorted list
+      ($eid,$elon,$elat,undef,undef,undef,undef,undef) = split(" ",$elines[$j-1]);
 
+      # EXAMPLE: 9828889_T006_T030_GSC_CI_m12_cc_win_adj.pdf
+      @files = glob("${eid}_${Ttag}_${station}_${network}_${smodel}*pdf");
+      $numf = @files;
+      if ($numf == 0) {
+	#print "--> no pdf file exists\n";
+
+      } elsif ($numf == 1) {
+	#print "--> pdf file exists\n";
+	$pdffile = $files[0]; chomp($pdffile);
+	$pdcat[$k] = $pdffile; $k = $k+1;
+
+      } else {
+	print "$eid\n";
+	die("more than one pdf file exists\n");
+      }
+    }
+
+    # if there is at least one file, then make the composite PDF
+    if ($k > $emin+1) {
+      print "output file is $ofile\n";
+      $pdcat[$k] = "./$ofile";
+      print "@pdcat\n";
+      `@pdcat`;			# execute
+      `sleep 5s`;
+
     } else {
-      print "$eid\n";
-      die("more than one pdf file exists\n");
+      print "--> Fewer than $emin events out of $nevent for this station\n";
     }
+
   }
 
-  # if there is at least one file, then make the composite PDF
-  if ($k > $emin+1) {
-    $ofile = "${station}_${network}_${Ttag}_${smodel}_ALL.pdf";
-    print "output file is $ofile\n";
-    $pdcat[$k] = "./$ofile";
-    print "@pdcat\n";
-    `@pdcat`;      # execute
-    `sleep 5s`;
-
-  } else {
-    print "--> Fewer than $emin events out of $nevent for this station\n";
-  }
 }
 
 #=================================================================



More information about the CIG-COMMITS mailing list