This is an old revision of the document!
To install the code, we must first setup a few environment variables. If you use csh or tcsh:
setenv GMT_BIN /path/to/gmt/bin setenv RDSEED /path/to/rdseed/executable setenv GF_PATH /path/to/greens/functions/database setenv WPHASE_HOME /path/to/wphase/package
If you use bash:
export GMT_BIN=/path/to/gmt/bin export RDSEED=/path/to/rdseed/executable export GF_PATH=/path/to/greens/functions/database export WPHASE_HOME=/path/to/wphase/package
These variables are necessary both at installation time and at run time. In addition to these variables, it is handy to include the wphase “bin” directory into the PATH environment variable:
setenv PATH ${PATH}:$WPHASE_HOME/bin
or in bash:
export PATH=${PATH}:$WPHASE_HOME/bin
All theses variable assignment can be included in your .tcshrc or your .bashrc file.
Once you have downloaded the last version of the W-phase package and that the above environment variables are properly defined. Then you can proceed as follows to compile the package:
cd ${WPHASE_HOME}/src make -B
Before each inversion, it is necessary to create a “run” directory containing two input ascii files:
The format of these files are described in notes on file formats.
Path to SEED file(s) must be correctly specified after the keyword 'SEED:' in the i_master file. If multiple SEED files are used for the same inversion, each of them must be referenced properly in i_master using one 'SEED:' line per file.
Once the i_master and CMTSOLUTION files are created, we can extract waveforms and instrument response parameters and perform a rough screening by epicentral distance. This can be done using:
${WPHASE_HOME}/bin/extract.csh
which will extract Z, N, E, 1, 2 channels in SEED file(s).
Data is extracted from SEED volumes and written in SAC format in the subdirectory 'DATA'. PZ files containing instrument responses are also located in this directory. After running an extract*.csh script, screened and windowed data files are listed in 'scr_dat_fil_list' while 'coeffs_rec_lut' contains the coefficients for the time domain deconvolution of the instrument response.
The next step is to calculate the kernel functions associated with the 6 elements of the seismic moment tensor for the stations listed in 'scr_dat_fil_list' and to convolve them with the moment rate function (MRF) specified in the CMTSOLUTION file (time shift and half duration). We must then deconvolve the instrument response from the data and band pass filter each waveform in the frequency pass band specified in i_master. This is performed using:
${WPHASE_HOME}/bin/prepare_wp.csh
for Z, N, E, 1, 2 channels or
${WPHASE_HOME}/bin/prepare_wp.csh Z
for Z channel only
The scripts listed above will generates i_wpinversion which is a list of sac files to be used in the inversion. This original input file usually includes lots of noisy channels which should be removed further. Output kernel functions will be found generally in ./GF
The inversion can then be performed using the Kernels functions in ./GF and data files listed in i_wpinversion.
For more details on options run
${WPHASE_HOME}/bin/wpinversion -h
By default, this program assumes a zero trace moment tensor (i.e. deviatoric moment tensor). This constraint can be disabled by adding the option “-nont”. Another interesting option is “-dc” which enable the inversion for a pure double couple. The options “-stike”, “-dip”, “-rake” and “-mom” provide the possibility to run double couple inversions at fixed strike, dip, rake and/or scalar moment.
Several output files are created after running the inversion:
Since i_wpinversion includes a lot of noisy traces, the result is usually uncertain. To improve the solution, we must remove noisy data. This can be done as follows:
$WPHASE_HOME/bin/wpinversion -ifil o_wpinversion -ofil o_wpinv.th3.0 -th 3.0
(in this example, the new o_wpinversion file is named o_wpinv.th3.0). This step can be repeated two or more times with different thresholds using the option -th (e.g 1.3, 0.9, etc.):
$WPHASE_HOME/bin/wpinversion -ifil o_wpinv.th3.0 -ofil o_wpinv.th1.3 -th 1.3 $WPHASE_HOME/bin/wpinversion -ifil o_wpinv.th1.3 -ofil o_wpinv.th0.9 -th 0.9
$WPHASE_HOME/bin/wpinversion -ifil o_wpinv.th0.9 -ofil o_wpinv.th1.3 -nr 2.0
At the end of the screening process, it is necessary to clean up the run directory so that o_wpinversion correspond to the optimum dataset which can be used later by grid-search and plot routines :
mv o_wpinversion o_wpinv.noth cp o_wpinv.th0.9 o_wpinversion
Data extraction, screening and inversion described above can be performed by running one of the RUNA3*csh scripts (usually in bin). These scripts perform data extraction/screening and calculate a moment tensor solution after median data screening and after rejecting traces associated with large misfit using the threshold 5.0 3.0 0.9 (i.e. -th, see 2. in section 4):
${WPHASE_HOME}/bin/RUNA3.csh
will perform median and rms misfit screening for Z, N, E, 1 and 2 channels,
${WPHASE_HOME}/bin/RUNA3_only_Z.csh
will perform median and rms misfit screening for Z channels only.
These two scripts don’t perform the “ratio screening” (i.e. 3. above). To run the same routines with an additional screening based on the ratio (observed/predicted and predicted/observed), the following scripts can be used:
${WPHASE_HOME}/bin/RUNA3r.csh
will perform median, rms misfit and rms ratio for channels Z, N, E, 1, 2 channels,
Remark: RUNAr.csh is not yet fully tested.
Several optional parameters can be used when running RUNA3*csh scripts. These parameters will apply to the wpinversion program. They are described when running wpinversion -h. e.g.: RUNA3.csh -wz 1.0 -wn 0.3 -we 0.5 will give a weights of 1.0, 0.3 and 0.5 for Z, N, E components respectively.
To perform data screening and inversion only, using previously extracted SAC data, it is possible to use:
${WPHASE_HOME}/bin/RUNA3_lite.csh
that is designed for Z, N ,Z ,1, 2 channels
In the grid-search scheme, there is a first global rough exploration which is followed by finer samplings around minimal points. If the optimum is found near a bound, the explored space is extended.
Grid searches can be performed using the script
${WPHASE_HOME}/bin/wp_grid_search.py
. A detailed help can be found by using
${WPHASE_HOME}/bin/wp_grid_search.py -h
. The grid-search computation is parallelized using openMP (if available, it takes advantage of muliple cores).
This script run a time-shift (ts) grid search followed by a centroid position grid-search :
All the plotting scripts are coded using python and the module pylab which have to be installed before using them. The module basemap is also needed for plotting maps but it is optional (even if we recommend to install it).
There are 3 script which can be used to plot the W phase inversion results:
${WPHASE_HOME}/bin/make_grids.py
which be used to display grid-searches results. Use
${WPHASE_HOME}/bin/make_grids.py -h
to have more details on available options and arguments. The 2 other scripts plot observed and synthetic seismograms after W phase inversion.
${WPHASE_HOME}/bin/traces_global.py
which draw complete seismograms and show station location on a map (if basemap is available). Please use
${WPHASE_HOME}/bin/traces_global.py -h
for more details on available options.
${WPHASE_HOME}/bin/make_cwp.py
For more details on available options and arguments see
${WPHASE_HOME}/bin/make_cwp.py -h
to see the options.