[cig-commits] r14912 - seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process

leif at geodynamics.org leif at geodynamics.org
Wed May 6 18:55:27 PDT 2009


Author: leif
Date: 2009-05-06 18:55:26 -0700 (Wed, 06 May 2009)
New Revision: 14912

Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/configure.ac
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/convolve_stf.c
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_data.pl.in
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_syn.pl.in
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/rotate.pl.in
Log:
Several fixes, mostly having to do with SACAUX.


Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/configure.ac
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/configure.ac	2009-05-07 00:41:17 UTC (rev 14911)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/configure.ac	2009-05-07 01:55:26 UTC (rev 14912)
@@ -14,6 +14,9 @@
 if test ! -d "$SACAUX"; then
     AC_MSG_ERROR([SACAUX (=$SACAUX) does not name a directory])
 fi
+if test ! -f "$SACAUX/messages" -o ! -e "$SACAUX/../bin/sac"; then
+    AC_MSG_ERROR([SACAUX (=$SACAUX) is not valid])
+fi
 
 # Checks for programs.
 AC_PROG_CC

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/convolve_stf.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/convolve_stf.c	2009-05-07 00:41:17 UTC (rev 14911)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/convolve_stf.c	2009-05-07 01:55:26 UTC (rev 14912)
@@ -180,8 +180,9 @@
 
         /* get additional info */
         getfhv("delta", &dt, &nerr, strlen("delta"));
+        getfhv("scale", &scale, &nerr, strlen("scale"));
+        
         getfhv("o", &origin, &nerr, strlen("o"));
-        getfhv("scale", &scale, &nerr, strlen("scale"));
         if(nerr) {
             fprintf(stderr,"No origin time is defined for the sac file\n");
             return 1;

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_data.pl.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_data.pl.in	2009-05-07 00:41:17 UTC (rev 14911)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_data.pl.in	2009-05-07 01:55:26 UTC (rev 14912)
@@ -43,7 +43,12 @@
   exit(1);
 }
 
-$sacaux = $ENV{SACAUX} or "@sacaux@";
+if (defined $ENV{SACAUX}) {
+    $sacaux = $ENV{SACAUX};
+} else {
+    $sacaux = "@sacaux@";
+    $ENV{SACAUX}=$sacaux;
+}
 unless (-d $sacaux) {die("missing SAC aux directory: '$sacaux'\n");}
 
 if (@ARGV == 0) { Usage(); }
@@ -63,8 +68,10 @@
 if (!$opt_T) {$opt_T = 0.05;}
 if ($opt_l) {($lmin,$lmax) = split(/\//,$opt_l);} else {$lmin = 0; $lmax = 3600;}
 
+$sac="$sacaux/../bin/sac";
 $saclst="$sacaux/../bin/saclst";
 $phtimes="phtimes";
+if (! -e $sac)  {die(" No $sac file\n");}
 if (! -e $saclst) {die(" No $saclst file\n");}
 #if (! -e $phtimes) {die("No $phtimes file\n");}
 
@@ -80,8 +87,8 @@
   if ($ext or $opt_d) {system("\\cp -f $file $outfile");}
 
   # process data
-  if ($opt_c) {open(SAC,"|sac ") || die("Can't open sac\n");}
-  else {open(SAC,"|sac > /dev/null") || die("Can't open sac\n");}
+  if ($opt_c) {open(SAC,"|$sac ") || die("Can't open sac\n");}
+  else {open(SAC,"|$sac > /dev/null") || die("Can't open sac\n");}
   print SAC "echo on\n";
   print SAC "r $outfile\n";
 
@@ -98,8 +105,8 @@
     print SAC "ch evla $elat evlo $elon evdp $edep \n";
     print SAC "w $outfile\nquit\n";
     close(SAC);
-    if ($opt_c) {open(SAC,"|sac ") || die("Can't open sac\n");}
-    else {open(SAC,"|sac > /dev/null") || die("Can't open sac\n");}
+    if ($opt_c) {open(SAC,"|$sac ") || die("Can't open sac\n");}
+    else {open(SAC,"|$sac > /dev/null") || die("Can't open sac\n");}
     print SAC "echo on\n";
     print SAC "r $outfile\n";}
 
@@ -112,8 +119,8 @@
     print SAC "cut %begin% %end% \n";
     print SAC "r $outfile\n cut off\n  w over \nquit\n";
     close (SAC);
-    if ($opt_c) {open(SAC,"|sac ") || die("Can't open sac\n");}
-    else {open(SAC,"|sac > /dev/null") || die("Can't open sac\n");}
+    if ($opt_c) {open(SAC,"|$sac ") || die("Can't open sac\n");}
+    else {open(SAC,"|$sac > /dev/null") || die("Can't open sac\n");}
     print SAC "echo on\n";
     print SAC "r $outfile\n";}
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_syn.pl.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_syn.pl.in	2009-05-07 00:41:17 UTC (rev 14911)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/process_syn.pl.in	2009-05-07 01:55:26 UTC (rev 14912)
@@ -22,8 +22,7 @@
     -i Dir -- convolve synthetics with instrument response in Dir
     -A amp_factor -- multiple all files with an amplification factor
     -p -- pick P and S arrivals according to iasp91 model to t1/t2 headers
-    -a STAFILE -- add station information from STAFILE, use "-a none"
-       to get information from Vala''s station file
+    -a STAFILE -- add station information from STAFILE
     -s sps -- resampling rate for synthetics (default is 1.0)
     -y t0/V0/t1/V1 -- add to t3/t4 the arrival times of t + dist/V
     -c -- show sac output
@@ -41,7 +40,12 @@
 exit(1);
 }
 
-$sacaux = $ENV{SACAUX} or "@sacaux@";
+if (defined $ENV{SACAUX}) {
+    $sacaux = $ENV{SACAUX};
+} else {
+    $sacaux = "@sacaux@";
+    $ENV{SACAUX}=$sacaux;
+}
 unless (-d $sacaux) {die("missing SAC aux directory: '$sacaux'\n");}
 
 @ARGV > 1 or Usage();
@@ -57,7 +61,7 @@
      if(not defined $pass or $pass<1){$pass=2;}}
 if ($opt_l) {($lmin,$lmax) = split(/\//,$opt_l);} 
 else {$lmin = 0; $lmax = 3600;}
-if ($opt_a and not -f $opt_a) {$opt_a="/opt/seismo-util/data/STATIONS_new";}
+if ($opt_a and not -f $opt_a) {die("No such file as $opt_a\n");}
 if ($opt_o and not $opt_m) {die("Specify centroid time first\n");}
 if ($opt_d and not -d $opt_d) {die("No such directory as $opt_d\n");}
 if ($opt_i and not -d $opt_i) {die("No such directory as $opt_i\n");}
@@ -66,9 +70,11 @@
 $undef = -12345;
 $eps = 0.1;
 
+$sac="$sacaux/../bin/sac";
 $saclst="$sacaux/../bin/saclst";
 $phtimes="phtimes";
 $asc2sac="@prefix@/bin/asc2sac";
+if (! -e $sac)  {die(" No $sac file\n");}
 if (! -e $saclst)  {die(" No $saclst file\n");}
 #if (! -e $phtimes) {die("No $phtimes file\n");}
 if (! -e $asc2sac) {die("No $asc2sac file\n");}
@@ -103,7 +109,7 @@
   if ($ext or $opt_d) {system("\\cp -f $file $outfile");}
   print "Output to file $outfile\n";
 
-  if ($opt_c) { open(SAC,"|sac");}else {open(SAC,"|sac > /dev/null");}
+  if ($opt_c) { open(SAC,"|$sac");}else {open(SAC,"|$sac > /dev/null");}
   print SAC "echo on\n";
 
   print SAC "r $outfile\n";
@@ -115,10 +121,10 @@
     print SAC "ch evla $elat evlo $elon evdp $edep \n wh\n";
     print SAC "w over \nquit\n";
     close(SAC);
-    if ($opt_c) {open(SAC,"|sac");}else {open(SAC,"|sac > /dev/null");}
+    if ($opt_c) {open(SAC,"|$sac");}else {open(SAC,"|$sac > /dev/null");}
     print SAC "echo on\n r $outfile\n";}
 
-    if ($opt_h and $hdur > $min_hdur) { # convolve source time function
+  if ($opt_h and $hdur > $min_hdur) { # convolve source time function
     system("@prefix@/bin/convolve_stf g $hdur $outfile");
     system("mv ${outfile}.conv ${outfile}");}
 
@@ -151,7 +157,7 @@
   if ($opt_s) {print SAC "interp delta $dt\n";}
   print SAC "w over\nquit\n";
   close(SAC);
-  if ($opt_c) { open(SAC,"|sac");}else {open(SAC,"|sac > /dev/null");}
+  if ($opt_c) { open(SAC,"|$sac");}else {open(SAC,"|$sac > /dev/null");}
   print SAC "echo on\n r $outfile\n ";
 
   if ($opt_t){ # filter record

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/rotate.pl.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/rotate.pl.in	2009-05-07 00:41:17 UTC (rev 14911)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/UTILS/seis_process/rotate.pl.in	2009-05-07 01:55:26 UTC (rev 14912)
@@ -25,14 +25,21 @@
 exit(1)
 }
 
-$sacaux = $ENV{SACAUX} or "@sacaux@";
+if (defined $ENV{SACAUX}) {
+    $sacaux = $ENV{SACAUX};
+} else {
+    $sacaux = "@sacaux@";
+    $ENV{SACAUX}=$sacaux;
+}
 unless (-d $sacaux) {die("missing SAC aux directory: '$sacaux'\n");}
 
 if (!getopts('l:L:cdts')) {die('Check input arguments\n');}
 @ARGV > 0 or Usage();
 if (!$opt_l) {$opt_l = 0;}
+$sac="$sacaux/../bin/sac";
 $saclst = "$sacaux/../bin/saclst";
-if (not -f $saclst) {die("No such file as $saclst\n");}
+if (! -e $sac)  {die(" No $sac file\n");}
+if (! -e $saclst) {die(" No $saclst file\n");}
 $undef=-12345.0;
 $eps=0.1;
 
@@ -83,8 +90,8 @@
 
   # check if the reference time is the same or not!
 
-  if ($opt_c) {open(SAC,"|$sacaux/../bin/sac");}
-  else {open(SAC,"|$sacaux/../bin/sac > /dev/null");}
+  if ($opt_c) {open(SAC,"|$sac");}
+  else {open(SAC,"|$sac > /dev/null");}
   print SAC "echo on\n";
   print SAC "r $north $east\n ";
   if ($opt_L or $npts_n != $npts_e or abs($nb-$eb) > $eps) { #cut properly



More information about the CIG-COMMITS mailing list