[cig-commits] r18830 - in seismo/3D/ADJOINT_TOMO/measure_adj: . scripts_tomo
carltape at geodynamics.org
carltape at geodynamics.org
Mon Aug 15 16:38:27 PDT 2011
Author: carltape
Date: 2011-08-15 16:38:27 -0700 (Mon, 15 Aug 2011)
New Revision: 18830
Modified:
seismo/3D/ADJOINT_TOMO/measure_adj/prepare_adj_src.pl
seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_measure_adj.pl
Log:
modified run scripts to allow for plotting data+syn+windows (with measurements) without computing adjoint sources
Modified: seismo/3D/ADJOINT_TOMO/measure_adj/prepare_adj_src.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/prepare_adj_src.pl 2011-08-15 23:00:06 UTC (rev 18829)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/prepare_adj_src.pl 2011-08-15 23:38:27 UTC (rev 18830)
@@ -7,9 +7,11 @@
# and outputs a set of adjoint sources in Z-E-N that can be used in SPECFEM3D.
# The key is that it will create an all-zeros record if no measurement is made on
# a particular component (say, Z), but IS made on another component (say, R or T).
+# The output STATIONS file is used within plotting routines (plot_win_adj.pl).
#
-# EXAMPLE:
-# prepare_adj_src.pl -m PLOTS/CMTSOLUTION_9818433 -z BH -s STATIONS_CI -o ADJOINT_SOURCES OUTPUT_FILES/*adj
+# EXAMPLES:
+# prepare_adj_src.pl -m PLOTS/CMTSOLUTION_9818433 -z BH -s STATIONS_CI -o ADJOINT_SOURCES -i OUTPUT_FILES/*adj
+# prepare_adj_src.pl -m CMTSOLUTION_9703873 -s PLOTS/STATIONS_TOMO -o ADJOINT_SOURCES OUTPUT_FILES/*recon.cc.sac
#
#--------------------------------------------------------------------
@@ -20,16 +22,18 @@
use DELAZ5;
#Reading input arguments:
- at ARGV>0 || die("prepare_adj_src.pl -m CMT -z BH -s STATION -o OUTDIR all_adj_files\n");
+ at ARGV>0 || die("prepare_adj_src.pl -m CMT -z BH -s STATION -o OUTDIR -i iadj all_adj_files\n");
-if (!getopts('m:z:s:o:')) {die("Check arguments\n");}
+if (!getopts('m:z:s:o:i:')) {die("Check arguments\n");}
if ($opt_m) {$cmt = $opt_m;} else {$cmt = "CMTSOLUTION";}
if ($opt_z) {$chan = $opt_z;} else {$chan = "BH";}
if ($opt_s) {$stafile = $opt_s;} else {$stafile = "STATIONS";}
if ($opt_o) {$outdir = $opt_o;} else {$outdir = "ADJ_OUT";}
-if (not -f $cmt or not -f $stafile or not -d $outdir) {die("Check files/dirs\n");}
+if (not -f $cmt) {die("Check for $cmt\n");}
+if (not -f $stafile) {die("Check for $stafile\n");}
+if (not -d $outdir) {die("Check for $outdir\n");}
($elat,$elon) = get_cmt_location($cmt);
@@ -97,14 +101,20 @@
#print "*** $stanet ***\n";
#`grep "$sta " $stafile | head -n 1 >> ${stafile_temp}`; $nstation ++ ;
- # get back-azimuth and apply rotation using rotate_adj_src.f90
- (undef,undef,undef,$baz) = delaz5($slat,$slon,$elat,$elon,0); # station - event loc in radians
-# print "***$tcomp***\nbin/rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp\n\n";
- system("rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp");
- if ($? != 0) {die("Error: rotate_adj_src $baz $tcomp $rcomp $ecomp $ncomp\n");}
- system("cp -f $ecomp $ncomp $zcomp $outdir");
+ if ($opt_i) {
+ # get back-azimuth and apply rotation using rotate_adj_src.f90,
+ # which will WRITE OUT the adjoint sources on the east and north components
+ (undef,undef,undef,$baz) = delaz5($slat,$slon,$elat,$elon,0); # station - event loc in radians
+ # print "***$tcomp***\nbin/rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp\n\n";
+ system("rotate_adj_src $baz $zcomp $tcomp $rcomp $ecomp $ncomp");
+ if ($? != 0) {
+ die("Error: rotate_adj_src $baz $tcomp $rcomp $ecomp $ncomp\n");
+ }
+ system("cp -f $ecomp $ncomp $zcomp $outdir");
+ }
+
}
}
+# write out STATIONS_ADJOINT file
system("echo $nstation > STATIONS_ADJOINT; cat ${stafile_temp} >> STATIONS_ADJOINT");
-
Modified: seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_measure_adj.pl
===================================================================
--- seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_measure_adj.pl 2011-08-15 23:00:06 UTC (rev 18829)
+++ seismo/3D/ADJOINT_TOMO/measure_adj/scripts_tomo/run_measure_adj.pl 2011-08-15 23:38:27 UTC (rev 18830)
@@ -21,7 +21,8 @@
# ... see write_par_file.pl
#
# EXAMPLE (T = [6s, 30s]):
-# run_measure_adj.pl m16 -10/200 0 1 0 -0.585/0.011/18200 7 BH 6/30 0/1/1/1 -5.0/5.0/-1.5/1.5/0.7 1/1.0/0.5 1/0.02/2.5/2.0/2.5/3.5/1.5
+# run_measure_adj.pl m16 -10/200 0 1 0 -0.585/0.011/18200 7 BH 6/30 0/1/1/1 -5.0/5.0/-1.5/1.5/0.7 1/1.0/0.5 1/0.02/2.5/2.0/2.5/3.5/1.5 # data + syn + adj
+# run_measure_adj.pl m16 -10/200 0 1 0 -0.585/0.011/18200 7 BH 6/30 0/1/1/0 -5.0/5.0/-1.5/1.5/0.7 1/1.0/0.5 1/0.02/2.5/2.0/2.5/3.5/1.5 # data + syn
#
#==========================================================
@@ -34,6 +35,10 @@
#$iboth = 0; # option to plot both cross-correlation and multitaper adjoint sources
($Tmin,$Tmax) = split("/",$Ts);
+
+# whether to compute (and plot) adjoint sources
+# note: If you want to compute adjoint sources but only plot the data+syn,
+# then you can make manual changes to $iplot_adj in plot_win_adj.pl.
(undef,undef,undef,$iadj) = split("/",$iparbools);
#$cmtfile = "CMTSOLUTION_9818433";
@@ -119,14 +124,19 @@
#print CSH "ascii2sac.csh ${plot_adj_dir}*.adj\n";
}
+# create adjoint sources and STATIONS_ADJOINT file for SPECFEM3D
+# prepare_adj_src.pl dumps the ZEN adjoint sources into $adj_dir
+# NOTE: You may want plots of data+syn+windows even if you do not compute adjoint sources;
+# hence you can use the *recon.cc.sac to write a STATIONS_ADJOINT file for plot_win_adj.pl.
if ($iadj == 1) {
- # create adjoint sources and STATIONS_ADJOINT file for SPECFEM3D
- # prepare_adj_src.pl dumps the ZEN adjoint sources into $adj_dir
- $adj_dir = "ADJOINT_SOURCES";
- print CSH "\\rm -rf ${adj_dir}\n mkdir ${adj_dir}\n";
- print CSH "prepare_adj_src.pl -m $cmtfile -s PLOTS/$stafile1 -o ${adj_dir} OUTPUT_FILES/*adj\n";
- print CSH "cp STATIONS_ADJOINT ${adj_dir}\n";
+ $tfiles = "-i OUTPUT_FILES/*adj";
+} else {
+ $tfiles = "OUTPUT_FILES/*recon.cc.sac";
}
+$adj_dir = "ADJOINT_SOURCES";
+print CSH "\\rm -rf ${adj_dir}\n mkdir ${adj_dir}\n";
+print CSH "prepare_adj_src.pl -m $cmtfile -s PLOTS/$stafile1 -o ${adj_dir} $tfiles\n";
+print CSH "cp STATIONS_ADJOINT ${adj_dir}\n"; # only for iadj=1
print CSH "\\mv STATIONS_ADJOINT PLOTS\n";
# make plots of (filtered) data, synthetics, windows, and adjoint sources
More information about the CIG-COMMITS
mailing list