NAME
init_training - initialize a database for analyst training
SYNOPSIS
init_training [template_name]
SUPPORT
Contributed code: NO BRTT support.
THIS PIECE OF SOFTWARE WAS CONTRIBUTED BY THE ANTELOPE USER COMMUNITY. BRTT DISCLAIMS ALL OWNERSHIP, LIABILITY, AND SUPPORT FOR THIS PIECE OF SOFTWARE.
FOR HELP WITH THIS PIECE OF SOFTWARE, PLEASE CONTACT THE CONTRIBUTING AUTHOR.
DESCRIPTION
When conducting analyst-training workshops, it is common to create
a database and various other files which the analyst trainees will need
to practice workshop exercises. Often the trainees need to perform various
copying and setup tasks in order to create their own personal training
environment, usually by drawing from master copies of databases etc. This
script is an attempt to automate that setup, simplifying the job of the
workshop leader as well as allowing the trainees to focus on the main goals
without being overwhelmed by a barrage of setup tasks. Furthermore, it
is not uncommon for trainees to create a regrettable situation in their
practice directory, requiring a repeat of the setup tasks.
init_training
makes it easier to erase mistakes and start over.
init_training is driven by named templates, which are specified in the
parameter file init_training.pf. If there is only one template in the
parameter file, or if the name of a template is explicitly specified on the
command line, that template is used. Otherwise, if multiple templates
are defined in the parameter file, init_training looks for a parameter
called
default_template in the parameter file to decide which to use.
Almost all setup performed by
init_training is done in the
user's home directory, in a subdirectory specified by
practice_subdir
of init_training.pf. The actual practice directory is a subdirectory of this,
and is named after the template.
init_training will not overwrite
a pre-existing directory, and will complain and die if there is a conflict.
The main job of
init_training is to create a practice database.
This is done by copying tables from a stock database (usually of automatically
processed results) specified by the parameters
autoproc_database
and
autoproc_tables.
init_training expects to include the
waveforms and site information in this database by descriptor-file reference,
thus the parameters
site_database and
waveform_database
should specify paths to these entities. The dbpath parameter for the
descriptor file is generated automatically. Other elements of the
descriptor file may be added via the
descriptor_elements parameter
of init_training.pf. Finally,
init_training will create a zero-length
lastid table for the practice database, to protect the lastid table
for the site and waveform databases.
init_training will also copy into the training directory any files
specified by the
copy_files table. Finally, any rc files specified
in the
rcfiles array will be copied into the user's home directory
(with a leading '.'). Pre-existing rc files of the same name will be moved
to an identical file with the suffix of ".before_training".
PARAMETER FILE
practice_subdir practice
default_template pgc
templates &Arr{
pgc &Arr{
practice_database mydb
descriptor_elements &Arr{
schema rt1.0
}
site_database /chilako/rt/workshop/dbmaster/cnsn
waveform_database /raid/wf/cnsn
autoproc_database /chilako/rt/workshop/autoproc_test/al4ta
autoproc_tables &Tbl{
arrival
assoc
event
origin
}
copy_files &Tbl{
/chilako/rt/workshop/autoproc_test/pf/dbloc2.pf
}
rcfiles &Arr{
dbpickrc /opt/antelope/4.6/data/pf/.dbpickrc
}
}
}
EXAMPLE
% init_training
init_training: Created directory "/chilako/rt/practice"
init_training: Creating practice directory "/chilako/rt/practice/pgc"
init_training: Moving /chilako/rt/.dbpickrc to /chilako/rt/.dbpickrc.before_training
init_training: Copying /opt/antelope/4.6/data/pf/.dbpickrc to /chilako/rt/.dbpickrc
init_training: Completed setup of "/chilako/rt/practice/pgc"
%
% ls /chilako/rt/practice/pgc
dbloc2.pf mydb.arrival mydb.event mydb.origin
mydb mydb.assoc mydb.lastid
%
% cat /chilako/rt/practice/pgc/mydb
#
schema rt1.0
dbpath ./{mydb}:/chilako/rt/workshop/dbmaster/{cnsn}:/raid/wf/{cnsn}
%
SEE ALSO
rtinit(1), rtdemo(1)
AUTHOR
Kent Lindquist
Lindquist Consulting
Antelope User Group Contributed Software