A discussion of Antelope tools for making synchronization of files for interacting with the IRIS-DMC
NAME
db2sync - create a DCC-DMC Synchronization file of the data holdings in a Datascope database.
SYNOPSIS
db2sync [-s start_time] [-e end_time] [-S subset_expression] [-p pf_file] [-d] [-h] [-o] [-w] [-v] dbin fileout
DESCRIPTION
db2sync is designed to create a Synchronization file in the format constructed by the IRIS DMC from an existing Data- scope database. The sync file is an ASCII text file with data holdings listed in the following format (preceded by an optional one-line header that has the form "DCC_name|modification_date"):
field|field|field|....
where the fields are network, station, location id, channel, start time, end time, max clock drift, sample rate, number of samples, channel flag (continuous or triggered data), station volume ID, DCC tape number, DMC volume number, comment, modification time - DMC, modification time - DCC.
db2sync will use the affiliation, schanloc and wfdisc (or optionally wftar) tables to write the rows of this text file, where each row in the sync file corresponds to one wfdisc entry. The sync file produced always includes values for network, station, channel, start time, and end time, and will include either blank values or non-blank values for all other fields based on the db2sync parameter file specifications. Also, the header line will be produced only if the '-h' option is specified.
The DMC has resources available on their website to use sync files to view Gaps/Overlaps in a data holding or two compare a data holding to the DMC's holdings of that same data. These tools can be found at http://www.iris.washington.edu/SeismiQuery/goat/abouttools.html.
OPTIONS
-s start_time
Start time of data holdings to write into a sync file.
Default is to write all rows listed in the wfdisc/wftar
table to the sync file. Start_time should be in the
form of a julian day i.e. YYYYDDD.
-e end_time
End time of data holdings to write into a sync file.
Default is to write all rows listed in the wfdisc/wftar
table to the sync file. End_time should be in the form
of a julian day i.e. YYYYDDD.
-S subset_expression
Subset the data to write to the sync file by an expres-
sion specified by subset_expression. Subset by sta,
chan, and net are acceptable.
-d work in dummy mode. Forces program to continue even if
wfdisc does not join properly with the affiliation
table or schanloc table.
-h include header line. DCC name taken from pf file.
-p pf_file
use pf_file instead of the default pf file.
-o If a file already exists by the name given for the
fileout, overwrite it.
-w use wftar table instead of wfdisc.
-v verbose
dbin name of the Datascope database. It must contain a
wfdisc (or wftar if -w used) and affiliation table. It
must also contain an schanloc table if LOCATION is set
to 1 in the pf file.
fileout
name of the output sync file created.
PARAMETER FILE
The required parameter file is used to specify which optional fields to fill with non-blank values in the output sync file. It also specifies the Data Collection Center name, which is used in the header in the -h option. The default pf file specifies '0' for all fields but DATE_LINE_MOD_DCC, and has blank values for CHANNEL_FLAG and DCC_NAME. An example db2sync parameter file is as follows:
#Pf file for db2sync #Required Sync file fields are Network, Station, Channel, Time, Endtime. They are missing from the pf file because #all usable sync files must have those fields filled in. Db2sync will always fill in these fields. #Optional Fields. #'1' means include these values. '0' means print a blank value in that field LOCATION 0 SAMPLE_RATE 0 NUMBER_OF_SAMPLES 0 DCC_TAPE_NUMBER 0 DATE_LINE_MOD_DMC 0 DATE_LINE_MOD_DCC 1 #Channel Flag has a value of 'C' for continuous data and 'T' for triggered, or blank for no specified value. CHANNEL_FLAG C #Data Collection Center Name. This is used in the header, if a header is made. DCC_NAME Anza_Group
EXAMPLE
db2sync -v -s 2002001 -e 2003001 -S "sta=~/BZN/&&chan=~/B.*/" anza2review sync_out
Create a sync file of all the data contained in the dbin 'anza2review' for the year 2002 for station channels begin- ning with B of station BZN. The output file will be called sync_out. Output file should be in this format:
AZ|BZN||BHE|2003,001,00:00:00|2003,133,23:59:59|||||||||| AZ|BZN||BHE|2003,002,00:00:00|2003,134,01:19:34|||||||||| AZ|BZN||BHE|2003,002,01:19:35|2003,134,23:59:59|||||||||| AZ|BZN||BHN|2003,001,00:00:00|2003,133,23:59:59|||||||||| AZ|BZN||BHN|2003,002,00:00:00|2003,134,01:19:34||||||||||
DIAGNOSTICS
All messages are sent to STDERR.
BUGS AND CAVEATS
Currently, values for 'max clock drift,' 'station volume,' 'DMC volume number' and 'comment' fields cannot be found in the Datascope database schemas, and so there is no option to write these values into the output sync file with this program.
This program is set to fail if the affiliation table does not join properly to the wfdisc table. If the wfdisc includes stations that are not listed in the affiliation table, the wfdisc will lose the rows that do not have affil- iations. The program sees this and exits. Avoid this by making sure the affiliation table is complete, by subsetting out the non-affiliated stations using the -S option (the program will subset before it tries to join), or by using the -d option to force the program to continue producing the incomplete sync file. The same holds true for joining with the schanloc table (which only happens if LOCATION is set to 1 in the parameter file).
AUTHOR
Leah Ziegler
URL: http://eqinfo.ucsd.edu/faq/db2sync.php [Last updated: 2009-10-16 (289) 22:53:48 UTC]