[cig-commits] r14109 - in seismo/3D/ADJOINT_TOMO/mtadj: . utils
liuqy at geodynamics.org
liuqy at geodynamics.org
Fri Feb 20 06:00:53 PST 2009
Author: liuqy
Date: 2009-02-20 06:00:52 -0800 (Fri, 20 Feb 2009)
New Revision: 14109
Modified:
seismo/3D/ADJOINT_TOMO/mtadj/call-graph
seismo/3D/ADJOINT_TOMO/mtadj/utils/rotate_adj_src.pl
Log:
modify rotate_adj_src.pl to equate prepare_adj_src.pl in the old version,
mainly touniquely identify station by sta.net
update 'issues of concerns' in call-graph
Modified: seismo/3D/ADJOINT_TOMO/mtadj/call-graph
===================================================================
--- seismo/3D/ADJOINT_TOMO/mtadj/call-graph 2009-02-20 00:09:53 UTC (rev 14108)
+++ seismo/3D/ADJOINT_TOMO/mtadj/call-graph 2009-02-20 14:00:52 UTC (rev 14109)
@@ -24,6 +24,11 @@
4. comparing CC with MT(or FD in general), one can set INCLUDE_ERROR = false
+5. right now if the measurements do not pass selection, they are discarded,
+ which may not be great if you want to resort to CC in the FD case.
+
+6. right now the dtau(f) is allowed to be within one cycle (-T/2,T/2), if
+ this is not the case, then adjoint source is erroneous.
===================================================
mtadj_sub.f90 =====
Modified: seismo/3D/ADJOINT_TOMO/mtadj/utils/rotate_adj_src.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/mtadj/utils/rotate_adj_src.pl 2009-02-20 00:09:53 UTC (rev 14108)
+++ seismo/3D/ADJOINT_TOMO/mtadj/utils/rotate_adj_src.pl 2009-02-20 14:00:52 UTC (rev 14109)
@@ -6,16 +6,21 @@
use CMT_TOOLS;
use DELAZ5;
-# works only on BHT/R/E components
+# works on chanel name given by opt_n
+# note that rotate_adj_src works only on sac files
+# and the at end of this script, all adjoint sources are converted to ASCII.
+# this used to be prepare_adj_src.pl in the old version.
+# $bin has to be changed if not in the standard PATH
#Reading input arguments:
- at ARGV>0 || die("rotate_adj_src.pl -m CMT -s STATION -o OUTDIR -n [BH/LH] all_adj_files\n");
+ at ARGV>0 || die("rotate_adj_src.pl -m CMT -s STATION -o OUTDIR [-n BH/LH] adj-files(*H[RTZ]*adj*)\n");
if (!getopts('m:s:o:n:')) {die("Check arguments\n");}
if ($opt_m) {$cmt = $opt_m;} else {$cmt = "CMTSOLUTION";}
if ($opt_s) {$stafile = $opt_s;} else {$stafile = "STATIONS";}
if ($opt_o) {$outdir = $opt_o;} else {$outdir = "ADJ_SRC";}
+if (not -d $outdir) {mkdir("$outdir", 0777);}
if ($opt_n) {$name = $opt_n;} else {$name="BH";}
$tname="${name}T"; $rname="${name}R"; $zname="${name}Z";
$ename="${name}E"; $nname="${name}N";
@@ -24,49 +29,55 @@
if (not -f $cmt or not -f $stafile or not -d $outdir) {die("Check files/dirs\n");}
($elat,$elon) = get_cmt_location($cmt);
-$bin=".";
+$bin="";
# fill up the hash table that stores the adj src existence information
foreach $file (@ARGV) {
if (not -f $file) {die("Check file $file\n");}
($basefile) = basename($file);
- ($sta,undef,$cmp) = split(/\./,$basefile);
- $adj{$sta}{$cmp} = $file;
- if (defined $adj{$sta}{all}) {$adj{$sta}{all} ++ ;}
- else {$adj{$sta}{all} = 1;}
-# print "$basefile -- $sta\n";
+ ($sta,$net,$cmp) = split(/\./,$basefile);
+ $stanet="$sta.$net";
+ $adj{$stanet}{$cmp} = $file;
+ if (defined $adj{$stanet}{all}) {$adj{$stanet}{all} ++ ;}
+ else {$adj{$stanet}{all} = 1;}
+# print "$basefile -- $stanet\n";
}
-system("rm -f station.tmp"); $nstation = 0;
-print "Copying stations adjoint source file to: $outdir ...\n";
-foreach $sta (keys(%adj)) {
- if (defined $adj{$sta}{$tname} or defined $adj{$sta}{$rname} or defined $adj{$sta}{$zname}) {
- if (defined $adj{$sta}{$tname} ) {
- $tcomp = $adj{$sta}{$tname}; $rcomp = $tcomp; $zcomp = $tcomp;
+$stafile_temp="station.tmp"; system("rm -f $stafile_temp");
+$nstation = 0;
+print "\nCopying stations adjoint source file to: $outdir ...\n";
+foreach $stanet (keys(%adj)) {
+ ($sta,$net) = split(/\./,$stanet);
+ if (defined $adj{$stanet}{$tname} or defined $adj{$stanet}{$rname} or defined $adj{$stanet}{$zname}) {
+ if (defined $adj{$stanet}{$tname} ) {
+ $tcomp = $adj{$stanet}{$tname}; $rcomp = $tcomp; $zcomp = $tcomp;
$ncomp = $rcomp; $ecomp = $tcomp; $zcomp=~s/$tname/$zname/;
- $rcomp =~s/$tname/$rname/; $ncomp=~s/$tname/$nname/; $ecomp=~s/$tname/$ename/;}
- elsif (defined $adj{$sta}{$rname}) {
- $rcomp = $adj{$sta}{$rname}; $tcomp = $rcomp; $zcomp = $rcomp;
+ $rcomp =~s/$tname/$rname/; $ncomp=~s/$tname/$nname/;
+ $ecomp=~s/$tname/$ename/;}
+ elsif (defined $adj{$stanet}{$rname}) {
+ $rcomp = $adj{$stanet}{$rname}; $tcomp = $rcomp; $zcomp = $rcomp;
$ncomp = $rcomp; $ecomp = $rcomp; $zcomp=~s/$rname/$zname/;
- $tcomp =~s/$rname/$tname/; $ncomp=~s/$rname/$nname/; $ecomp=~s/$rname/$ename/;}
+ $tcomp =~s/$rname/$tname/; $ncomp=~s/$rname/$nname/;
+ $ecomp=~s/$rname/$ename/;}
else {
- $zcomp = $adj{$sta}{$zname}; $tcomp = $zcomp; $rcomp = $zcomp;
+ $zcomp = $adj{$stanet}{$zname}; $tcomp = $zcomp; $rcomp = $zcomp;
$ncomp = $rcomp; $ecomp = $rcomp; $rcomp=~s/$zname/$rname/;
- $tcomp =~s/$zname/$tname/; $ncomp=~s/$zname/$nname/; $ecomp=~s/$zname/$ename/;}
- (undef,undef,$slat,$slon) = split(" ",`grep "$sta " $stafile | head -n 1`);
- print "*** $sta ***\n";
- `grep "$sta " $stafile | head -n 1 >> station.tmp`; $nstation ++ ;
- # station/event locs in degrees (input i = 0) and output baz in radian
+ $tcomp =~s/$zname/$tname/; $ncomp=~s/$zname/$nname/;
+ $ecomp=~s/$zname/$ename/;}
+
+ # write station info
+ (undef,undef,$slat,$slon) = split(" ",`grep "$sta .*$net" $stafile | head -n 1`);
+ print "*** $stanet: ($slat, $slon) ***\n";
+ `grep "$sta .*$net" $stafile | head -n 1 >> $stafile_temp`; $nstation ++ ;
+
+ # station/event locs in degrees (input i = 0) and output baz in radian
(undef,undef,undef,$baz) = delaz5($slat,$slon,$elat,$elon,0);
- print "rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp\n\n";
- system("$bin/rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp");
- if ($? != 0) {die("Error: rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp\n");}
+ print "rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp\n";
+ system("${bin}rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp");
+ if ($? != 0) {die("Error in rotate_adj_src \n");}
system("cp -f $ecomp $ncomp $zcomp $outdir");
}
}
-
-system("echo $nstation > STATIONS_ADJOINT; cat station.tmp >> STATIONS_ADJOINT; mv STATIONS_ADJOINT $outdir/");
-#system("mv STATIONS_ADJOINT $outdir/STATIONS_ADJOINT");
-
system("sac2ascii.pl $outdir/*");
+system("echo $nstation > STATIONS_ADJOINT; cat $stafile_temp >> STATIONS_ADJOINT; mv STATIONS_ADJOINT $outdir/");
More information about the CIG-COMMITS
mailing list