/cwake

Common Workspace for AlasKa Earthquakes (CWAKE) is an earthquake review “workspace” customized to the Alaska Volcano Observatory (AVO) to allow operators and researchers to locate earthquakes using the same velocity models and other location parameters.

Primary LanguagePerl

1. What is CWAKE?
-----------------

The Common Workspace for AlasKa Earthquakes (CWAKE) is an earthquake review “workspace” customized to the Alaska Volcano Observatory (AVO).  
It includes custom parameter files and velocity models to allow a Research Seismologist or Seismic Analyst to process earthquakes recorded 
in Alaska using the same configuration, regardless of which university, observatory or laboratory they work at. 

Although originally developed for AVO, CWAKE also provides a convenient way to distribute other velocity models. The velocity models used for
the Uturuncu project have been added, although a region has not been set, which means the Uturuncu models will not be used for automated locations.
It would be trivial to add all AE(I)C velocity models and regions too, as well as those for other datasets from PASSCAL campaigns (e.g. PIRE).


2. Main features
----------------

The CWAKE repository is hosted by github, and can be cloned using the git revision-control system. 
Installation instructions are included in the README file, which is part of the download. Installation consists of running a short script 
and takes as little as 5 minutes.

Once CWAKE is installed, it is simple to switch between a user’s normal configuration (which might be used to process earthquakes from Utah, 
for example) to the CWAKE configuration (for processing Alaska earthquakes). Switching back is a simple as firing up a new terminal window.

The velocity models (and regions) configured in CWAKE are identical to those configured in Hypoellipse as used by AVO since 1989. As in 
Hypoellipse, the depth ceiling for earthquakes is set as -3 km (i.e. 3 km above sea level). The two main tools for making use of these 
velocity models are dbloc2 and relocate. 

Richter magnitude (Ml) can be computed using dbevproc (in batch mode) or via dbloc2 (one event at a time). Currently there is no user control 
over which station magnitudes are used in the network magnitude, although some waveforms are automatically flagged as bad and omitted.

With the smartpick configuration included, users are able to subset waveforms by volcano subnetwork and sort traces by distance from a chosen 
station. A black-on-white color scheme is used in dbpick for consistency with XPick. This is different to the default yellow-on-blue and helps 
the user remember when CWAKE is being used, and when it is not.


3. Requirements
---------------

In brief:
- Antelope version 5.0-64 (or later).
- git is required to clone CWAKE from github - or you can download as a Zip file
- Antelope contrib to run relocate

If you do not have Antelope on your computer, you might be able to get it from http://www.brtt.com/education_and_academic_research.html if 
you are at a university or other educational program in North America. 

It is necessary to have an up-to-date copy of antelope contrib to run programs like "relocate". The best way to keep contrib up-to-date is to run "sudo install_contrib"


4. Installation
---------------

(i)   Decide where you want to install CWAKE. Here we assume you will install it at $HOME/work/cwake. DON'T CREATE THIS DIRECTORY YET! We will do that 
      when we use svn checkout below.

(ii)  Change to parent directory where you plan to install CWAKE. In the example above this is $HOME/work.

          cd $HOME/work

(iii) Download (checkout) your local copy (a svn "sandbox") of the CWAKE svn repository from Google Code:

          git clone https://github.com/gthompson/cwake.git

(iv)  Change to the cwake directory:

          cd cwake

(v)   You should now see several new directories:
	        ls -l

      drwxr-xr-x 3 glenn glenn     4096 2011-02-28 08:35 bin
      -rw-r--r-- 1 glenn glenn 21350400 2011-02-28 08:35 dbmaster.tar
      drwxr-xr-x 3 glenn glenn     4096 2011-02-28 08:35 demo
      drwxr-xr-x 3 glenn glenn     4096 2011-02-28 08:37 docs
      drwxr-xr-x 3 glenn glenn     4096 2011-02-28 08:35 pf
      drwxr-xr-x 3 glenn glenn     4096 2011-02-28 08:35 rc
      -rw-r--r-- 1 glenn glenn     3603 2011-02-28 08:35 README
      drwxr-xr-x 4 glenn glenn     4096 2011-02-28 08:35 tables

      The bin directory contains the install script. The pf directory contains parameter files specific to AVO. Under tables is an AVO specific 
      configuration for genloc, including velocity models and regions. The demo directory contains tar archives of sample databases. The master 
      stations database used for Alaska by AEIC and AVO is in the tar archive dbmaster.tar. To compute hypocenters, Antelope needs to know about
      station coordinates. To compute magnitudes, Antelope also needs calibration information for each channel. These metadata are stored in this
      master stations database. 

(vi)  Run the CWAKE install script. This will add a 'cwake' alias at the end of your .bashrc file if you are using bash, or your .cshrc file 
      if you are using csh.
 
        bin/install_cwake.pl

      You will be asked whether you have the AEIC master stations database available on your network. If you do, you will be asked to supply the 
      path to the directory it is in. If you do not have it, the installer will extract it to $CWAKE/dbmaster. 

(vii) If the installer completed successfully, there will now be a file at rc/cwake.rc, which is sourced by this alias to create environment 
      variables specific to CWAKE. To begin using CWAKE all you need to do is open a new terminal window, and type:
      
        cwake

      It is recommended that you do not work directly from the directory where you installed CWAKE as this will clutter your CWAKE installation 
      directory with unrelated files. Instead, simply invoke the   CWAKE workspace by typing “cwake” in any terminal window. AVO-specific velocity
      models and regions, in addition to AVO-specific parameter files, for relocate, dbevproc, dbloc2, smartpick and dbpick will then be used in 
      place of the ones you normally use (e.g. the defaults distributed with your version of Antelope).
     
 
5. How CWAKE works
------------------

By default Antelope will use velocity models under $ANTELOPE/data/tables. These cannot be modified, except by sudo. But to use genloc models in a different directory,
the $DATAPATH and $VELOCITY_MODEL_DATABASE variables need to be modified. CWAKE takes care of this, e.g.

faraday:CWAKE thompsong$ echo $DATAPATH
/opt/antelope/5.9/data:/opt/antelope/5.9/contrib/data:/Users/gt/src/cwake
faraday:CWAKE thompsong$ echo $VELOCITY_MODEL_DATABASE
vmodel_avo

CWAKE uses the dbpick.rc file that is in the rc/ directory. This was designed to mimic Scott Stihler's preferences for using XPick, with black traces on a white
background (rather than yellow on blue) and an 80-second window width. 

The real trick though is in the tables/ directory. This contains:
- a vmodel_avo database at tables/genloc/db/vmodel_avo. This contains mod1d, ttcalc, regions, and regmodel tables.
  - the database is in models0.4 schema. This a subset of CSS3.0.
  - the mod1d table allows 1-D layered models with gradients to be described
  - the ttcalc table tells Antelope/genloc maps the algorithm to the library name. Example algorithms are ttregions, tt1dcvl, taup.
  - the regions table describes the polygonal regions in which certain models should apply. This is only used when the ttregions algorithm is called.
  - the regmodel table gives the velocity model to be used in each region.
- the tables/genloc/tt1dcvl directory contains 1 parameter file for each model described in tables/genloc/db/vmodel_avo.mod1d
- the tables/genloc/ttregions directory contains an avo.pf parameter file. This links to the set of avo models in vmodel_avo. 

 
6. Adding new velocity models to CWAKE
--------------------------------------

You can add your own velocity models. Below we show how a 1-D constant-velocity layer model can be added:

(i) Make a copy of vmodel_avo to vmodel_new, e.g. 
	cd $CWAKE/tables/genloc/db
	dbcp vmodel_avo vmodel_new

(ii) Add new layers to vmodel_new, e.g.
	dbe -e vmodel_new.mod1d

(iii) Modify the $VELOCITY_MODEL_DATABASE parameter in your CWAKE, e.g.
vi $CWAKE/rc/cwake.rc

The first line will be:
export VELOCITY_MODEL_DATABASE=vmodel_avo

Modify this to point to the new database:
export VELOCITY_MODEL_DATABASE=vmodel_new

(iv) Add a new parameter file for your model at $CWAKE/tables/genloc/tt1dcvl/$MODELNAME.pf

The best way is probably just to copy an existing one, such as utu01.pf



7. Testing your installation
----------------------------

Unfortunately updates to Antelope and Antelope contrib mean that several things now work differently to when CWAKE was first written. So the
tests and validations previously described in this README have been moved to the "TODO.txt" document.