NAME
sac2db - create css database from sac headers
SYNOPSIS
sac2db [-v] sacfile [ sacfile ... ] database
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
sac2db creates a
database using (some of) the information
in a SAC header. It creates the wfdisc, site and sitechan tables,
leaving the data in the original (float or intel float) format in the SAC file.
If event or arrival information is present, this information is
used to add to the event, origin, arrival and assoc tables.
FILES
The input files must be SAC.
The output files are standard CSS format.
EXAMPLE
% sac2db *.SAC new_db
% ls
LVZ.BHE.cut.SAC NRIL.BHN.cut.SAC new_db.site
LVZ.BHN.cut.SAC NRIL.BHZ.cut.SAC new_db.sitechan
LVZ.BHZ.cut.SAC new_db.lastid new_db.wfdisc
NRIL.BHE.cut.SAC new_db.remark
%
DIAGNOSTICS
-
Can't open sac file filename
-
Can't read sac file filename
For some reason, (perhaps permissions?), the named sac files
can't be read.
-
station name (kstnm) undefined in filename
-
can't figure out channel name for filename
-
Sample rate (1/delta) undefined in filename
-
time not properly specified in filename
-
# data points (npts) undefined in filename
The specified data was not present in the header.
-
SAC file filename not incorporated.
Because essential data (station name, channel name, time, sample rate,
or the number of data points) was not present in the sac header, the
named sac file was not incorporated into the database.
-
nzyear has a value in the first century,
changing it to the current millennium.
Sometimes, people fill in the year as 95 instead of 1995. This
is detected and changed to 19xx (for 100 > year >= 70) and to 20xx
(for 70 > year > 0 )
-
station latitude is null in filename
-
station longitude is null in filename
-
station elevation is null in filename
The station location information was not completely filled out.
-
channel orientation not present in filename
The channel orientation (cmpaz and cmpinc) were not specified.
The program attempts to infer the orientation from the last
letter of the channel name.
-
Origin time not specified,
so using file start time for file filename
Oftentimes, the origin time O is not specified in the SAC header, although
a latitude and longitude are given.
-
couldn't add filename to wfdisc
-
couldn't add sta='sta' ondate=yearday lat=stla lon=stlo elev=stel from filename to site
-
couldn't add sta='sta' chan='chan' ondate=yearday hang=hang vang=vang edepth=stdp from filename to sitechan
-
couldn't add time=evtime lat=lat lon=lon depth=depth from filename to origin
-
couldn't add a new event for file filename
-
couldn't add sta='sta' time=time iphase='iphase' from filename to arrival
-
couldn't add arid=arid orid=orid filename to assoc
All these error messages indicate a problem in writing records to
the database.
The message should indicate the root cause of the
problem (permissions or conflicting records in the database).
SEE ALSO
dbintro(3)
BUGS AND CAVEATS
Because the sac header is not very complete, the
database records are
likewise missing important information.
Furthermore, because sac headers are often constructed by hand, they
tend not to be very consistent, and there are sometimes local conventions
which differ from place to place.
Generally, sac2db soldiers on with fairly verbose error messages.
Although it may fail at adding some site or sitechan records, these problems
can generally be fixed by editing the resultant database by hand with
dbverify(1) (to find problems) and dbe(1) or dbset(1) to fix them.
A common complaint is that depths appear not to be copied correctly.
Apparently, it is common practice among SAC users to specify depth in
kilometers in the sac header; the documentation, however, clearly states
that all depths are in meters. In the CSS schema, depths are in kilometers,
and consequently, sac2db divides depths from the sac headers by 1000.0 to
convert from meters to kilometers.
AUTHOR
Daniel Quinlan
Antelope User Group Contributed Software