[cig-commits] r13110 - in seismo/3D/ADJOINT_TOMO/measure_adj: . PLOTS scripts_tomo

carltape at geodynamics.org carltape at geodynamics.org
Mon Oct 20 23:55:11 PDT 2008


Author: carltape
Date: 2008-10-20 23:55:11 -0700 (Mon, 20 Oct 2008)
New Revision: 13110

Added:
   seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_event.pl
   seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl
Removed:
   seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_all.pl
Modified:
   seismo/3D/ADJOINT_TOMO/measure_adj/README
   seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_cc_plot.pl
   seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_measure_adj.pl
   seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_tomo.pl
Log:
Added capabilities of plotting composite PDFs, where each set shows all events recorded at each station.  This allows for getting a better picture of structure near the station.


Deleted: seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_all.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_all.pl	2008-10-21 05:14:27 UTC (rev 13109)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_all.pl	2008-10-21 06:55:11 UTC (rev 13110)
@@ -1,103 +0,0 @@
-#!/usr/bin/perl -w
-
-#==========================================================
-#
-#  make_pdf_all.pl
-#  Carl Tape
-#  01-Oct-2008
-#
-#  This sorts the output PDF files in PLOTS into order by
-#    1  distance
-#    2  azimuth
-#
-#  EXAMPLE (from PLOTS): make_pdf_all.pl 3 mt_cc_all
-#
-#==========================================================
-
-#if (@ARGV < 3) {die("Usage: make_pdf_all.pl xxx\n")}
-#($isort,$otag) = @ARGV;
-
-$station_sort = "STATIONS_sort";
-if (not -f "${station_sort}") {die("check if station_sort ${station_sort} exist or not\n")}
-open(IN,"${station_sort}"); @stalines = <IN>; close(IN); $nrec = @stalines;
-
-print "\n $nrec \n";
-
-# NOTE: make sure that the executable is there
- at pdcat = "/home/carltape/bin/pdcat -r"; $k = 1;
-
-# loop over all the stations in the sorted list
-for ($ik = 1; $ik <= $nrec; $ik = $ik+1) {
-
-  ($stanet,$stalon,$stlat,undef,undef,undef,undef,undef) = split(" ",$stalines[$ik-1]);
-  ($station,$network) = split("\\.",$stanet);
-  print "$ik out of $nrec : $station $network\n";
-  
-  @files = glob("*${station}_${network}*pdf");
-  $numf = @files;
-  if ($numf == 0) {
-     print "--> no pdf file exists\n";
-
-  } elsif ($numf == 1) {
-     print "--> one pdf file exists\n";
-     $pdffile = $files[0]; chomp($pdffile);
-     $pdcat[$k] = $pdffile; $k = $k+1;
-
-  } else {
-     die("more than one pdf file exists\n");
-  }
-
-}
-
-print "@pdcat\n";
-
-# construct the output file name from the first file in the list
-($flabel,undef) = split("\\.",$pdcat[1]);
-($eid,$sTmin,$sTmax,$sta,$net,$smodel,$tag1,$tag2,$tag3) = split("_",$flabel);
-$ofile = "${eid}_${sTmin}_${sTmax}_${smodel}_ALL.pdf";
-print "output file is $ofile\n";
-
-$pdcat[$k] = "./$ofile";
-
-# execute pdf command
-`@pdcat`;
-`sleep 2s`;
-
-#-----------------
-# OBSOLETE VERSION AS OF 02-OCT-2008
-
-#if (@ARGV < 2) {die("Usage: make_pdf_all.pl xxx\n")}
-#($isort,$otag) = @ARGV;
-
-#@tags = ("sta","dist","az");
-#$tag = $tags[$isort-1];
-
-#$ofile = "${otag}_${tag}.pdf";
-
-#$station_sort = "STATIONS_${tag}";
-#if (not -f "${station_sort}") {die("check if station_sort ${station_sort} exist or not\n");}
-#@pdffiles = glob("*pdf");
-#$npdf = @pdffiles;
-
-#print "\n $npdf files\n";
-
-## loop over all the PDF files
-#for ($ik = 1; $ik <= $npdf; $ik = $ik+1) {
-
-#  $pdffile0 = $pdffiles[$ik-1];
-#  ($pdffile) = split(" ",`basename $pdffile0`);
-#  ($sta,$net,undef,undef,undef) = split("_",$pdffile);
-#  $stanet = "$sta.$net";
-#  $iline=`grep -n \"$stanet\" ${station_sort} | awk -F: '{print \$1}'`; chomp($iline);
-#  print "$ik $stanet $iline\n";
-
-#  $sti = sprintf("%3.3i",$iline);
-#  $pdffile_out = "${sti}_${pdffile}";
-#  `\\mv $pdffile0 ${pdffile_out}`;
-#  #print "move $iline $sti $pdffile0 ${pdffile_out}\n";
-#}
-
-## concatenate into one file
-#`/home/carltape/bin/pdcat -r *.pdf $ofile`;
-
-#=================================================================

Copied: seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_event.pl (from rev 13106, seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_all.pl)
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_event.pl	                        (rev 0)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_event.pl	2008-10-21 06:55:11 UTC (rev 13110)
@@ -0,0 +1,103 @@
+#!/usr/bin/perl -w
+
+#==========================================================
+#
+#  make_pdf_by_event.pl
+#  Carl Tape
+#  01-Oct-2008
+#
+#  This sorts the output PDF files in PLOTS into order by
+#    1  distance
+#    2  azimuth
+#
+#  EXAMPLE (from PLOTS): make_pdf_by_event.pl 3 mt_cc_all
+#
+#==========================================================
+
+#if (@ARGV < 3) {die("Usage: make_pdf_by_event.pl xxx\n")}
+#($isort,$otag) = @ARGV;
+
+$station_sort = "STATIONS_sort";
+if (not -f "${station_sort}") {die("check if station_sort ${station_sort} exist or not\n")}
+open(IN,"${station_sort}"); @stalines = <IN>; close(IN); $nrec = @stalines;
+
+print "\n $nrec \n";
+
+# NOTE: make sure that the executable is there
+ at pdcat = "/home/carltape/bin/pdcat -r"; $k = 1;
+
+# loop over all the stations in the sorted list
+for ($ik = 1; $ik <= $nrec; $ik = $ik+1) {
+
+  ($stanet,$stalon,$stlat,undef,undef,undef,undef,undef) = split(" ",$stalines[$ik-1]);
+  ($station,$network) = split("\\.",$stanet);
+  print "$ik out of $nrec : $station $network\n";
+  
+  @files = glob("*${station}_${network}*pdf");
+  $numf = @files;
+  if ($numf == 0) {
+     print "--> no pdf file exists\n";
+
+  } elsif ($numf == 1) {
+     print "--> one pdf file exists\n";
+     $pdffile = $files[0]; chomp($pdffile);
+     $pdcat[$k] = $pdffile; $k = $k+1;
+
+  } else {
+     die("more than one pdf file exists\n");
+  }
+
+}
+
+print "@pdcat\n";
+
+# construct the output file name from the first file in the list
+($flabel,undef) = split("\\.",$pdcat[1]);
+($eid,$sTmin,$sTmax,$sta,$net,$smodel,$tag1,$tag2,$tag3) = split("_",$flabel);
+$ofile = "${eid}_${sTmin}_${sTmax}_${smodel}_ALL.pdf";
+print "output file is $ofile\n";
+
+$pdcat[$k] = "./$ofile";
+
+# execute pdf command
+`@pdcat`;
+`sleep 3s`;
+
+#-----------------
+# OBSOLETE VERSION AS OF 02-OCT-2008
+
+#if (@ARGV < 2) {die("Usage: make_pdf_by_event.pl xxx\n")}
+#($isort,$otag) = @ARGV;
+
+#@tags = ("sta","dist","az");
+#$tag = $tags[$isort-1];
+
+#$ofile = "${otag}_${tag}.pdf";
+
+#$station_sort = "STATIONS_${tag}";
+#if (not -f "${station_sort}") {die("check if station_sort ${station_sort} exist or not\n");}
+#@pdffiles = glob("*pdf");
+#$npdf = @pdffiles;
+
+#print "\n $npdf files\n";
+
+## loop over all the PDF files
+#for ($ik = 1; $ik <= $npdf; $ik = $ik+1) {
+
+#  $pdffile0 = $pdffiles[$ik-1];
+#  ($pdffile) = split(" ",`basename $pdffile0`);
+#  ($sta,$net,undef,undef,undef) = split("_",$pdffile);
+#  $stanet = "$sta.$net";
+#  $iline=`grep -n \"$stanet\" ${station_sort} | awk -F: '{print \$1}'`; chomp($iline);
+#  print "$ik $stanet $iline\n";
+
+#  $sti = sprintf("%3.3i",$iline);
+#  $pdffile_out = "${sti}_${pdffile}";
+#  `\\mv $pdffile0 ${pdffile_out}`;
+#  #print "move $iline $sti $pdffile0 ${pdffile_out}\n";
+#}
+
+## concatenate into one file
+#`/home/carltape/bin/pdcat -r *.pdf $ofile`;
+
+#=================================================================


Property changes on: seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_event.pl
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mergeinfo
   + 

Added: seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl	                        (rev 0)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl	2008-10-21 06:55:11 UTC (rev 13110)
@@ -0,0 +1,118 @@
+#!/usr/bin/perl -w
+
+#==========================================================
+#
+#  make_pdf_by_station.pl
+#  Carl Tape
+#  01-Oct-2008
+#
+#  This sorts the output PDF files in PLOTS into order by
+#    1  distance
+#    2  azimuth
+#
+#  EXAMPLE (from /net/sierra/raid1/carltape/results/MEASUREMENTS/m12/PDF_ALL_T006_T030):
+#    make_pdf_by_station.pl
+#
+#==========================================================
+
+#if (@ARGV < 3) {die("Usage: make_pdf_by_station.pl xxx\n")}
+#($isort,$otag) = @ARGV;
+
+#================================================================
+# USER INPUT
+
+$emin = 10;         # 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)
+
+# full stations file
+$file_stations = "/net/denali/home1/carltape/gmt/stations/seismic/Matlab_output/STATIONS_CALIFORNIA_TOMO_INNER_gmt";
+if (not -f ${file_stations}) {die("check if file_stations ${file_stations} exist or not\n")}
+open(IN,"${file_stations}"); @stalines = <IN>; close(IN); $nrec = @stalines;
+
+# directory containing sorted stations lists
+# (See /ADJOINT_TOMO/iterate_adj/UTILS/station_lists/ )
+$edir = "/net/sierra/raid1/carltape/results/SOURCES/EID_STATION_LISTS";
+
+# list of all possible event IDs
+#$file_eid = "/net/sierra/raid1/carltape/results/EID_LISTS/syn_run_${smodel}";
+#if (not -f ${file_eid}) {die("check if ${file_eid} exist or not\n")}
+#open(IN,"${file_eid}"); @elines = <IN>; close(IN);
+#$nevent = @elines;
+#print "\n $nevent events in the list \n";
+
+if($isort == 1) {$sortlab = "dist"} else {$sortlab = "az"}
+
+#================================================================
+
+print "\n $nrec \n";
+
+if (0==1) {
+  for ($ik = 1; $ik <= $nrec; $ik = $ik+1) {
+    ($stalon,$stalat,$station,$network,undef,undef) = split(" ",$stalines[$ik-1]);
+    print "$ik out of $nrec : station $station.$network\n";
+  }
+  die("TESTING: listing only the stations\n");
+}
+
+#--------------------------------------
+
+$imin = 1; $imax = $nrec;
+#$imin = 139; $imax = $imin;
+
+# loop over all the stations in the sorted list
+for ($ik = $imin; $ik <= $imax; $ik = $ik+1) {
+
+  # NOTE: make sure that the executable is there
+  @pdcat = "/home/carltape/bin/pdcat -r"; $k = 1;
+
+  # get station name from list
+  ($stalon,$stalat,$station,$network,undef,undef) = split(" ",$stalines[$ik-1]);
+  print "$ik out of $nrec : station $station.$network\n";
+
+  # get list of events sorted by azimuth or distance
+  # EXAMPLE: EIDS_by_az_from_LT2.NP
+  $event_sort = "${edir}/EIDS_by_${sortlab}_from_${station}.${network}";
+  if (not -f "${event_sort}") {die("check if event_sort ${event_sort} exist or not\n")}
+  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) {
+
+    # 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) {
+    $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";
+  }
+}
+
+#=================================================================


Property changes on: seismo/3D/ADJOINT_TOMO/measure_adj/PLOTS/make_pdf_by_station.pl
___________________________________________________________________
Name: svn:executable
   + *

Modified: seismo/3D/ADJOINT_TOMO/measure_adj/README
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/README	2008-10-21 05:14:27 UTC (rev 13109)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/README	2008-10-21 06:55:11 UTC (rev 13110)
@@ -34,7 +34,8 @@
 PLOTS/
   plot_win_adj_all.pl
   plot_win_adj.pl
-  make_pdf_all.pl
+  make_pdf_by_event.pl
+  make_pdf_by_station.pl
 
 ==============================
 Carl Tape, 2/7/08

Modified: seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_cc_plot.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_cc_plot.pl	2008-10-21 05:14:27 UTC (rev 13109)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_cc_plot.pl	2008-10-21 06:55:11 UTC (rev 13110)
@@ -117,9 +117,9 @@
 # make a single PDF file
 $isort = 3;
 $otag = "mt_cc_all";
-print CSH "make_pdf_all.pl $isort $otag\n";
+print CSH "make_pdf_by_event.pl $isort $otag\n";
 
-#print CSH "/home/carltape/bin/pdcat -r *.pdf mt_cc_all.pdf\n";     # replace with make_pdf_all.pl
+#print CSH "/home/carltape/bin/pdcat -r *.pdf mt_cc_all.pdf\n";     # replace with make_pdf_by_event.pl
 print CSH "cd -\n";
 
 #-----------------------------------------

Modified: seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_measure_adj.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_measure_adj.pl	2008-10-21 05:14:27 UTC (rev 13109)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_mt_measure_adj.pl	2008-10-21 06:55:11 UTC (rev 13110)
@@ -118,9 +118,9 @@
 #  # make a single PDF file
 #  $isort = 3;
 #  $otag = "mt_cc_all";
-#  print CSH "make_pdf_all.pl $isort $otag\n";
+#  print CSH "make_pdf_by_event.pl $isort $otag\n";
 
-  #print CSH "/home/carltape/bin/pdcat -r *.pdf mt_cc_all.pdf\n";    # replace with make_pdf_all.pl
+  #print CSH "/home/carltape/bin/pdcat -r *.pdf mt_cc_all.pdf\n";    # replace with make_pdf_by_event.pl
   print CSH "cd -\n";
 }
 

Modified: seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_tomo.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_tomo.pl	2008-10-21 05:14:27 UTC (rev 13109)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_tomo.pl	2008-10-21 06:55:11 UTC (rev 13110)
@@ -161,7 +161,7 @@
 
        # make a single PDF, with pages sorted by azimuth or distance
        print CSH "cd PLOTS\n";
-       print CSH "make_pdf_all.pl\n";
+       print CSH "make_pdf_by_event.pl\n";
        $infile5 = "${ftag}_${smodel}_ALL.pdf";
        $outfile5 = "${dir_meas}/${infile5}";
        print CSH "cp $infile5 $outfile5\n";        # composite PDF into RUN



More information about the CIG-COMMITS mailing list