[cig-commits] [commit] devel: updates processing scripts for **net**.**sta**... file names (83331d2)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Jan 8 11:54:04 PST 2015


Repository : https://github.com/geodynamics/specfem3d_globe

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d_globe/compare/3ad4ad0dda8bce0265d5fa9ed7567ee338346d81...133892d126073f174444ba2cb859e8cc72f5478e

>---------------------------------------------------------------

commit 83331d22ff807d2d2662cd65a22e135780c8f752
Author: daniel peter <peterda at ethz.ch>
Date:   Thu Jan 8 09:40:25 2015 +0100

    updates processing scripts for **net**.**sta**... file names


>---------------------------------------------------------------

83331d22ff807d2d2662cd65a22e135780c8f752
 utils/lib/SAC_TOOLS.pm            |  4 ++--
 utils/seis_process/ascii2sac.csh  |  6 ++++++
 utils/seis_process/process_syn.pl |  2 +-
 utils/seis_process/rotate.pl      | 13 +++++++++----
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/utils/lib/SAC_TOOLS.pm b/utils/lib/SAC_TOOLS.pm
index 2d96b22..b1c49b4 100644
--- a/utils/lib/SAC_TOOLS.pm
+++ b/utils/lib/SAC_TOOLS.pm
@@ -71,8 +71,8 @@ sub match_data_and_syn{
   foreach $data (@data_files) {
     my($tmp) = sac_files_get_values("kstnm knetwk kcmpnm",$data);
     ($sta,$net,$comp) = split (" ",$tmp);
-    $syn = "$syn_dir/$sta.$net.$comp${syn_suff}";
-    if ($new_syn_info) {$new_syn = "$new_syn_dir/$sta.$net.$comp${new_syn_suff}";}
+    $syn = "$syn_dir/$net.$sta.$comp${syn_suff}";
+    if ($new_syn_info) {$new_syn = "$new_syn_dir/$net.$sta.$comp${new_syn_suff}";}
     if (-f $syn and -f $data) {
       if ($new_syn_info) { 
           if (-f $new_syn) {
diff --git a/utils/seis_process/ascii2sac.csh b/utils/seis_process/ascii2sac.csh
index eb2872e..f67563e 100755
--- a/utils/seis_process/ascii2sac.csh
+++ b/utils/seis_process/ascii2sac.csh
@@ -1,5 +1,11 @@
 #!/bin/csh
 
+# checks arguments
+if( $1 =~ "" ) then
+  echo "Usage: ascii2sac.csh filenames"
+  exit 1
+endif
+
 foreach file ($*)
   ./asc2sac $file
 end
diff --git a/utils/seis_process/process_syn.pl b/utils/seis_process/process_syn.pl
index 81742cb..01817be 100755
--- a/utils/seis_process/process_syn.pl
+++ b/utils/seis_process/process_syn.pl
@@ -107,7 +107,7 @@ foreach $file (@ARGV) {
   if (not defined $begin_time) {die("Check if the file is SAC format\n")};
 
   ($filename) = split(" ",`basename $file`);
-  ($sta,$net,$comp)=split(/\./,$filename);
+  ($net,$sta,$comp)=split(/\./,$filename);
   if (not $opt_d) {$outfile = $file.$ext;}
   else {$outfile = "$opt_d/${filename}${ext}";}
   if ($ext or $opt_d) {system("\\cp -f $file $outfile");}
diff --git a/utils/seis_process/rotate.pl b/utils/seis_process/rotate.pl
index 462b3c9..f8296cb 100755
--- a/utils/seis_process/rotate.pl
+++ b/utils/seis_process/rotate.pl
@@ -13,7 +13,7 @@ sub Usage {
     -l -L specifies the start and end point of the traces to rotate
     -c check SAC output on screen
        ex. rotate.pl -d *.LHE.SAC for iris data
-           rotate.pl PAS.*.LHE.sac for synthetics
+           rotate.pl PAS.*.MXE.sac for synthetics
     For iris data (with -d), the timing part of the name will be ignored
     and only the component part of the name will be changed correspondingly
 
@@ -25,26 +25,31 @@ exit(1)
 if (!getopts('l:L:cdts')) {die('Check input arguments\n');}
 @ARGV > 0 or Usage();
 if (!$opt_l) {$opt_l = 0;}
+
 $saclst = "saclst";
 if (system("which $saclst >/dev/null") != 0) {die(" No $saclst file\n");}
+
 $undef=-12345.0;
 $eps=0.1;
 
 foreach $file (@ARGV) {
   print "processing $file\n";
   if (! -f $file) {die (" check to see if $file exists or not\n");}
+
   (undef,$comp)=split(" ",`$saclst kcmpnm f $file`);
   if ($comp eq "-12345") {die("No component name defined in the file\n");}
   if (not ($comp=~/E/ or $comp=~/1/)) {die("Please input only E/1 comp\n");}
+
   $ecomp = $comp; $ncomp = $ecomp; $rcomp = $ecomp; $tcomp = $ecomp;
   $ncomp=~s/E/N/; $ncomp =~s/1/2/;
   $tcomp=~s/E/T/; $tcomp =~s/1/T/;
   $rcomp=~s/E/R/; $rcomp =~s/1/R/;
   ($dir) = split(" ",`dirname $file`);$east = $file;
   if ($opt_d) {
-    (undef,undef,undef,undef,undef,undef,$network,undef)=split(/\./,`basename $file`);
-    (undef,$east1) = split(/\.$network\./,$file);
-    $east1 = "$network.$east1";
+    #(undef,undef,undef,undef,undef,undef,$network,undef)=split(/\./,`basename $file`);
+    ($network,$sta,undef,undef)=split(/\./,`basename $file`);
+    (undef,$east1) = split(/\.$sta\./,$file);
+    $east1 = "$sta.$east1";
     $north1 = $east1; $north1=~s/$ecomp/$ncomp/;
     ($north) = split(" ",`ls -1 $dir/*$north1`);
     $tang1=$east1;$radial1=$east1;



More information about the CIG-COMMITS mailing list