Antelope 4.10
Reference Guide
April 2008
Kent Lindquist
Lindquist Consulting
Daniel Quinlan
BRTT, Inc.
BRTT, Inc
2045 Broadway, Suite 400
Boulder, CO 80302
www.brtt.com
User
Commands
Contents
Antelope Real Time System............................ 1
Processing Database Data............................ 25
Seismic Source Location............................... 27
Foreign Data Formats.................................... 28
Waveforms..................................................... 34
Datascope Database Tools............................ 43
Miscellaneous Utilities ................................... 50
User Reference
Antelope Real Time System
Administration and Control
rtm [-icon iconname] [-title title] [-procwin] [-netwin]
monitor real-time tasks and resource usage
rtexec [options] [comment]
real time system executive; runs all other real time
processes
-c
-d
-f
-k
-n
-s
-t
-v
-w why
clear logs
debug mode
don't ask about killing previous rtexec
kill running rtexec
show what processes would be run
save old logs in new subdirectory
run `tail -f logs/rtexec`
more verbose
with -k, file why explains shutdown
rtinit [-q] [-v] [db]
initialize directory for rtexec/rtm by creating directories and copying pf files
rtrun [-nv] command-line
run command-line using rtexec environment (like an
rtexec cron job)
cronrun [-nv] command line
run command line immediately, reproducing cron
environment
ecrontab [-r] [file]
gui interface for editing crontab files; -r option for
rtexec style crontab
rtkill [options] [procname]
stop, start, or restart a process running under rtexec
-l
-r
-s
-q
-v
list process names from the rtexec.pf Run array
restart the specified process
start the specified process
query whether the specified process name is set
to run
verbose
rtdemo [-t] [name]
setup to run an Antelope realtime demo; -t suppresses gui
Antelope Real Time System
1
Antelope 4.10
truncate_log [options] log [log..]
eliminate old lines in log files
-c
-d n
-f
-h h
-m m
-r
-s n
-v
also remove lines without time tags
trim lines before n days ago
force truncation sooner than 8 days
specify max records in rtsys tables
trim files so maximum size is m kbytes
suppress saving removed lines in new file
only trim files larger than n kbytes
be more verbose
rtorbcmd [-d] [-p pf] target command
client program for sending commands to remote orb
rtorbcmd [-d] [-n npkts] [-p pf] [-S state] orb
server program for reading and executing commands at remote orb
Reports
dbevents [options] dbname [start [end]]
display map of seismic events and waveforms
(between times start and end)
-max_age max_agelimit age of displayed events
-show_detectionsshow stations with detections only
-title window_titlewindow title
-pf pfname
parameter file name
rtreport [options] [directory]
report some statistics on data collection
-d start
-g
-m email,..
-N re
-n days
-p pf
-s subset
-w wfdb
-v
-Y
-z
2
start of reporting period
only show gaps
list of email recipients
only report on network codes matching re
number of days report covers
use specified pf instead of rtreports.pf
report only on stations satisfying subset
alternate waveform database
more detail about gaps
include full date in event report
only z channels
Antelope Real Time System
User Reference
rtsys [options] [directory]
summarize system operation and log reports
-C
-d time
-m email,..
-N re
-n n
-P pf
-p
-w db
eliminate summary of cronjobs
start of reporting period
list of email recipients
only report on network codes matching re
last n lines from log files (default = 10)
use specified pf instead of rtreports.pf
mail only when problem is detected
specify alternate waveform db
rtoutage [options] db t0 t1
show data gaps for database db from time t0 to t1
-A
-c
-C
-d gapdb
-n netcode
-N
-P maxpts
-p
-s subset
-S
-t
-z
format output as an autodrm outage report
list reporting stations
list reporting channels
save gap info into database gapdb
only process station from netcode
summarize by network
maximum # waveform points to load at once
print percentage of data recovered
only show gaps for sta/chan subset
show gaps as seconds only
only show totals
select only vertical channels
rtmail [-s subject] [-a filename] [-b bcc] [-c cc] [-f from] [r replyto] [-dv] recipients
send mail with attachments
stanote [-{f|F} file] [-r range] [-t time] [database] [sta
[note]]
simple method for adding note about station, to
appear in gap report in rtreport
rtsnapshot [options]
collect some pertinent info from real time system
into tar file for problem report
-c
-d #rows
-f filename
-l #loglines
-p re
-v
include core files
max rows from database tables
specify output filename
max lines from log files
collect 50 packets matching re
more verbose
syssnapshot [-c] [-f filename] [-l #lines] [-v] [dir]
create tar snapshot of system configuration
Antelope Real Time System
3
Antelope 4.10
rtincident [options] [output_file]
collect some system related information into report;
rtexec runs this program and sends the results to
[email protected]
-c corefile
-e command
-l log
-M msg
-m addr
-n
-p program
-v
-x
specify corefile (on which dbx is run)
specify command line
specify log file for program
specify message to include in report
send report as email to addr
just show what would be run
specify program which dumped core
verbose
append corefile to email
inspect_snapshot snapshot
gui to help read output from rtincident or other
snapshots
IP network monitoring
pingmeister
display network connectivity
tcpmonitor [options] host
monitor tcp connections for stability and throughput
-B sz
-d db
-f
-2
-N #pkts
-m
-n #loops
-p port
-P #ping
-r lrsz
-R rrsz
-s lssz
-S rssz
-t timeout
-v
-W sec/ping
4
specify packet size
save statistics in database db
send bursts only from server
send bursts only to server
set #packets in burst
run in monitor (server) mode
# of bursts to send
alternate port
# of pings between bursts
set size of client receive buffer
set size of server receive buffer
set size of client send buffer
set size of server send buffer
set timeout (in seconds) for socket reads
more verbose
set number of seconds between "pings"
Antelope Real Time System
User Reference
Orbserver and Utilities
orbserver [options] pf
orb ring buffer server, using parameter file pf
-k
-p port
-P prefix
-r
-s size
-v[v]
don't reset ring buffer
use port instead of 6510
alternate names for orb files
reset ring buffer
ringsize, eg 150M
verbose/doubly verbose
orbserver64 [options] pf
same as orbserver, but allows much larger ring buffers (32 bit Solaris only)
diskserver [-p pf] [-v] dir[:port]
emulate read-only orbserver on port using directory
dir of special forb files
orb2disk [options] orb directory [start-time [end]]
copies packets from orb into into forb(5) segment
files inside directory
-b bi
-m re1
-r re2
-n n
-p period
-s size
-v
save state every bury interval seconds
read only packets which match re1
don't read packets matching re2
stop after n packets
approximate time length of files
size limit for directory
more verbose
orbproxy [options] orbhostport
orbserver proxy
-i local_ipaddr bind to one of several local ip addresses
-p local_portnolocal proxy port number
-v
more verbose
orbstat [options] orb [secs]
show statistics for orbserver orb every secs seconds
-c
show client statistics
-s
show source statistics
-i
interactive mode
-d [all|nets|stations|channels|loc_codes|types]show waveform info
-m re
show only packets or clients matching re
-r re
don't show packets or clients matching re
-n avg
boxcar average over avg queries
-v
more verbose
orbclients [-t] orb
show organized view of orbserver/diskserver clients
Antelope Real Time System
5
Antelope 4.10
pforbstat [options] orb [secs]
Create parameter files of orb status
-a
-c
-s
-m re
-r re
-f
-o orb
-n name
-v
analyze status for orb2orb connections
show client statistics
show source statistics
show only packets or clients matching re
don't show packets or clients matching re
specify output filename
specify output orb
specify srcname for packets on output orb
more verbose
orblook { start orbname interval | restart orbname interval
| stop orbname }
Start/Stop orblookupd daemon for monitoring orb
status
Data Loggers: import to orb
adsend2orb orb port
read earthworm packets from udp port and copy to
orbserver orb
guralp2orb [options] orbname
copy data from Guralp SCREAM server to orb
-d calibration_database
-p pf
-l file_for_logpackets
-v
verbose
-V
extremely verbose
guralplocate log1 log2 ...
estimate station location from guralp log files
ida2orb [-u] [-r sec] orb nrts selection
copy selected data from IDA nrts to orbserver
-u change station and channel to uppercase
-r sec
reject future packets
liss2orb [options] liss orb
copy data from LISS server liss to orbserver orb
-d database
-m m
-r
-s pktsize
-v
6
lookup calib, calper and segtype in db
only forward packets matching m
remap net,sta,chan,and loc using local foreignkeys db
specify block size explicitly
Antelope Real Time System
User Reference
rddas [options] port orb
copy data from RefTek DAS port to orbserver orb
-R
-l
-p pf
-s B,P,D,S
-u
-v
send RESET_DAS command before reading
create logfile representing data
specify parameter file
specify serial port baud rate B, parity P, data
bits D, stop bits S
write uncompressed packets to orb
verbose
q3302orb [options] targetname [orbtag1 orbname1
[orbtag2 orbname2 [...]]]
communicate with Q330 Quanterra digitizer, bringing data from Q330 into orb, and sending and monitoring commands from orb to Q330
-calib_db dbnamemetadata database
-pf pf
parameter file
-S statefile
-noipresolv
do not try to resolve ip addresses
-v
q330pocd [-i ip] [-p port] [-noipresolv] targetname orb
receive POC messages and save to orb
-i ip
-p port
-noipresolv
bind to one of several local ip addresses
specify alternative to port 2254
don't look up hostnames
q330_location [-m mail] [-p pf] [-t mmax] [-v] orb db
alert if Q330 locations in status packets differ more
than mmax from database location
q330coms [-n net] [-p pf] [-v] orb db
compare Q330 status packets with Q330comm database table
q330proxy [-v[v[v]]] [-help] [template]
internet to SLIP proxy utility for Q330 data loggers
q330snoop [-noeth] [-noip] [-snoop] prefix_expr
used with snoop to parse and print raw UDP Q330
packets
q330gpslocate log1 log2 ...
estimate station location from Q330 log file
qtbsetaddr ipaddr [timeout]
set Quanterra baler ip-address
Antelope Real Time System
7
Antelope 4.10
qt2orb [options] -dataorb orbd -cmdorb orbc -calib_db
calib_db [-dataorb2 orbd2]
communicate between Quanterra digitizer and orb
-pf pf
specify parameter file
-sta net_sta1 [net_sta2 [...]]
override names from parameter file
-msglevel {0|1}
-v
verbose
cs2orb [-v] [-seedout] [-t pf] [-dbcalib db] station orbout
copy data from comserv to an orbserver orb
k22orb [options] target orbdata [orbcmd]
transfer data from Kinemetrics Altus digitizer to an
orb
-pf pf
specify alternate parameter file
-db db
specify database for calib information
-dlclock dlname
-v
be more verbose
-state file
save state in filename
-start time
only get events after time
rtp2orb [-v] configuration_file
collect data from RefTek data server (RTPD) and
writes to orb
ryo2orb [-v] [-V] [-p pfname] [-m subset]
rtd_ipaddress:port orbserver
collect GPS data in RYO format and write to orb
b3s2orb [options]
read B3S2 data to orb
-c p1
-i p2
-o orb
-p pf
-s
-v
command port (default = "/dev/ttya")
data port (default = "/dev/ttyb" )
default = localhost
default = pkt.pf
more verbose
slink2orb [options] SeedLink orb
SeedLink to orb module
-dc database
-dm database
-nd delay
-nt timeout
-k interval
-pf pf
-S statefile
-o dumpfile
-r
-v[v[v]]
8
db to get calib, calper and segtype
db to map SEED to CSS names
network reconnect attempt delay
network timeout
keepalive interval
remap net/sta/chan
more verbose
Antelope Real Time System
User Reference
Datalogger Commanding
dlcmd [options] orbcmd targets dltypes dlnames cmd
[params]
execute command cmd on generic data loggers
-waittime waittimewait time for multiple targets
-timeout timeouttimeout waiting for response
-noblock
don't wait for response
-noreply
don't generate response packets
-prm
delete parameter files
-replytarget replytarget
-delayhangup delayhangupdelay digitizer hangup
k2cmd [options] orb target datalogger cmd
execute command cmd on remote Kinemetrics Altus
digitizer
-timeout timeouttimeout waiting for response
-noblock
don't wait for response
-noreply
don't generate response packets
-prm
delete parameter files
-delayhangup delayhangupdelay digitizer hangup
q330util {pollsn targetip | register targetip,sn,lport | getconfig targetip,sn,lport,config | control targetip,sn,{eeprom|reboot|resync|gpson|gpsoff|gpscs}
}
perform some utility functions for Q330
-port port
udp port
-port_base port_basebase port for Q330
-auth auth
Q330 authorization code
-sequence seq starting sequence number for commands
-timeout timeouttimeout for udp response
qtcmd [options] cmdorb net_sta cmd [params]
execute commands on remote Quanterra digitizer
-target target
-replytarget replytarget
-timeout timeout
-noreply
automrc [options] orbname dc_name
automatically send mass recentering command to
RefTek DAS
-m srcmatch
-p pf
-s sleep
-t tperiod
-V verbatim
-v max_lta
Antelope Real Time System
9
Antelope 4.10
dlautomrc [options] cmdorb orb [target]
issue mass recenter commands to remote data loggers
-a vlt
out of range voltage value
-d dl
data logger type
-f
force mass recenter (with -s, not with -a)
-m add
email notification list
-n
no mrc, only report what would be done
-p pf
parameter file
-s dl_sta1,dl_sta2,... comma separated list of data loggers
-t n
number of retries
-v
verbose
-x dl_sta1,dl_sta2,...comma separated list of rejected data
loggers
Real Time Status to orb
cpu2orb [-i t] [-vv] orb
put cpu and system utilization packets on orb every t
seconds
df2orb [-i t] [-p pf] [-vv] orb
put filesystem status information packets on orb
every t seconds
heartbeat [-i interval] [-N net_sta] [-v] orb
creates periodic condensed status packets with system info
ps2orb [options] orb
save process information from ps(1) to orb at interval t seconds
-a m
-i t
-n mx
-t n
-r {mem|cpu}
-u user
-vv
report on all processes every m'th iteration
report every t seconds
quit after mx iterations
report on top n processes every iteration
sort by mem or cpu
restrict to specified user
print reports on stderr
tail2orb [options] orb [file ...]
monitor multiple files, sending any added lines as
packets to orbserver orb
-g n
-i t
-m m
-N net_sta
-p pf
-S state
-vv
10
check for new files matching glob patterns
every n'th iteration
check files every t seconds
specify maximum number of files monitored
specify alternate srcname
specify alternate parameter file
specify alternate state file
print lines on stderr also
Antelope Real Time System
User Reference
orblog [-f file] [-s subcode] orb [log info]
write single log packet to orb; packet contents are
remainder of command line, stdin, or -f file
orb2logs [-cn] [-m match] [-r reject] [-S state] [-w pattern]
orb logdb [start [stop|period]]
save logs packets (from tail2orb or from data logger
acquisition) back into corresponding plain files
divided by epoch day boundaries (and by data logger).
orbtail [-f] [-m match] [-r reject] [-number] orb [start
[end|period]]
read and print log packets from orb
orb2ntp [-d delay] [-f freq] [-m match] [-n navg] [-o old]
[-r reject] [-u unit] [-Mv] orb
use orb packet times as (very rough) ntp clock
rtlogs orb
display log messages from orbserver orb
Other Orb Writers
pf2orb [-s sta] [-p subcode] pfile orb
put parameter file onto an orb as packet; use -s and p to specify parts of packet srcname
dbt2orb [-v] [-s subset_expr] [-l naptime] db table orb
read rows from database and post them to orb
dborigin2orb [options] db orb
copy new origins from db.origin into orb for automatic association of external catalogs with real time
events
-after time
specify start earlier than now()
-delay delay
wait delay seconds before appending to orb
-nowait
quit after processing existing db.origin
-number n
quit after processing n events
-target_orb2dbt targetspecify alternate target orb2dbt
-v
more verbose output
Antelope Real Time System
11
Antelope 4.10
dbreplay [options] view orb [t0 [{t1|T}]]
replay database view to orb from t0 to t1 (or t0+T)
-b max
-d
-e
-F db
-n n
-p pktsuffix
-r rate
-s expr
-T timeout
-t timestep
-u
-v
-w client
-x
pause if client is more than max seconds
behind
send station portion of database
send event portion of database
db to map net/sta/chan/loc
quit after n packets
specify output packet type
specify data rate as ratio to real time
subset input according to expression
with -w, give up after some timeout
specify packet time size
don't append /@ suffix
more verbose
specify read client to watch (to avoid overruns)
eliminate trailer packet used for orb2db flush
Real Time processing: Orb reader/writers
orb2orb [options] in out [start [period|end]]
copy data from one orb to another
-c suffix
-C rate
-d
-f
-i secs
-l
-m re1
-n n
-p pf
-R r
-r re2
-S filename
-s p
-U
-u n
-v
-X xlat
-x
convert packets to suffix format
throttle to specified output rate: kbytes/sec or
(with p suffix) pkts/sec.
print hex dump of each packet
for file input, do not adjust time tags, and output packets as quickly as possible
save state file every secs seconds
loop repeatedly over input forb(5) file
read only packets which match re1
stop after n packets
alternate parameter file
when saving to file, use forb(5) format r
don't read packets matching re2
save state in filename
start after pktid #p
unstuff each packet and print
discard duplicates in latest n packets
more verbose
translate srcnames according to morph table
require acknowledgment for each packet sent
orbxchange [-d db] pf
run multiple orb2orb connections controlled by pf;
use db for fallback orb sources
12
Antelope Real Time System
User Reference
orbxfer2 [-N net] [-p pf] [-w dir] [-v] [file ...] orb
write files into orb; with -w, watch directory dir and
send files which appear there into the orb and
remove them from dir
orbxfer2 [-p pf] [-S state] [-v] orb
receive incoming files, save into directory specified
in pf
orb2genc [options] orbin orbout
convert input packets into unmultiplexed GENC format
-t translation_pf
-start {pktid|time|OLDEST}
-select select_expr
-reject reject_expr
-S statefile
-dbcalib dbcalib
-v
orbaddcalib [options] dbcalib orbin orbout
add calib, calper and segtype to ORB waveform
packets
-onlynull
only fill in packets with NULL calib values
-dbcheck
check database for each waveform packet
-v
more verbose
-t translation_pfmorph SEED names
-select select_exprselect expression for incoming packets
-relect reject_exprreject expression for incoming packets
-start {pktid|time|OLDEST}initial ORB read pointer position
-S statefile
statefile
orbstaseg [options] csssta orbdetect orbwfin orbwfout
single station waveform segmenter
-start {pktid|time|OLDEST}
-select_wf expr
-twin_pre twin_pre
-twin_post twin_post
-twin_write_timeout
-twin_maxon twin_maxon
-S statefile
-repackage twin subcode
-detev
-v
Antelope Real Time System
13
Antelope 4.10
orbdetect [options] orbname dbname
multi-frequency STA/LTA detector
-nopending
suppress pending detection packets
-onlypicks
only output onset time packets
-out orb
-out_detev orb output orb for detev packets
-pf pf
-reject re
-select re
-tstart t0
-twin minutes
-v
orbdetev2detection [options] dbfkeys orbin orbout
convert detev database rows to detection rows
-delay delay_seconds
-start {pktid|time|OLDEST}
-S statefile
-v
orbtrigger [options] orbname
real time network trigger algorithm
-v
-tstart t0
-target_orbassoc torbassoc
-pf pf
-out orbout
orbassoc [options] orbin orbout ttgridf1 [ttgridf2 [...]]
spatial grid search based real time associator/locator
-auth author origin author field
-delay delay
time delay for processing latent stations
-pf pf
-select expr
-start {pktid|time|OLDEST}
-target_orb2dbt torb2dbt
-trigger_start_only
-v
ttgrid [-pf pf] [-time {timestr|all}] db
compute travel time grid file for use by orbassoc and
dbgrassoc
displayttgrid [-shownames] filename [gridname]
display travel-time grids on map
14
Antelope Real Time System
User Reference
ttgrid_show [-adDgnNPsSv] ttgridfile
show members of a ttgrid file
-a
-d
-D
-g
-n
-N
-P
-s
-S
show everything
show depths
show distances
show grids
show nodes
print in a nicer form
show P arrival times
show stations
show S arrival times
orbevproc [options] orbwf orbev dbname
generalized real-time event processor
-start {pktid|time|OLDEST|NEWEST}
-select expr
input select expression
-number numbernumber of events to process
-nowait
-state file
save state in file
-p pf
-tmpdbdir dir directory for temp databases
-dbwf dbwf
archive waveform database
orbmag [options] orbwf orbdb dbname
real time magnitude computation
-start {pktid|time|OLDEST|NEWEST}
-number number
-nowait
-state file
save state in file
-p pf
-auth_expr auth_expr
-target_orbmag torbmag
-make_magtables
-use_mean
-use_if_not_associated
-use_if_not_defining
Antelope Real Time System
15
Antelope 4.10
orbampmag [options] orbwf orbdb dbname
real time computation of mb, ML or Ms magnitudes
-auth_expr auth only use packets with matching author
-make_magtablesmake netmag and stamag packets
-nowait
quit when no packets left to process
-number n
limit on packets to process
-pf pf
-start {pktid|time}
-state state
-target_orbmag orb1
-next_target_orbmag orb2
-use_mean
use mean, not median statistics
-use_p2p
use peak to peak, not maximum value
-use_if_not_associated
use all stations
-use_if_not_defining
use all picks
-v
orbwfrms [options] dbname orbin [orbout]
compute running rms estimates from waveform
packets
-start {pktid|time|OLDEST}
-select sexpr
-reject rexpr
-end endtime
-pf pf
-S state
-v
orbpftrigger [options] orb [cmdstring]
parameter file trigger of program execution
-select expr
-start {pktid|time}
-number number
-nowait
orbptrigger [options] orb command ...
orb packet trigger of program execution
-select packet
-start {pktid|time}
-number number
-state file
-background
16
Antelope Real Time System
User Reference
orbwfmeas [options] orbwf orbdb dbname
make waveform measurements from an orb
-select_wf expr
-start {pktid|time|OLDEST|NEWEST}
-number number
-nowait
-state filename save state in filename
-p pf
-net net
-dbsift_expr dbsift_expr
qedd [options] dbname
daemon to get realtime QED data from finger site
-l
-ipfinger ipfinger
-sleep seconds
-timeout seconds
-author author
orb2sms [-v] [-m match] [-r reject] [-M prog] orb
{cell#|email}
reformat packets from orb as sms messages
sms2orb [-dv] queue orb
read incoming sms email from queue directory and
write packets to orb
Orb Real Time Display
dlmon [options] orb [cmdorb]
monitor/control generic digitizers
-model model data logger model
-state {Icons|Multi|Single}initial display state
-select_status expr_status
-select_log expr_log
-subset subs_exprinitial expression for subsetting stations
-sort name
initial sort name
-pf pffile
parameter file
-dump period
-dump_image file
old_dlmon [options] orb [-cmd cmdorb]
legacy version of monitor/control generic digitizers
-model model data logger model
-start_status {OLDEST|pktid|time}
-start_log {OLDEST|pktid|time}
-select_status expr_status
-select_log expr_log
-dump period imagefile
-pf pffile
parameter file
Antelope Real Time System
17
Antelope 4.10
dlmontxt [options] orbname [orbname2 [...]]
generate terse status summary for data loggers
-m re1
-r re2
-d dl_re
-M email
-s subject
read only packets which match re1
don't read packets matching re2
match data logger names
list of email addresses, or @filename for
addresses in filename
subject line for email report
orbmonrtd [options] orb
real time waveform trace display
-dump dt gif
dump image to gif every dt seconds
-filter filter
-height pixels single trace window height in pixels
-hmax hmax
maximum height of main window in pixels
-ntinc nt
number of traces between time scales
-pf pf
use alternate parameter file
-redraw
start with oldest orb packet
-reject re
reject channels matching re
-select re
select channels matching re
-source net_sta_chan
select display channels on command line
-title title
title for orbmonrtd window
-tshift_time t0 specify t0 for right edge of window
use t0="-" to use first packet time
-twin minutes window size in minutes
-unmap
remove controls from display (for vnc in
browser)
-width pixels trace width in pixels
-wmax wmax maximum width of main window in pixels
-reverse_labels put station labels on right
orbdisp [options] orbserver [start [range|end]]
inspect waveform data on orb server
-c re
-m re
-r re
-l latency
-n
-p period
-w t
18
save channel matching regular expression re
select packets matching regular expression re
reject packets matching regular expression re
expected max latency for packets
show network on display
specify minimum packet period
make time window t seconds
Antelope Real Time System
User Reference
Saving Orb Data in Database
orb2db [options] orb db [start [end|period]]
copy waveform data from orbserver orb into database db (starting at time start through end or for
stated period)
-a log
-c re
-m re
-r re
-p pf
-S file
-s datatype
-T tol
-t timetags
-v
-vv
-w wfname
log of waveform files opened and closed
save channel matching regular expression re
select packets matching regular expression re
reject packets matching regular expression re
specify parameter file
save state in file
specify output waveform type (overriding pf)
tolerance for packet time tag deviation
create file of time tags from input packets
more verbose
show every packet read.
specify pattern for waveform file names
orb2db_flush [-nv] [-m match] [-r reject] orb
cause orb2db to write out all waveform data for
selected packets
cdorb2db [options] orb db [start [end|period]]
copy gappy/out of order (CD1) waveform data from
orbserver orb into integer waveform files of database
db (starting at time start through end or for stated
period)
-c re
-m re
-r re
-p pf
-S file
-t timetags
-v
-vv
-w wfname
save channel matching regular expression re
select packets matching regular expression re
reject packets matching regular expression re
specify parameter file
save state in file
create file of time tags from input packets
more verbose
show every packet read.
specify pattern for waveform file names
db2msd [-t age] [-1nv] db
convert older waveform files to miniseed in place,
used with cd2orb. with -1, use steim 1 compression
Antelope Real Time System
19
Antelope 4.10
orb2dbt [options] orb dbout [orbout]
read database packets from an orb and write to database
-select expr
-reject expr
-start {pktid|time|OLDEST}
-number number
-target_orbmag torbmag
-timeout timeout
-overwrite
-state statefile
-pf pf
-orbdbout orbdbout
-v
orb2db_msg [-q] [-s sleep] [-t timeout] db [pause|continue|status]
signal orb2db and orb2dbt processes to pause for
database db cleanup oro realtime database crunch
par2db [options] orbname dbname [start [window]]
create database with GPS site coordinates and DC/
DAS status parameters from orb
-c
Extract DC status parameters
-g
Extract GPS site coordinates
-i time_interval
-m re
select packets matching regular expression re
-v
more verbose
orblatency [options] orb database
accumulate latency statistics from network
-m re
-n n
-r re
-p period
-v
20
select packets matching regular expression re
quit after n iterations
reject packets matching regular expression re
period over which latencies are averaged
more verbose
Antelope Real Time System
User Reference
orbmsd2days [options] orb
save miniseed (only) packets from orb into day volumes
-c nscl
-d db
-S state
-U
-I
-m re1
-r re2
-s st
-e et
-w wf
-v
specify particular net_sta_chan_loc desired
create wfdisc table in db
save orb position in state file
limited duplication suppression
inclusive time screening
select packets matching regular expression re1
reject packets matching regular expression re2
save data only when block start time >= st
save data only when block start time < et
pattern for the output miniseed files
Be more verbose.
Orb Alarms
acalarm [-d] [-m srcmatch ] orbin mail_add [stime]
send mail when AC power fails in DC packets
battalarm [-d] [-m srcmatch ] orbin mail_add
send mail when battery power drops in DC packets
pktmon [-n npkts] [-p pf] [-S state] [-0dv] orb
read packets, send alarms for specified conditions
-0
-S state
-d
-n npkts
-p pf
-v
start at first packet in orb
specify alternate directory to save history files
print debugging information.
stop after npkts packets
specify alternate parameter file
print each packet read.
Miscellaneous
resetnetblazer hostname line timeout
reset Telebit Netblazer terminal server
orb2pf [options] orb [file]
copy parameter file objects from an orb to file
-select expr
-start {pktid|time}
-number number
-nowait
mail_parser [options] [file [file...]]
direct incoming email to customized perl handlers
-v
-m
-f logfile
-l library_path
-p pf
Antelope Real Time System
21
Antelope 4.10
Archiving Data
rtbackup [-v] [-V] [-n]
[-p pf] [-r reject_stas] [-s sta_match] [-t start_time ]
[-e end_time] rt_db backup waveform and database
data from rt_db to independent disk directory
rtbackup2tape [-v] [-m who] [-p pf] db drive
original rtbackup (renamed)- backup waveform and
database data from db to (tape) drive
get_archive [options] db dbout drive [t0 [t1]]
restore waveforms (between t0 and t1) to dbout
using db.wftar from rtbackup tape on drive
-c re
-s re
-v
select channels with regular expression
select stations with regular expression
more verbosely
rtdbclean [-n] [-v] [-V] [-w] [-p pf] orb rt_db
remove old waveform data and associated database
records
get_wftar -v dbmaster tape_drive
extracts wftar table from an ARTS archive tar tape
online_backup [options] [directories]
backup certain files to an online directory
-d n
-d dir
-m
-n
-p pf
-t t
-v
-V
-y n
remove log files after n days
specify an alternate base directory
send mail rather than writing to stdout
don't actually run backup, but show what
would happen
specify parameter file
backup files modified more recently than time t
more verbose
show generated perl procedure which selects
files to be saved
backup files modified in last n days
Orb Diagnostic Tools
orbcapture [options] orb db file
save packets from orbserver orb to file when new
row in database (satisfies condition)
-b m
-a n
-c condition
-R {a|x|f}
-v
22
start capture m packets before trigger packet
capture n packets after trigger packet
only new rows satisfying condition trigger capture
specify output format ascii, hexadecimal, or
header only
verbose
Antelope Real Time System
User Reference
forbserver [options] filename
file orbserver emulator
-[a|b|f|x]
-c
-s
-U
-v
-w
specify format in output forb(5) file
adjust time tags to the current time.
meter out packets at real time rate
run elog_debugger() to start a debugger on the
process.
more verbose
overwrite existing file instead of appending
pkttypes [-c]
print summary of packet types for installed packet
library
orbstash [-m match] [-o out] [-r reject] [-v] in [srcname]
get and print stash packets from an orbserver in
ipvalidate [-p pf] [-v] [ip-addresses]
test if particular ip address is accepted or rejected by
valid_ip_address list in pf
CD1 Alpha Format Protocol
orb2cd1s [-pf pf] [-select expr] [-reject expr] [-state statefile] [-start {pktid|time}] [-v] orb1 orb2
repackage and reformat data packets from orb1 into
CTBT/IMS standard CD-1 format subframe data
packets on orb2
cd1s2cd1 [-n net] [-m match] [-r reject] [-v] [-S state] orb1
orb2
copy CD1S subframe packets from orb1 and put
CD1 packets on orb2
cd1tran [-a after] [-S base] [-m match] [-r reject] [-s
name] [-v] orb alphahost
read CD1 packets from orb and send to alphahost
using alpha protocol
cd2orb [options] [orb]
alpha protocol server to save incoming CD1 packets
from multiple hosts onto orb
-c sec
max sec between connect mgr request and connection
-d db
database for calib, calper, segtype
-i ip
explicit ip address for mgr to provide incoming
requests
-P cmport[,cd1port]request port, connection port
-p pf
alternate parameter file
-S dir
specify state directory
-v[v]
more verbosity
cdremap [-p pf] [-t time] database
test/reproduce channel mapping done by cd2orb
Antelope Real Time System
23
Antelope 4.10
cd1replay [-s sta] [-t dt] [-v] file [file2 ...] receiver
replay cd1 data saved by cd2orb (using code sta)
24
Antelope Real Time System
User Reference
Processing Database Data
dbdetect [options] dbin dbout
run multifrequency STA/LTA detector on dbin, writing detections into dbout.
-arrivals
-noaddchk
-onlypicks
-pf pf
-tstart t0
-twin T
-v
write arrival records also
don't do database checks
write only detection pick rows to db
pf specifies channels and filters
start at t0
for T minutes
dbgrassoc [options] dbin dbout ttgridf1 [ttgridf2 [...]]
spatial grid search based associator/locator: reads
detections from dbin, generating new origin, assoc
and arrival records in dbout
-auth auth
-i
-noassoc
-pf pf
-v
auth field for db, default is dbgrassoc
flush stdout and reread pf
no smart association
dbassoc [options] dbin dbout dbcat timeres_P timeres_S
associate origins from dbcat with arrivals in dbin,
write origin, assoc and optionally predicted arrivals
into dbout; timeres_P and timeres_S specify allowable
travel time residuals
-arid arid1 ... | -orid orid1 ... | -evid evid1 ...
select events by arid, orid or evid
-ignoreiphase do not match indicated phase with predicted
-v
-writeout
write text to STDOUT after processing each
origin
-pred
save predicted arrivals
-prefor
set prefor
-rules r
any combination of
P,S,PS,PS+,first,arids=all,best,all
dbassoc_arrival [-p delta_p] [-s delta_s] dbout dbin
search for arrivals from dbout which match origins
in dbin, copying matching origins into dbout and creating assoc records
assoc_rayleigh [-v] dbout dbin
associate rayleigh wave picks from dbout to origins
from dbin, copying matching origins into dbout and
creating assoc records
Processing Database Data
25
Antelope 4.10
dbgme [-vfd] [-p pf] -r recipe [-r recipe...] [-o orid]
dbname
2-D ground-motion estimation from hypocenters
and waveform measurements
dbevproc [options] dbin dbout
generalized database-driven event processor
-p pf
-tmpdbdir dir
-v
directory for temp databases
dbmag db orid author net
compute mb magnitude for origin orid (or "all") in
db, saving result in netmag and origin with specified
author
dbml [options] db [orid]
database Richter magnitude computation
-v
-p pf
-use_if_not_associated
-use_if_not_defining
-make_magtables
-use_mean
dbmapevents db {sta | orid | lat:lon} range [-c] [auth1
sym1 hue1 lit1 sat1 ...]
make map of events from database db centered on
sta, origin orid, or lat:lon within radius of range
degrees; -c starts interactive mode, ^C kills window
dbrecenteqs [-p pf] [-v] [-h] [-u] [-e evid] [-c sourcedb]
dbname
maintain web-site of earthquake maps for for database dbname
26
Processing Database Data
User Reference
Seismic Source Location
dbloc2 [-r] [-p pf] database
interactive hypocenter location
dbloc_snapshot [-f output-file] [-v] database
creates snapshot of dbloc2 directory for problem
resolution
dbgenloc [-p pf] dbin dbout
genloc program used by dbloc2
dblocsat2 dbin [dbout]
locsat program used by dbloc2
dblocgrad dbin [dbout]
locate local earthquakes with 1D linear gradient
model
tabcalc
travel time calculator for 1-D, continuous velocity
models
hypotab
companion program to tabcalc travel time calculator
pltt phases depth d0 dd nd tmin tmax vred [table]
plot travel times from tau-p travel time table
prtt phases ndp dp0 ddp ndel del0 ddel [table]
print travel times from tau-p travel time table
tp2ls phases header [table]
make locsat style travel time table file from tau-p
travel time table
dbproject_covariance [-v] [-c conf] dbname
update origerr table with new smajax, sminax,
sdepth, stime, strike, and conf values, based on
covariance matrix from origerr table
relocate dbin dbout [-pf pf] [-useold] [-sift expression]
relocate all events in database using genloc
orbgenloc orb [-S statefile] [-pf pf]
orb interface to genloc single event location code
sgnloc inpf outpf
command line interface to single event location
code
taup_convert phase [-d0 x -ddelta x -z0 x -dz x -ndelta n nz n]
uses taup library to produce travel time tables that
can be used by genloc location programs
Seismic Source Location
27
Antelope 4.10
Foreign Data Formats
Exporting Data from Datascope Database
autodrm [options] [files]
Antelope IDC/GSE2.1 AutoDRM Server
-d
-D dir
-p pf
-v
debug: print output to stderr rather than sending mail
run in directory dir
use parameter file pf
more verbose
dbresp2autodrm view
convert response information from view to autodrm
format
rtbulletin [-Av] [-s subset] aview [t0 [t1|period]]
create a bulletin from input view aview (-A causes
standard autodrm output)
db2ah [options] dbin dbout
convert css waveform files into ah format
-sc
-ts
-te
-w
-gap
-counts
-h
-v
sta_chan
start time
end time
wfdir
{ none | zero | interp }
help
version
db2sac [options] dbin dbout
convert css waveform files into sac format
-i
-sc sta/chan
intel order output
select sta/chan pairs with dbpick style pseudoglob
starting at time t0
ending at time t1
write waveform files into wfdir (default "sac")
-ts t0
-te t1
-w wfdir
-gap {none|zero|interp}
handle gaps according to rule (default zero)
-counts
keep output waveform in counts (don't apply
calib)
db2segy db outfile [-pf pf] [-v]
convert waveforms from input database db to segy
disk image
Importing Data into a Datascope Database
aah2db [-vV] ahfile [ahfile...] dbname
convert non-XDR AH files to database
28
Foreign Data Formats
User Reference
ah2db ah1 [ah2 .. ] dbout
create CSS database dbout from AH format waveform files ah1, ah2, ...
autodrm2db [-vV] reply1 [reply2 ..] dbout
read autoDRM replies reply1, reply2, ... and copy
into output database dbout
gnis2db gnis_file dbname [State]
convert GNIS feature-name files to database
grdinfo2db [-n name] [-t type] gridfile dbname
add GMT grid-file information to database
pick2db [-cvp] [-r reference_db[:reference_db...]] pickfile
[pickfile...] dbname
convert hypoellipse pickfile(s) to CSS3.0 database
-c
attempt to fake channel names
-v
verbose
-p
put component code into channel field
-r reference_db[:reference_db...]]
add references to other databases in descriptor
file
reb2db filename [filename ...] db
convert Reviewed Event Bulletins of GSE2.0,
IMS1.0, or IMS1.0:SHORT format to CSS3.0 database db
ref2db [options] input dbname [start-time [end-time]]
convert data in REFTEK format to css3.0
-d datatype
-e
-l
-m das
-p pf
-s size
-n net
-v
-w
specify waveform datatype
create files based on RefTek event start and end
time
create logfile containing instrument status
information
copy only packets with serial number das
specify parameter file to match das to station
name
default segmentation of waveforms
specify miniseed network
print srcname and time of every packet read
do not save waveform data; used to extract log
file or get gap info
sac2db [-v] sac1 [sac2 ... ] dbout
create wfdisc, site, sitechan (and possibly origin,
event, arrival and assoc records) in output database
dbout from SAC files sac1, sac2 ...
Foreign Data Formats
29
Antelope 4.10
scec2db [options] dbname
retrieval and conversion of SCEC bulletin
-v
-d
-w
-m
-f
-s
-e
-c
verbose
retrieve one day
retrieve one week
retrieve one month
file
start_time
end_time
{catread|scecdc|hypo71|hypo2000}
segy2css [-event] [-ftbl] fname ..
convert PASSCAL SEGY format data to CSS format
Xphase2db db [-phase name]
convert an input Xphase pick file to css3.0 arrivals
Examining Foreign Files
sachd [sac1 ...]
print header information from SAC files sac1, ...
Reading seed/miniseed
sdd [-sv] sd
dump blockettes (summary only if -s) from SEED
volume sd
msdd [-dovx] miniseed ...
dump miniseed volume; -o shows opaque blockettes
msdd -i miniseed
interactive mode for inspecting miniseed
chkmsd [-v] db
checks all miniseed blocks to see db and miniseed
agree
seeddump [-lsize sz] [-types list] [-v[v]] [-sta] seed
dump certain blockettes from seed according to tlist:
(V=Volume, A=Abbreviation, S=Station, T=Time
span, D|R|Q=Data)
30
Foreign Data Formats
User Reference
seed2db [options] seed [db]
read SEED volume seed, produce validation commentary and optionally database tables
-lsize
size specify logical record size
-vvv
be increasingly verbose
-respdir rdir
save responses into rdir
-stagedir sdir create stage table; save stage responses
into sdir
-chansift pf
-tstart t0
-tend t1
-nodata
-nodataless
-nofirerrors
select specific sta/chan pairs through pf
start at time t0
stop at time t1
create no wfdisc table
only create wfdisc
shut up about fir errors
qtunbale [options] url [time [endtime|period]]
unload data from Quanterra baler
-a
-c chan
-d db
-f w
-i info
-o orb
-q
-Q
-r
-S dir
-t to
-u
-v
-w wfname
just show time range available
only channel chan (??-???)
make wfdisc with miniseed2db
size of time window for requests
where to save info files from baler
pass directly to orb using miniseed2orb
wait quietly for baler to wake up
don't ping baler
raw output, no miniseed2days or miniseed2orb
subdirectory for miniseed day files
timeout for ping response from baler
show all URLs used
more verbose
specify pattern for miniseed files
qtunbale2 [options] url [time [endtime|period]]
like qtunbale, but using wget instead of perl http
miniseed2db [-T tolerance] [-v] miniseed|dir [msd2|dir2
...] db
create wfdisc rows in db for miniseed volume(s), or
miniseed volumes under directories
Foreign Data Formats
31
Antelope 4.10
miniseed2orb [options] file ... orb
put data blocks from input miniseed files into packets on orb
-s start
-e endtime
-I
-m re
-r re
-d db
-p pf
-u
-v
start-time
end time
inclulsive time screening
keep if net_sta_chan_loc matches re
reject if net_sta_chan_loc matches re
look up correct sta/chan in calibration table
alternate parameter file
don't add /@ suffix to srcnames
more verbose
miniseed2days [options] miniseed ...
separate input miniseed into separate channel day
volumes
-C file
-d db
-D
-I
-S dir
-e end
-k
-m match
-r reject
-s start
-U
-u
-v
-w wfname
chuck blocks with bad time or compress errors
into file
create output db by running miniseed2db on
output files
retain duplicate seed blocks in output
inclulsive time screening
alternate output directory
ignore data after endtime
keep input data blocks with poor timing quality
only keep net_sta_chan_loc matching this re
reject net_sta_chan_loc matching this re
ignore data before start
eliminate consecutive duplicate data blocks on
input
eliminate all duplicate data blocks from input
more verbose
alternate pattern for output file names
Writing/Patching SEED/miniseed
db2sd [-cv] [-n net] [-l lbl] db sd
create SEED volume sd from database db (db must
contain affiliation, network, sensor, site, stage, calibration and wfdisc tables)
mk_dataless_seed [-n re] [-o dataless_seed] [-p pf] [-s
re] [-vk] db
create dataless seed volume from db, optionally
using only stations which match -n net and/or -s sta
regular expression
mk_dmc_seed [-nvV] [-l secs] [-r days] [-M maxmem] [m email] [-s stime] [-t tape] [-d dir] rt_db
build IRIS DMC files on tape or disk
32
Foreign Data Formats
User Reference
db2miniseed [options] db [output]
create miniseed from input database
-r size
-l {1|2}
-n net
-v
specify record size (default 4096)
specify steim compression level (default 2)
specify default network
verbose
log2miniseed [-a] [-c chan] [-l loc] [-n net] [-s sta] log ...
read input log files and create miniseed
fix_miniseed [-iv] [-d db] [-{p|P} pf] miniseed|dir ...
change network, station, channel and/or location
codes in specified miniseed volumes or all miniseed
found under specified directories
patch_miniseed [-nvv] miniseed ...
look for and fix bad reverse integration constants,
unless -n
Foreign Data Formats
33
Antelope 4.10
Waveforms
Waveform manipulation
trexcerpt [options] dbin dbout [start {duration|end}]
extract waveform segments from database
-A
-a
-c expr
-d
-D
-e
-E
autodrm style (ascii) waveform files
append to existing waveform files if present
sta/chan/instrument subset
write complete database with site, sensor,
sitechan, instrument
dumb mode requires only wfdisc table
include correct subset of event, origin, origerr,
arrival, and assoc in output database
expert mode does not check for problems in
site, sensor, sitechan or instrument tables
eliminate 'marked' data gaps
origin/site subset
-g
-j expr
-m {time|convert|event|arrival|explicit}
-o datatype
specify output waveform datatype (default =
sd)
-p
in arrival mode, save waveforms only for pick
channel
-s expr
evid/orid/arid subset
-v
more verbose
-vv
show details of view evaluations
-w pattern
specify naming convention for output waveforms
specify mode (default = time)
-W db
specify database from which waveforms come
trtally [-d output] [-ekv] [-r start stop] db1 [{+|-|!|&|^|a}
[db2]]
compute intersections and other operations on two
sets of waveform time ranges
trmapnames [-anv] db [net fsta fchan {loc|aux}]
trmapnames -u [-anv] db [sta [chan]]
map foreign net/sta or sta/chan/loc codes into local
sta and chan codes, or vice versa
34
Waveforms
User Reference
event_archive [options] dbin dbout
copy event information (arrivals, origins, and waveforms) from continuous database dbin to archive
dbout
-I idserver
-l n
-M db
-m addr
-s t1
-e t2
-n
-p pf
-t tdb
-w wff
-v
-V
specify idserver
wait n days before copying an event
db containing site, sitechan: used only on initial archive to dbout
send errors as email to addr
process events after time t1
process events before time t2
ignore check for reviewed events
use parameter file pf
use temporary database tdb
output waveform format
be verbose
be extremely verbose
trsample [options] database[.table] [time [end|period]]
print a few samples from waveforms in database
-c
-e
-I
-[i|t|T]
-n npts
-o
-s expr
Waveforms
apply calib to samples
read data from each row in table
interactive mode
show integer, epoch time, or readable time
index for each sample
print npts samples
write samples one to a line
subset input according to expr
35
Antelope 4.10
trsignal [options] database
create wfdisc records with test signal data
-{A|D|V}
-a amplitude
-b timebase
-c channel
-d datatype
-f f0
-g calib
-k
-n nsec
-p phase
-r samprate
-s station
-t time
-T type
-v
-w pattern
-y yaw
segtype
generating function base time
specify chan code
specify output datatype (default = "as")
generating function frequency in hz
specify calib
keep output as floating point, not integers
length of output waveform
generating function phase
sample rate
sta code
start time for output
sin, cos, sqr, tri, saw, dlt, ran, stp, pkt, dif
be more verbose
specify naming convention for output waveforms
constant signal drift
dbdec [options] dbin dbout chan_maps dec_stage1
[dec_stage2 ...]
decimate waveform data
-sift expr
-c calper
-wfdir wfdir
-f format
alter_timestamps [-demnquv] [-p pf] db[.table]
alter_timestamps [-nquv] [-f foreign] [-p pf] miniseed
change waveform and arrival timestamps for clock
problems
-d
-e
-f foreign
-m
-n
-p pf
-q
-u
-v
36
dump corrections table
expert mode: ignore checks on corrections
table
specify foreignkeys database
correct the miniseed along with the wfdisc
table
just show what would happen
use an alternate parameter file pf
interactively examine time corrections by
entering a station and time
undo previously applied corrections
be more verbose
Waveforms
User Reference
dbtc [-p pf] [-t time] [-v] gdb:gnet:gsta:gch
bdb:bnet:bsta:bch
create time correction table by comparing good
source gdb:... with bad source bdb:...
correctdt [-m srcmatch] [-t stime] [-v] bdb
using correction table from dbtc, correct times in
wfdisc and arrival tables, and in miniseed
Analysis
dbap [options] -dbin dbin -recipe recipe1 [recipe2 [...]]
database array processing program
-script script_file
-dbout dbout
-v verbose
-ts tstart_time
-te end_time
-arid arid
-arid_t0 arid_t0
-arid_tw arid_tw
-chan chan
-filter filter
-samprate samprate
-azimuth azimuth
-slow slow
-name1 value1 [-name2 value2] [...]
Waveforms
37
Antelope 4.10
dbcalibrate [options] dbin [sequence_id
[sequence_id_cmp[,chan_cmp]]
sensor and cross comparison calibration analysis
program
-out dbout
-prm
output database name
delete temporary parameter file after execution
-p pfname
use an alternate parameter file pfname
-calper calper calibration period
-resp_dir resp_dirdirectory for output response files
-resp_dfile resp_dfilefilename for output response spectrum
-resp_dfilee resp_dfileefilename for output response error
spectrum
-resp_dfilen reap_dfilenfilename for output nominal
response spectrum
-dcalwf_sifter exprused to subset rows from input dlcalwf
table
-sngen sngen fix sensor generator gain to this value
-v
be more verbose
-outrecno
print output sensorcal table row numbers
-error_at_calper compute errors relative to spectrum amplitude at calper period
-template name use name processing template from
parameter file
-dbcmp dbcmp take comparison waveforms from dbcmp
database
-noise tstart_noisenoise start time
-type {ratio|power|coherence}computation type
dbwfmeas [options] {detection|arrival|time staexpr
chanexpr tstart twin} db [dbout]
make waveform measurements from database
-p pf
-net net
-v
-outrecno
-exitonerror
dbnoise dbname
make power spectral density plots of noise
displayspec dbname
display power spectral density results
trstack dbin dbout subset imode [-azmin=xx] [azmax=xx] [-delmin=xx] [-delmax=xx] [pffile]
stack selected traces from dbin
38
Waveforms
User Reference
Waveform display
dbplotcov database sta:chan tstart tend [-h[scale]] [wftar]
make plot and listing of waveform coverage from
database
dbrsec [options] db
make record section plot of waveforms
-sc sta:chan
-orid orid:chan
-top top
-bot bot
-tstart tstart
-twin twin
-filter filter
-sift sift
-clip {on|off}
-vred vred
-gain gain
-amp amp
dbspgram dbname sta chan tstart twin [options]
compute time varying spectragram
-fmin fmin
min freq in hz
-fmax fmax
max freq in hz
-units {D|V|A} displacement, velocity, acceleration
-thalf thalf
1/2 width of gaussian time window
-noic
no instrument correction
-ampdecades ampdecades# decades in amplitude to plot
-ps psfile
Waveforms
39
User Reference
dbpick [options] dbname
pick arrivals and review waveforms from dbname
(see .dbpickrc for filter specs)
-sc sta:chan specify station/channel "glob"; eg "*:*Z"
-ts tstart
specify start time
-te tend
specify end time
-tw twin
specify window time width
-noexist
-nostarttalk
suppress startup usage chatter
-nostdin
suppress command line input
-winfile wfile
-appname name
specify tksend application name
-gaps {segment|zero|interp|none}
-comout comfile
-geom WxH+X+Y
-switchbuttons switch middle and right mouse buttons
-showdetections show detections
-showfm
show first motions
-iconic
start up trace window as icon
-bg color
trace background color
-fg color
trace foreground color
-bga color
arrival background color
-fga color
arrival foreground color
-bgsa color
selected arrival background color
-fgsa color
selected arrival foreground color
-fgdt color
detection foreground color
-fgtm color
timemark foreground color
Waveforms
40
User Reference
tkdbpick [options] {dbname|-}
pick arrivals and review waveforms from dbname
-pf pf
-sc sta:chan
-ts_sift tstart_sift
-te_sift tend_sift
-ts tstart_display
-tw twin_display
-gaps {segment|zero|interp|none}
-maxchannels maximum_channels_in_display
-appname tkdbpick_application_name
-comout comfile
-geom WxH+X+Y
-stam {css|seed}
-trcrm {both|time|none}
-ampm {auto|auto0|auto1|autoa}
-bg tracewin_background_color
-fg tracewin_foreground_color
-cr tracecursor_foreground_color
-fgcss sta_css_label_foreground_color
-fgseed sta_seed_label_foreground_color
-fgfil filter_label_foreground_color
-bga arrival_background_color
-fga arrival_foreground_color
-bgsa selected_arrival_background_color
-fgsa selected_arrival_foreground_color
-timefm time_format_string
-datefm date_format_string
-phase_default default_phase_code
-switchbuttons
-noedit
-nosort
-noshowwfs
-noshowarrs
-noshowpreds
-cliptraces
-counts
trdisp [-g geom] [-r] [-s subset] [-w hours] database[.table] [start [range]]
display waveform data and arrivals from database or
view
Waveforms
41
User Reference
dbheli [options] db sta chan tstart twinline nlines scale
make helicorder type plot of channel waveforms
-f filter
-o dborigin
-ps psfile
Waveform Verification
dbversac database
compare sac file headers with CSS database
dbchkwf [ -v ] database
file consistency check for wfdisc
dbcmpwf [-acmv] db1[.table] record1 db2[.table]
record2
dbcmpwf [-acmsv] db1[.table] db2[.table]
dbcmpwf [-acmv] -i db1[.table] [db2[.table]]
dbcmpwf [-cmtv] db1[.table] db2[.table] t0 {t1|range}
compare waveform files from two database records
or tables.
dbversdwf [-s subset] [-T maxtdelta] [-dftuvwxX] database
check SEED format waveform files for consistency
with wfdisc
Waveforms
42
User Reference
Datascope Database Tools
Database Schemas
dbbuild [-bv] [-p pf] db [input]
build new database with site, sitechan, sensor,
instrument, stage and calibration tables
dbbuild_validate [-dsv] [file ..]
verify that referenced parameter files contain all
required fields
dbhelp [ db | s ]
gui to explore schema for database db or schema s
dbdescribe { db | schema } [ table ]
generate ascii formatted document describing
schema, database, or database table
dbdoc db
generate troff formatted document describing
schema for database db
dbfilenames [-v] db
list database tables and permissions
dbdesign [schema]
create and/or edit Datascope schema files
dbinfer file [file...]
build schema file from set of ascii example files
dbquery [-isv] [-f fld] db[.tbl] [query ...]
query database/schema for parameters like field size
dbsnapshot [options] db [start_time [end_time|period]]
create tar snapshot of database (for debugging)
-d d
-e e
-f file
-n m
-r
-R
-s s
-v
-w M
copy output to dir d rather than tar file
related to event evid e
name of tar file
max records (per table) to include
include response files
include stage response files
subset expression for stations/channels
more verbose
minutes M of data before now
Creating and Editing Databases
dbe [-e] [-p pf] db[.table] [ db[.table] ...]
general purpose viewer/editor for databases
dberesp [db.table | -f response ..]
run by dbe to plot response curves from database
table or response files
Datascope Database Tools
43
User Reference
db_extfile_proc -m mode [-u] [-w nmax] [-t table]
db.table
run by dbe to run arbitrary commands on database
external files
db_textedit db.table
run by dbe to edit external text files
db_xvimage db.table
run by dbe to show external image files
db_showurl db.table
run by dbe to show external web pages
remark_gui [table|view]
run by dbe to add/show remarks
dbset [options] db[.table] field from [to]
change value of attribute field throughout database
-c
-l
-v
ask before changing ('all' accepts all changes)
use literal value for comparison
show changes
dbconvert [-fv] [-s new_schema] db dbout[.table]
create dbout (or dbout.table) from database db,
using rules from dbconvert parameter file
dbcreate [-r refdb] [-s schema] [-iv] database
create database descriptor file
dbcp [options] dbin[.table] dbout
copy database dbin (or dbin.table) to database dbout
-a alt
-d
-i
-F
-f
-l
-o
-s
-v
specify alternate subdir for external file copies
make descriptor file for dbout which references dbin
prompt for permission to overwrite existing
tables
override ../ exclusion (caveat emptor)
copy external files (default changes references)
create local symbolic links for external files
quietly overwrite existing external files
copy without correcting external file references
verbose
dbadd [-afov] dbin.table dbout.table expr1 [expr2 ...]
add rows to dbout.table using rows from dbin.table
and expressions expr1, expr2, ...; with -a, add all
fields from dbin.table, with -f ignore key duplications, with -o overwrite duplications
Datascope Database Tools
44
User Reference
dbaddv [options] database.table [name value name value
...]
add records to table
-c
-i
-f
-v
confirm each addition
interactively
ignore key duplication
verbose
dbdelete [options] view [table ...]
delete (or mark) all records in database view (or just
records in table)
-c
-m
-s
-v
require individual confirmations for each
record
mark records only (no final crunch)
save copy of original file
verbose
dbcrunch [-nv] db [table ...]
crunch out marked (null) records in database db, or
just tables
dbdestroy [-ginkv] db[.tbl]
destroy database or table by removing all associated
files
-g
-i
-n
-k
-v
remove files which match glob of db.*
confirm each file removal first
show what would happen (don't do it)
keep external database files
verbosely
dbsplit [options] dbin dbout
copy records from database dbin which satisfy some
subset expression into database dbout, using rules
from parameter file.
-d
delete selected rows from dbin after copying to
-f
-k
-p pf
-s subset
-v
overwrite any existing output tables in dbout
keep renamed backup of original tables
parameter file
records which satisfy expr are copied to dbout
verbose
dbout
dbmerge [-vV] [-x tb1,tb2] dbin dbout
merge database dbin into database dbout (except for
tables tb1, tb2, ...)
dbconcat_event db1 db2 [ db3 ...] dbout
combine multiple CSS 3.0 event databases db1, db2,
... (arrival, assoc, event, origin, and origerr tables)
into single new database dbout
Datascope Database Tools
45
User Reference
dbfixids db idname [ idstart ]
dbfixids [-s server] [-i id1,...] [-x id2,...] db [ db2 ]
renumber ids for idname (starting at idstart) in database db, or sync ids to idserver server
-i ids
-x ids
only renumber these ids
don't renumber these ids
Creating Database Views
dbsubset [-n name] [-v] aview expr
keep only records from aview satisfying expression
expr
dbsort [options] aview [key ...]
sort input aview by keys
-o
-n name
-r
-u
-v
overwrite original table with sorted table
save results into database.name
reverse sense of sort
eliminate extra rows which are identical in sort
keys
mention number of output records
dbjoin [options] aview [:key ...] table2 [[:key ...] table3 ...]
join input aview with other tables, either by inferring
join keys or by explicitly specifying join keys
-o
-n name
-v
outer join
save results into database.name
verbose
dbnojoin [-n name] [-v] aview [:key ...] table2
create view of records from aview which do not join
with table2
dbtheta [-c expr] [-n name] [-v] aview table2
create view joining aview to table2 where expression
expr (on joined record) is satisfied
dbseparate [-n viewname] [-v] aview table1
create view containing only rows of base table table1
used in aview
dbsever [-v] [-n name] aview table2
create new view which removes table2 from input
aview
dbunjoin [-f] -o dbout aview
create new database dbout using base table records
from aview
dbselect [options] aview [exp ..] [-pre exp exp ...] [-post
exp exp ...] [-group field1 field2 .. [-pre exp exp ..] [-
Datascope Database Tools
46
User Reference
post exp exp ..]] [-group field1 field2 .. [-pre exp exp
..] [-post exp exp ..]]
print selected fields and expressions from input
aview
-b
-F sep
-h
-p
-s
strip blanks from each field in output.
separator
add automatic headers to output
print primary key
allow expressions to modify database fields
with operator ":=".
db2xml [options] aview [name expr [name expr ...]]
print database view as XML
-d tag
-p
-r tag
-v
tag name for document root
primary keys only
tag name for each row
verbose
Verifying Databases
dbcheck [-vv] db[.table]
scans database (or table) for lines with invalid
length
dbverify [options] db[.table]
perform some consistency checks on database db
(or table)
-A t1,t2..
-c
-C c1,c2,..
-I t1,t2..
-i
-j
-k
-l
-N mx
-O t1,t2..
-P t1,t2..
-p
-r
-s
-S n
-t
-u
-v
-x
-X pf
alternate keys need not be unique in t1, t2, ..
perform consistency checks
run only specific consistency checks c1,c2,...
suppress table checks on t1, t2, ..
check that referenced foreign ids are present
test 2-table joins from parameter file
verify primary and secondary key are unique
check that lastid table entries are valid
print maximum of mx failures for some tests
perform table checks only on t1, t2, ..
primary keys need not be unique in t1, t2, ..
external program tests from parameter file
check attribute ranges
check for shadowed database tables
sample n records, not entire table
turn off all tests
complain about unreferenced ids
verbose
check for existence of external files
use alternate parameter file
Datascope Database Tools
47
User Reference
dbcheck_responses [-t tolerance] [-v] database
dbcheck_responses [-t tolerance] [-v] -f response-file ...
perform simple checks on response files from
instrument and stage
dbdiff [options] db1[.table] db2[.table]
find differences between two databases (or tables)
-A absolute_tolerance
-R relative_tolerance
allow floating point values to vary by some
absolute or relative tolerance in indexes
-a absolute_tolerance
-r relative_tolerance
allow floating point values to vary by some
absolute or relative tolerance
-e
print times as epoch seconds
-i name
list of names to ignore
-l {exact|compare|ignore}
for link fields
-N max_diffs show a maximum of max_diffs per table
-o
compare records in order rather than by index
-w width
-x {exact|compare|ignore|Program}
for external files
Miscellaneous
dbcentral [-dln] [-q query] [-t time] [database_cluster
[task_nickname]]
launch commands on commonly used databases
dbids [-p port] [-P pf] [-v] database
idserver for Datascope databases
dbindex [-v] database[.table [keys..]]
create static index(es) for static tables or databases
(use with caution)
dbnextid db idname
get next available id for idname (in database db)
dbcalc [options] db.table [ record# | expression ]
interactive interface to Datascope expression calculator
-c expr
-e
-r
-t
calculate single expression
echo input to stdout
print reverse polish notation for expression
show type of each piece of expression and
result
Datascope Database Tools
48
User Reference
dbremark [ -p ] database table field value
get/add remark from/to database (must contain
remark table and commid)
dbfixchanids [-q] [+q] db
fix chanid attributes in wfdisc and arrival tables
dbfixtimeres db [expr]
fix time residuals in assoc table (for records which
satisfy expr)
dbfix_calib db
replace null calib values in wfdisc with values from
calibration table
Datascope Database Tools
49
User Reference
Miscellaneous Utilities
build [pf] [pf_dependent_arguments]
framework for constructing simple gui interfaces
based on parameter files and perl scripts
children pid ...
returns children of process pid
cleartmp [-nv] directory idle
cleartmp removes files from directory which have
not been used in over idle days, and finishes by
removing any empty directories.
tksend [options] app_name [message]
send message to program using tk send protocol
-i
-p
-verbose
-validate
read stdin for more messages
wait for and print returned messages
be more verbose
validate application name and return disposition and version number
-version {3|4|auto}
select older or newer tksend protocol; default is
auto{matic}
-wait
wait for response
txform [-v] dir filename
text transform program
warp [-nv] command
run command on opposite display (if machine has 2
displays)
Examples and Templates
See the example directory also.
mkmk [ - ]
show prototype Antelope makefile (- suppresses
comments)
manpage [ - ]
show prototype Antelope man page (- suppresses
comments)
template [example]
get example from templates directory
Miscellaneous Utilities
50
User Reference
Antelope Installation
antelope_update [options] [url]
update local antelope installation from standard
BRTT patches or alternative url
-i
-l
-L
-m mailto
-n
-p proxy
-q proxy
-Q
-r id
-t
-v
ask before installing each patch
just list unapplied patches
list all patches to terminal with '*' if patch is
unapplied
run silent, but send email if patches are needed
show what would happen, don't actually do it
use proxy with password authentication
use URL proxy
don't ask about stopping realtime systems
(caveat emptor)
specify a different antelope release
terminal mode (no gui)
verbose
check_license [-v] [license_filename]
verify license is valid
register_antelope [-t]
gui for requesting Antelope license
required_unix_programs
check for programs required by Antelope
Path utilities
abspath apath [...]
construct absolute path corresponding to input apath
relpath here there
construct relative pathname from here to there
cleanpath [-l] apath
eliminates repeated slashes, unnecessary ./, and
resolves symbolic links unless -l
concatpaths path p2 ...
concatenate paths from command line or stdin to
create complete path
datafile [-ae] {name | dir name | env dir name}
show what files will be selected by datafile/datapath/datasearch(3) routines.
Miscellaneous Utilities
51
User Reference
Antelope facilities
epoch [options] [ +format ] [ time/date components ]
convert time formats.
-d
-e
-l
-i tz
-o tz
+format
show input as elapsed time, eg 1.5 days
echo interactive input
output in local time
specify an input timezone tz, eg US/Mountain
specify an output timezone tz, eg Japan
specify format of output (refer to epoch
escapes table)
elog [-cdlnS] [-f fault] [message]
exhibit behavior of elog error routines with message
elog -e errno
print error message for numeric system error
elog -s signal#
print signal description
pfe [-X] [-font font] [-level level] [{ - | pfname1 [pfname2
[...]]}]
parameter file navigator GUI
-X
-font
-level
don't expand references
font for pf tree graphics
default display level
pfcompare [options] pf
find differences between local parameter file and
remainder of pf files found along PFPATH
-s
-u
-v
-V
show stock version (instead of local)
show unique items
verbose
very verbose
pfdiff [-1t] [-o newpf] pf1 [pf2]
compare parameter file pf1 to pf2 (or $ANTELOPE/
data/pf/pf1 if pf2 is unspecified)
-o
-t
-1
interactively selects parameters from pf1 and
pf2 to construct pf, newpf
runs tkdiff
limits depth of recursive comparison
pfecho [options] name [ param ...]
print out parameters from parameter files
-i
-q
-R
-w
-W
-x
interactive mode
don't echo key
show parameters overridden by later parameter
files
show all pf files read
show all filenames examined (may not exist)
expand all references inside pf
Miscellaneous Utilities
52
User Reference
pfverify [-v] [pf-files]
check resolution of all plain references in parameter
files
pfwhich pf
show what files are read for pf
ttcalc method model phase distance depth
print travel time and slowness calculation results for
method, model, and phases for an event at distance
and depth.
gsregion [lat lon]
geographic and seismic region numbers and names
for lat, lon
dbsetrgn db
set seismic and geographic region codes in origin
table for database db
trwfname [input]
try out trwfname(3) patterns
comsim connection
monitor, test and debug serial or ip communications
xunits [-amqv] [from [to]]
convert values from one unit to another, eg newtons
to lbs
Miscellaneous Utilities
53
User Reference
File utilities
grepsrc [options] [-cfhilMmpsTtvyw] [pattern [dir]]
look through certain files below dir for pattern; useful for finding occurrences of call to function, or for
many other problems
-i
case insensitive
-l
show only filenames with matching lines.
-v
show find command, and list files searched.
-w
show all matches, not just word matches.
restrict searches to certain files by using any combination of:
-A
include directories named junk and ending in -c
c source files
-C
c++ source files
-f
fortran source
-g glob
files matching glob
-h
include files
-M
Makefile or makefile
-m
manual pages
-P
parameter files
-p
perl source
-s
shell source
-T
all text files
-t
tcl source
-y
(f)lex and yacc source
Miscellaneous Utilities
54
User Reference
ffilter [-BbCcDdelnpStuvVXxz] [-E s/from/to/] [-m re] [-r
re] [paths]
filter list of files according to various options
Combinatorial options
-a
autosplit input lines
-b
binary files
-c
in CVS
-C
not in CVS
-d
directory
-e
empty directories
-l
symbolic links
-L
is plain file and has multiple links
-o
is on this file system
-O
is on different file system from $cwd
-p
plain file
-t
text file
-x
executable
-z
zero size
-v
invert result of all tests
Regular expression matching
-m re
keep matching files
-r re
reject matching files
Operations on filenames
-D dirname
extract dirname
-B basename extract basename
-S suffix
extract suffix
-E command perl command operating on filename
Other options
-X
execute each result
-n
only show command, don't execute
-u
print only unique paths
check_path [-v] [path]
check path to ensure that 'other' users can traverse it
cmpdirs [options] dir1 dir2
-c
-C
-i re
-l
-t
-r
-v
compare files
ignore CVS directories
ignore files/directories matching re
list format output
compare only text files
recursive
more verbose
Miscellaneous Utilities
55
User Reference
xdiff [options] dir1 dir2
compare files after eliminating expected discrepancies
-a abs
-b
-B
-c
-C
-d diff
-D display
-F
-i
-I re
-L
-o
-O
-q
-r rel
-S
-s
-t
-v
-V
set absolute tolerance for numerical differences
ignore blanks
keep blank lines with exception file
ignore case differences (spiff only)
treat as C files (spiff only)
specify the diff program to run
specify the display to run tkdiff on.
treat as Fortran files (spiff only)
case independent compare
ignore files with names like regular expression
e
skip files when both are symbolic links
in comparing directories, ignore missing files
in the 2nd directory.
in comparing directories, ignore missing files
in the 1st directory.
only show files that are different, don't show
differences
set relative tolerance for numerical differences
treat as Bourne shell scripts (spiff only)
suppress matching lines in the output
use tkdiff to show files where there are differences
be more verbose
show each command run, and show each substitution when an exception file is provided.
-w width specify screen width when using sdiff
-x exceptions file containing perl regular expressions
mapped to null before comparison
-X
don't ignore CVS directories
Programming aides
getid [-aNv] < in > out
substitute special values into source files; used to
centralize some info and help architecture independence
Miscellaneous Utilities
56
User Reference
ldlibs [options] names
suggest link libraries; provide information about
object libraries
Modifying Options
-f
generate fortran ldlibs line (default is c)
-i
initialize database, eg, completely rebuild it
-k
rebuild database, if it's out of date
-n
don't use macros to collapse dependency list
-v
be more verbose
-x
specify entry points on command line, rather
than object files
-X lib1 lib2
show all multiply defined entry pts or global
variables between lib1 and lib2
Different Modes
-D lib
show refs defined in lib
-N lib
show refs not defined in lib
-L lib
show libraries which load lib
-l lib
show libraries loaded by lib
-r lib1 lib2
show refs from lib1 which are resolved in lib2
-R a.o b.o ..
lib show undefined refs from .o files which are
resolved in lib
-S lib1 lib2
show shared undefined refs between lib1 and
lib2
-s lib1 lib2
show shared definitions between lib1 and lib2
-T lib1 lib2
show needs unique in each library
-t lib1 lib2
show definitions unique in each library
-U lib
show libraries which need lib
-u lib
show libraries which are needed by lib
-V lib
index a single library, verbosely
-w routine
show what libraries define routine
-W routine
show what libraries require routine
compile [options]
used by BRTT to compile with optional optimization on different architectures
deposit [-rx] file dir
installs file in directory dir with appropriate permissions; -r installs file with new name dest; -x makes
installed file executable
deposit [-i re] idir dir
installs directory idir into dir except for files matching re, CVS and .depends files
produce [-v] exec [exec2 ...]
use standard headers from template directory to create executable script exec from files with proper suffix
Miscellaneous Utilities
57
User Reference
installman [-nv] manpage dir
install manpage into directory dir, modifying .TH
line appropriately
fixman [-BInd] pages
check man page, correct some problems, and suggest other changes
certify [options] [dir|testid ...]
run regression tests
-a
-A
-c database
-C
-d
-e
-f
-D
-G
-H dir
-i
-k
-l
-m
-M
-n
-p
-P
-Q
-q
-R
-r
-s
-u
-U
-x path
-X results
with -u or -A, update all tests, even if they don't
fail.
ask if correct result should be updated when a
failure occurs.
use alternate database instead of ./certify
run cvs update before running the tests.
rerun just the diff commands
show the environment
run failing tests only
run dbx on the executable
run gdb on the executable
run in the specified directory
set up; make directories input, data, results and
correct; initialize certify database
keep results even if test is successful
list tests
send mail about failures, otherwise be quiet
suppress the use of the watchmalloc library.
show what tests would run
compile with Purify before running the test
Compile with Purify, but no x-windows
only show failing tests
don't show errors in detail
run certify in every subdirectory which contains certify db
cleanup directory by removing results and executables
stop at first failure
update correct results from the output of this
run
run the executable under ups
add path to front of PATH environment variable
add a line for each test to results file
Miscellaneous Utilities
58
Scripting
Languages
Interfaces
Contents
Perl Datascope Interface ................................. 1
Perl Orb Access............................................. 11
Perl System Information ................................ 15
Perl Trace Waveform Processing Interface.... 17
Perl Station-Channel Gather Interface........... 18
Perl History Interface ..................................... 19
Perl Vector Interface ...................................... 20
Perltk Bplot .................................................... 21
Tcl Datascope and Utilities............................ 25
Tcl Orb Access .............................................. 32
Tk Brttplot ...................................................... 36
Tk Gpl............................................................ 41
Tk Pixmap...................................................... 43
Tk Vogle......................................................... 44
Tcl/Tk Extensions .......................................... 50
Datascope PHP Interface .............................. 51
Orb PHP Interface ......................................... 60
PHP System Information ............................... 63
Matlab Interface............................................. 65
Scripting Reference
Perl Datascope Interface
use Datascope ;
% man perldb
Opening a Database
dbopen(database, permissions)
return database pointer to the database
dbopen_database(database, permissions)
open database (or database.table or "-" for view from
stdin), return database pointer
dbopen_table(database.table, permissions)
open database.table (or "-" for view from stdin),
return database pointer
dbcreate(filename, schema, dbpath, desc, detail)
create database descriptor file filename with specified
schema, dbpath, desc and detail
dbtmp(schema)
return database pointer to temporary database with
specified schema
dbclose(@db)
close the database, freeing all resources
dbfree(@db)
free resources for table or database
dblookup(@db, database, table, field, row)
return database pointer for the specified database,
table, field, and row.
Manipulating Fields and Records
dbadd(@db [, record])
add the new record to the table in @db. If record is
not specified, add the scratch record. return the new
row number, or an error code < 0.
dbaddnull(@db)
add null row to table
dbaddv(@db, field_name, value, [field_name, value, ...])
add new row with the specified values to table
dbaddchk(@db[, record])
Attempt to add new record, first checking for conflict, like dbaddv
dbmark(@db)
set the specified rows to all null values
dbdelete(@db)
delete row from the database
Perl Datascope Interface
1
Antelope 4.10
dbcrunch(@db)
delete all marked (null) rows from the specified
table
dbtruncate(@db, n)
truncate table to specified number of rows
dbdestroy(@db)
delete all tables and the descriptor file for the specified database, but not external files
dbget(@db [, 0])
return [or copy to the scratch row] the specified field
or row
dbgetv(@db, field_name [, field_name, ...])
return values of the specified fields for @db
dbput(@db [, string])
copy from scratch row [or from string] to specified
field or row
dbputv(@db, field_name, value [, field_name, value, ...])
save values into the specified fields for row @db
dbadd_remark(@db, remark)
add comment in remark table for row @db
dbget_remark(@db)
get any comment from remark table for row @db
Forming Views
dbgroup(@db, key [, key, ...])
group the input table according to the specified keys
dbjoin(@db1, @db2 [, join-keys])
return join of the two tables, using the join-keys if
specified
dbmatches(@db1, @db2, hookname [, join-keys])
return list of rows in db2 which match row @db1
dbnojoin(db1, db2 [, join-keys])
return view of all rows in view @db1 which don't
join to @db2
dbprocess(@db, commands)
return new view which is the result of applying the
dbprocess commands to the input view; possible
operations are: dbopen, dbjoin, dbgroup, dbleftjoin,
dbnojoin, dbselect, dbseparate, dbsever, dbsort,
dbsubset, dbtheta, dbungroup
dbseparate(@db, table)
return new view which consists of all the rows of the
specified table which participate in the joined view
@db
2
Perl Datascope Interface
Scripting Reference
dbsever(@db, table)
return new view which consists of all the unique
rows left after removing the specified table from
joined view @db
dbsort(@db [, -u][, -r][, key, key..])
sort the input table according to the specified keys,
uniquely if -u, in reverse order if -r
dbselect(@db, expr[, expr[, expr..]])
print table of expressions from view
dbselect_hdr(@db, expr[, expr[, expr..]])
print headers for expressions
dbsubset(@db, expression)
return new view which is the set of all rows which
satisfy the expression
dbtheta(@db1, @db2, [expression])
return new join view with all combinations of rows
from the two tables which satisfy expression, or all
combinations if no expression is specified
dbunjoin(@db, database)
create new database, containing all the records referenced in the input view @db
dbsave_view(@db, name)
save the view into file named database.name
Miscellaneous Datascope Functions
dbquery(@db, code)
query the database for information, e.g.
dbquery(@db, dbRECORD_COUNT). see Datascope Constants for valid query codes.
dbex_eval(@db, expression)
evaluate expression for particular row
dbcompile(@db, string)
add new attributes or relations to the schema
directly from the perl script
dbextfile(@db [, base-table])
return the filename for an external file for particular
row in view
dbnextid(@db, id_name)
gets the next free id value for the specified database
and id_name
dbstrtype(@db, string)
classifies string, returning "strREAL", "strINTEGER", "strNULL", "strSTRING", "strTIME", "strFIELD", or "strUNKNOWN"
Perl Datascope Interface
3
Antelope 4.10
dbfind(@db, string [, first [,reverse]])
find first row matching expression, starting with first;
if reverse, search backwards
dbinvalid()
return database pointer of dbINVALID
dbget_range(@bundle)
returns start, end of range for bundle db pointer
dbbase(@db[, table])
returns base table database pointer corresponding to
record @db
Waveforms
trsample(@db, $t0, $t1, $sta, $chan[, $apply_calib])
fetch waveform data from table @db for $sta/$chan
between $t0 and $t1. returns time/value pairs If
$apply_calib is non-zero, calib is applied.
trloadchan(@db, $t0, $t1, $sta, $chan)
load data for $sta/$chan between time $t0 and $t1.
returns database pointer to trace table.
trcopy(@dbout, @dbin)
returns a temporary copy of a trace database table,
possible appending to an existing table
trdata(@db[, $i0[, $npts]])
returns $npts data points starting at $i0 from trace
table record @db
trsplit(@tr)
eliminate marked gaps inside the trace table @tr by
splitting segments containing marked values
trsplice(@tr)
glue together segments (if possible) in trace table
@tr, eliminating overlapping segments.
trfilter(@tr, filter)
apply specified filter to the traces; see trfilter(3)
trfree(@tr)
free trace table memory.
trlookup_segtype(char)
return units and description for segtype char
Error Handling
elog_init($0, @ARGV)
initialize the elog message routines
elog_log(msg)
save message on the elog message log
4
Perl Datascope Interface
Scripting Reference
elog_debug(msg)
elog_notify(msg)
elog_alert(msg)
elog_complain(msg)
send debug, notify, alert, complain message to the
elog facility
elog_die(msg)
send message to the elog message facility and die
elog_callback(replacement)
replace standard elog processing with perl routine
replacement is called with two arguments: severity
code and a string containing the elog log. it must
return an integer; if return != 0, error log is cleared.
elog_string(n)
return error log starting with message n
elog_clear()
clear the elog message log
elog_mark()
return the count of messages currently held in the
error log
elog_flush(deliver, first)
eliminate log messages after first, printing them if
deliver is set
Parameter Files
pfget(pfname, key)
return the value for the key from the parameter file
pfname
pfget_boolean(pfname, key)
return 0 or 1 depending on the value of key in the
parameter file pfname
pfget_size(pfname, key)
returns number corresponding to key in parameter
file pfname, allowing suffix G, M, k, m or u.
pfget_time(pfname, key)
return epoch time corresponding to key in parameter
file pfname, using str2epoch
pfupdate(pfname)
check and reread parameter file if file used along
PFPATH changed
pffiles(pfname [, all])
return list of file which make up parameter file
object. If all is specified, return all possible filenames, including non-existent files.
Perl Datascope Interface
5
Antelope 4.10
pf2string(pfname)
return string representation of the parameter file
object pfname
pfnew(pfname)
create a new empty parameter file object with name
pfname
pfcompile(string, pfname)
convert the specified string into parameter file object
name pfname.
pfput(key, value, pfname)
save the specified value into the pf object with
name pfname under the specified key. The value is
converted to string if it's scalar; when it's a reference
to a perl array or hash, the entire perl array or hash
is stored in the pf object.
pfwrite(filename, pfname)
write out pf object pfname to filename
pfrequire(pfname, atime)
require pf_revision_time from last file pfname is
later than atime.
pfdel(pfname, key)
delete named key from pf object pfname
Special functions
ask(string)
pose question string at the controlling tty, and return
the response
askyn(string)
like ask, but require yes/no answer; return 0=false,
1=true
askynaq(string)
like ask, but require yes/no/all/quit answer; return
0=false, 1=true, 2=all, 3=quit
yesno(s)
return -1 if $s =~ /yes|ok|y|true|1|on|t/i, 0 if $s =~ /
no|n|false|0|off|f/i, 1 otherwise
datafile(env, file)
find the specified file by looking first at the environment variable, then along the path
datapath(env, dir, file, suffix)
find the specified file by looking first at the environment variable, then along the path
makedir(d)
make the complete directory path d (like "mkdir -p")
6
Perl Datascope Interface
Scripting Reference
abspath(a)
return the absolute path to the specified file a.
relpath(d, t)
return relative path from directory f to t
cleanpath(p [, nolinks])
normalize the input path p, removing extra "..", "//",
and "./" strings. With second argument, resolve any
symbolic links along the path.
concatpaths(a,b)
concatenate the two paths a and b properly, adding a
slash if necessary.
parsepath(a)
return directory, file basename, and suffix for path a.
close_descriptors()
close all file descriptors after stderr; useful after fork
strsignal(code)
return name for signal, given the integer code
is_nfs(path)
return true if path is on an nfs-mounted filesystem.
limit(resource, [limit2set])
return the current resource limit, or set new resource
limit; possible resources are:
cputime
stacksize
filesize
datasize
coredumpsize vmemoryuse
grn(lat, lon)
return the geographic region number
grname(lat, lon)
return the geographic region name
srn(lat, lon)
return the seismic region number
srname(lat, lon)
return the seismic region name
sgsign(signer,data)
returns signature for specified signer and data
sgverify(signer,data,signature)
returns zero if signature is correct for signer and data
($out, $units) = units_convert(input,want)
returns value and units for specified input and
requested units
@list = units_match(input)
returns list of units matching input
$errno = errno()
returns system errno, resetting errno to zero
Perl Datascope Interface
7
Antelope 4.10
($result, $restriction) = legit_ip(pf,ip)
checks ip address in valid_ip_addresses list from pf,
returns 1 for legitimate ip, -1 if no parameter file, 0
if invalid ip
Simple Ring Buffers
openring(filename, id, depth, flags)
open or create new simple ring buffer in filename
with (up to) 64 byte id field, maximum depth entries.
if flags & 1 is set, open read-only, no locking; otherwise ring buffer must be on local filesystem. return
handle to ring buffer.
newring(filename, id, depth, flags)
create new simple ring buffer like openring, overwriting any old ring buffer
closering(rb)
close specified ring buffer
pushring(rb, time, value)
add time/value pair to ring (in time order)
getring(rb, i)
return the i'th time/value pair from the ring; 0 is the
most recent pair
avgring(rb, tdelta)
return the average value in the ring rb for the latest
tdelta seconds in the ring
minring(rb, tdelta)
return the min value and the corresponding index in
the ring rb for the latest tdelta seconds in the ring
maxring(rb, tdelta)
return the max value and the corresponding index in
the ring rb for the latest tdelta seconds in the ring
changedring(rb, tdelta)
returns 1 if ring buffer values have changed in past
tdelta seconds
countring(rb)
return the number of time/value pairs in the ring
findring(rb, value, tdelta)
findring searches the ring buffer rb over the specified time period tdelta for the specific value.
Time Conversion
now()
return current time to (usually) microseconds accuracy
8
Perl Datascope Interface
Scripting Reference
is_epoch_string(string)
return epoch time unless string is invalid; then
returns undef and error message.
epoch2str(epoch, fmt [, timezone])
return the epoch time formatted according to the fmt
string and converted to timezone
str2epoch(string)
return the epoch time corresponding to the freeform input time/date
strtime(epoch)
return epoch time formatted like "4/23/2001
15:35:15.000"
strydtime(epoch)
return epoch time formatted like "4/23/2001 (113)
15:35:15.000"
strdate(epoch)
convert epoch time to date, eg "4/23/2001"
strtdelta(dt)
convert the time-difference dt (in seconds) to string,
eg "30:35 minutes"
strlocaltime(epoch)
return epoch time formatted like "4/23/2001
15:35:15.000" in local timezone
strlocalydtime(epoch)
return epoch time formatted like "4/23/2001 (113)
15:35:15.000" in local timezone
strlocaldate(epoch)
convert epoch time to date, eg "4/23/2001" in local
timezone
epoch(yearday)
return the epoch time corresponding to the integer
yearday
yearday(epoch)
return the yearday corresponding to an epoch time
wait_for_time(time,verbose)
wait for specified time
State Files
exhume(filename,reference,seconds)
specify filename of state file, reference to variable to
be set when interrupted, and number of seconds to
wait for program to terminate
Perl Datascope Interface
9
Antelope 4.10
resurrect(name, ref[, TIME_RELIC])
select names and references to perl variables to save
in state file. (Optionally specify the type, may be
useful for epoch times)
bury()
Save the state file.
Foreign Keys
map between CSS3.0 station/channel naming conventions and the
different conventions of autodrm and SEED.
$sta = map_autodrm_netsta($anet, $fsta)
$chan = map_autodrm_chanaux($sta,$fchan,$aux)
($anet, $fsta) = autodrm_net($sta)
($fchan, $aux) = autodrm_aux(sta, chan)
$sta = map_seed_netsta($anet, $fsta)
$chan = map_seed_chanloc($sta,$fchan,$loc)
($snet, $fsta) = seed_net($sta)
($fchan, $loc) = seed_loc($sta,$chan)
finit_db(@db)
cause foreign key routines above to use specified
database @db
10
Perl Datascope Interface
Scripting Reference
Perl Orb Access
use orb;
% man perlorb
orbopen(name, perm)
open the specified orbserver name with permission
perm ("r", "w", "r&", or "w&"), returning the open
file descriptor orb
orbclose(orb)
close an orbserver connection
orbselect(orb, re)
select packets with sourcenames which match the
regular expression re.
orbreject(orb, re)
reject packets with sourcenames which match the
regular expression re.
orbseek(orb, which)
position the orb connection packet pointer according
to which; which may be an explicit pktid, or "ORBCURRENT", "ORBPREV", "ORBNEXT",
"ORBNEXT_WAIT", "ORBOLDEST", or "ORBNEWEST".
orbposition(orb, from)
position the orb connection packet pointer according
to from; from may be "newest", "oldest", or any
(UTC) time string recognized by str2epoch(3).
orbtell(orb)
return the current orb connection position (pktid).
orbafter(orb, time)
position the orb connection packet pointer to the first
packet after the specified time. Time must be UTC
epoch time in seconds, not string.
orbresurrect(orb, pktid, pkttime)
restore orb position from state, save to state when
bury is called
orbping(orb)
test if the specified orb responds; return version
number.
orbwait(orb, re, mintime, timeout)
wait for all reading clients of orb with program
name which matches the regular expression re to
have read packets younger than mintime. If timeout is
non-zero, then orbwait return with an error code if
the timeout expires before the specified program
catches up.
Perl Orb Access
11
Antelope 4.10
($pktid, $srcname, $pkttime, $pkt, $nbytes) = orbget(orb,
which)
get single packet corresponding to which; this can be
an explicit pktid, or "ORBCURRENT", "ORBPREV", "ORBNEXT", "ORBNEXT_WAIT",
"ORBOLDEST", or "ORBNEWEST".
($pktid, $srcname, $pkttime, $pkt, $nbytes) =
orbreap(orb)
get the next packet from the orb; this is the fastest,
most efficient way of reading packets.
($pktid, $srcname, $pkttime, $pkt, $nbytes) =
orbreap_timeout(orb, maxseconds)
get the next packet from the orb, but return early if
no packets have appeared in maxseconds. In this case,
the returned pktid will be undef.
($pkttime, $pkt, $nbytes) = orbgetstash(orb, srcname)
get stash packet corresponding to srcname
orbpkt_string(srcname, time, packet, nbytes)
return forb(5) string representation of packet
orbput(orb, srcname, pkttime, pkt, nbytes)
put the specified packet onto the orb.
orbput_nolag(orb, srcname, pkttime, pkt, nbytes,
lagparams)
put the specified packet onto the orb, ensuring that
no client matching the parameters in lagparams pf is
too far behind
orbputx(orb, srcname, pkttime, pkt, nbytes)
put the specified packet onto the orb, with return
acknowledgement
orbstashselect(orb,select)
set the stash select parameter
($name, $content, $desc) = suffix2pkttype(suffix)
return name, content and description for packet type
suffix.
orbstat(orb)
Get the standard status values from the orb; this
return an object with the following methods:
address
errors
maxpkts
nclients
orb_start
rejected
when
12
closes
host
maxsrc
nsources
pid
started
who
connections
maxdata
messages
opens
port
version
Perl Orb Access
Scripting Reference
($when, @clients) = orbclients(orb)
$when is scalar; @clients is list of client objects,
one object per client. Each object has the following
methods:
address
errors
lastpkt
nreads
nselect
perm
port
reject
thread
and
fd
lastrequest
nreject
nwrites
pid
priority
select
what
bytes
host
mymessages
nrequests
packets
pktid
read
started
who
($old,$new,$max,$range,@laggards) =
orblag(orb,match,reject)
returns oldest, newest, and pktid range, with list of
clients matching match/reject parameter. Each element of list contains client lag, thread, who and
what
orbsources(orb)
return ($when, @sources). $when is scalar;
@sources is list of source objects, one object per
source. Each object has the following methods:
active
npkts
soldest
and
nbytes
slatest
slatest_time
soldest_time srcname
showPkt(srcname, pkttime, pkt, nbytes, mode)
print out packet summary, depending on mode:
1
2
3
4
hex dump
unstuff, print all data samples
unstuff, print no data samples
just show the header information
unstuffPkt(srcname, pkttime, pkt, nbytes)
unstuffPkt unstuffs the input packet, returning
packet kind and packet object. the result code indicates what kind of packet was unpacked:
kind
---Pkt_wf
Pkt_st
Pkt_db
Pkt_pf
Pkt_cn
Pkt_rw
Pkt_ch
Pkt_tp
kind of packet
-------------waveform packet
status packet
database row
parameter file
control messages
binary data
character string
test packet
The packet object has the following methods which
return various values from the c Packet structure:
Perl Orb Access
13
Antelope 4.10
parts, time, PacketType, nchannels, channels(i), pf,
string, db, dfile, and version.
The parts method returns (net, sta, chan, loc, suffix,
subcode)
The PacketType method returns the packet kind
(also returned by unstuffPkt) and the corresponding
description.
The channels method takes an index (0..n-1) argument and returns channel object with its own methods:
calib
cuser2
iuser1
net
sta
calper
data
iuser2
nsamp
time
chan
duser1
iuser3
samprate
cuser1
duser2
loc
segtype
The data method returns all the waveform data in
list of integers.
split_srcname(srcname)
return net, sta, chan, loc, suffix, and subcode corresponding to srcname
join_srcname(net, sta, chan, loc, suffix, subcode)
return srcname for net, sta, chan, loc, suffix and subcode
14
Perl Orb Access
Scripting Reference
Perl System Information
use sysinfo ;
% man perlsysinfo
my_ip()
return ip address (eg, 207.174.76.135)
my_os()
return os name (eg, SunOS)
my_hardware()
return hardware string (eg, sun4u)
my_hostname()
return hostname (eg, ament)
ip(dot-notation)
return integer corresponding to dot-notation
ip2name(ip)
looks up hostname for ip address
name2ip(hostname)
looks up ip address for hostname
nomem(address,n)
return first bad address if no memory in range
address to address + n
%sysmem = sysmem()
return physical memory, total swap space, and swap
used
%loadavg = sysloadavg()
return nproc, avg1m, avg5m, and avg15m: number
of processes and 15, 5 and 1 minute load averages
@mounted = sysmounted()
return list of mounted partitions; each element has
mount point, filesystem type, and remote host and
directory
pidcmdline(pid)
return command line for specified pid
pidpwd(pid)
return working directory for process pid
pidexecname(pid)
return executable name for specified pid
%info = pidinfo(pid)
return usage in percent, parent pid, user id, size in
kilobytes, resident set size in kilobytes, run state,
epoch start time, total cpu time, and total children
cputime for process pid
Perl System Information
15
Antelope 4.10
$exists = pid_exists($pid)
returns 1 if $pid exists
%statvfs = statvfs(path)
return Mb_total, Mb_avail, inodes_avail,
inodes_used on disk containing path, % disk and
inodes used, and unique id
($ncpu, $idle, $user, $kernel, $iowait, $swap, @othercpus)
= syscpu()
return number of cpus, and idle, user, kernel, iowait
and swap time for each cpu.
$cwd = getcwd()
return current working directory
16
Perl System Information
Scripting Reference
Perl Trace Waveform Processing Interface
use Trace ;
% man trace
trace_findrange ( t0, dt, nsamp, [tstart [,tend]] )
find range of data samples
trace_trim ( @dbtr, [tstart [,tend]] )
trim internally flagged gap values from beginning
and end of waveform
trace_findbad ( @dbtr, [tstart [,tend]] )
return the number of internally flagged gap values
and the fraction of these samples relative to the
entire time window
trace_computestats ( @dbtr, applycalib, meanremove,
[tstart [,tend]] )
return a set of statistics (absolute maximum value,
signed max/min value, time of max value, amplitude
of max value, period of max value, mean and standard deviation) optionally applying calib to the
results and removing a mean value before the statistics are computed
Perl Trace Waveform Processing Interface
17
Antelope 4.10
Perl Station-Channel Gather
Interface
use Scg ;
% man scg
scg_create ( @db, tstart, tend, ?option, value, ...?)
create scg object
-sta => sta_exprstation name sifting expression
-chan => chan_exprchannel name sifting expression
-coord => coord_flagobtain station coordinates flag
-ir => ir_flag obtain instrument responses flag
-orient => orient_flagobtain channel orientation angles flag
scg_destroy ( handle )
free a scg object and destroy all associated resources
18
Perl Station-Channel Gather Interface
Scripting Reference
Perl History Interface
use History ;
% man history
history_create ( maxnp, ?option, value, ...?)
create history object
-filename => filenameread from history state file
-tag => tag
history_free ( {-tag => tag|handle } )
free a history object
history_add ( handle, time, value )
add a point to a history object
history_eval ( handle, time )
evaluate history object
history_get ( handle [,index] )
get number of history points and the index'th time
and value
history_get_maxmin ( handle )
get history minimum and maximum time and value
Perl History Interface
19
Antelope 4.10
Perl Vector Interface
use Vector ;
% man vector
vector_create ( ?option, value, ...?)
create vector object
-nx => nx
-ny => ny
-tag => tag
number of X independent variable values
number of Y dependent variables
vector_read ( filename, ?option, value, ...?, [ypos0 [,ypos1
[...]]])
read vector object from an ASCII file
-loff => line_offoffset in lines to data
-xpos => xpos offset in words to X values
-lpos => lpos offset in words to labels
-tag => tag
vector_read_response_fap ( filename, ?option, value,
...?)
read vector object from an Antelope instrument
response file
-tag => tag
vector_copy ( handle, ?option, value, ...?)
copy a vector object from another vector object
-tag => tag
vector_free ( {-tag => tag|handle } )
free a vector object
vector_append ( handle, index, xvalue, @yvalues [,label])
append/insert to a vector object
vector_puty ( handle, index, @yvalues [,label])
replace dependent variables and label in a vector
object
vector_eval ( handle, xvalue )
evaluate vector object dependent variables
vector_get ( handle )
get vector type, number of X values and number of
Y values
vector_get_point ( handle, index )
get vector dependent variables and label
vector_get_maxmin ( handle, iy )
get vector minimum and maximum X and Y values
vector_transform_edp ( handle, lonr, latr )
transform vector coordinates using an equal distance map projection
20
Perl Vector Interface
Scripting Reference
Perltk Bplot
use TK::Canvas
use TK::Bplot
% man bplot
$canvas->create('bpviewport', name, x, y, ?option,
value, ...?)
create canvas viewport for graph
-anchor => {n|ne|e|se|s|sw|w|nw|c}
-tags => taglist
-width =>widthwidth in pixels (0: rubber-band)
-height => height height in pixels (0: rubber-band)
-mleft => left margin
-mright => right margin
-mbottom => bottom margin
-mtop => top margin
-wtran => {none|edp|merc}coordinate system
-latr => reference latitude
-lonr => reference longitude
-xmode => {lin|log|time}
-ymode => {lin|log}
-xleft => x0 data-coordinate of left edge of plot
-xright => x1 data-coordinate of right edge of plot
-ybottom => ybottomdata-coordinate of bottom edge of plot
-ytop => ytop data-coordinate of top edge of plot
-fill => color background color for plot region
-fill_frame => colorbackground color for margins
Perltk Bplot
21
Antelope 4.10
$canvas->create('bpaxes', vpname, ?option, value, ...?)
create axes associated with vpname
-tags => taglist
-fill_labels => colorx and y labels color
-fill_numbers => colornumbers color
-fill_axes => coloraxes color
-font_labels => fontlabels font
-font_numbers => fontnumbers font
-font_numbers_superscripts => fontexponent font
-xvisible => {0|1} draw and label xaxis ticks
-yvisible => {0|1} draw and label yaxis ticks
-linewidth => width
-linewidth_small => width
-mindx => dx
-mindy => dy
-xincrement => dx
-xincrement_small => dx
-xlabel => labellabel along x axis
-xformat => {auto|none|time}tick label style
-yincrement => dy
-yincrement_small => dy
-ylabel => labellabel along y axis
-yformat => {auto|none}tick label style
-axis_style => [nesw]*draw these sides of box
-tic_style => ([nesw][ioc])* ticks inward, outward, cen-
ter
$canvas->create('bpgrid', vpname, ?option, value, ...?)
canvas item to create a mesh of grid lines
-tags => taglist
-fill => color
-fill_small => color
-linewidth => width
-linewidth_small => width
-visible => {0|1}
-visible_x => {0|1}
-visible_xsmall => {0|1}
-visible_y => {0|1}
-visible_ysmall => {0|1}
-mindx => dx
-mindy => dy
-xincrement => dx
-xincrement_small => dx
-yincrement => dy
-yincrement_small => dy
22
Perltk Bplot
Scripting Reference
$canvas->create('bptext', vpname, text, x, y, ?option,
value, ...?)
create item to draw set of points or symbols
-vector => handle|tagvector containing the points
-tags => taglist
-symbol => {point|cross|x|triangle|square|circle|dia-
mond|star}
-fill => color fill the symbols with this color
-outline => colordraw outline in this color
-linewidth => width
-textforeground => color
-font => font
-size => size
-visible => {0|1}
-showsymbols => {0|1}
-showtext => {0|1}
$canvas->create('bppolyline', vpname, ?option, value,
...?)
create item drawn with lines
-vector => handle|tagvector containing the points
-thistory => handle|tag
-tags => taglist
-fill => color if specified, fill object with color
-outline => colordraw lines in this color
-linewidth => width
-label => label
-visible => {0|1}
$canvas->create('bppolypoint', vpname, ?option, value,
...?)
canvas item to plot text in data coordinates
-tags => taglist
-fill => color
-font => font
-visible => {0|1}
-justification => {n|ne|e|se|s|sw|w|nw|c}
-angle => angle
Perltk Bplot
23
Antelope 4.10
$canvas->create('bpmap', viewportname, ?option,
value, ...?)
canvas item to plot world maps using equal distance
projection
-tags => taglist
-fill_land => color
-fill_water => color
-coasts => color:linewidth
-political => index:color:linewidth,...
-rivers => color
-visible => {0|1}
-resolution => {auto|crude|low|intermediate|high|full}
24
Perltk Bplot
Scripting Reference
Tcl Datascope and Utilities
package require Datascope
% man Datascope
Opening a Database
dbopen db {r|r+}
open database db read-only (r) or read-write(r+);
returns a db pointer
dbopen_table db[.table] {r|r+}
open datbase table. The first argument may also be
"-", allowing a view to be read from stdin. returns a
db pointer
dbopen_database db[.table] {r|r+}
open database db, or optionally a specific table. The
first argument may also be "-", allowing a view to be
read from stdin. returns a db pointer
dbclose db
close the database db
dbfree db
free memory resources and file descriptors for a
database view/table
dblookup db database table field row
return a database pointer for the specified db, database, table, field, and row. row can be "dbALL",
"dbNULL" or "dbSCRATCH", or a value corresponding to field; then the first row number where
field == value is returned
dbtruncate db n
truncate the specified table to the first n rows
Manipulating Fields and Records
dbadd db row
add the specified row to a table; return row number
dbaddnull db
add a null row to the table; return row number
dbaddv db table field value [field value ...]
add new row with specified field values; return row
number
dbmark db
set the specified row to all null values
dbcrunch db
delete marked (all null) rows from the table
Tcl Datascope and Utilities
25
Antelope 4.10
dbdelete db
delete a row
dbget db
get a table, row, or field from a table
dbgetv db table row field [field ...]
return a list with the specified values of the specified
fields
dbput db value
put the specified value into the specified location.
dbputv db table row field value [field value ...]
save the specified values into the specified fields.
Forming Views
dbgroup db type field [field ..]
group the (sorted) input table by the specified fields
dbungroup db
returns a view containing all the rows which the
grouped view references.
dbjoin db1 db2 [keys]
join the two tables (using the specified join keys)
dbjoin_tables db
returns a list of tables for which some set of join
keys with db can be inferred
dbjoin_keys db table
returns the inferred join keys between db and table
dbnojoin db1 db2 [keys]
returns view of all rows in db1 which do not join
with table db2
dbmatches db1 db2 hook [keys ...]
returns a list of rows in the table specified by db2
which match (join with) the row specified by db1
dbprocess db [command ...]
construct a view as a series of standard operations.
These include dbopen, dbjoin, dbgroup, dbleftjoin,
dbnojoin, dbselect, dbseparate, dbsever, dbsort,
dbsubset, dbtheta, dbungroup.
dbsever db table
returns a new view which removes the specified
table from the joined view db
dbseparate db table
returns a new view containing only the rows from
table which participate in the joined view db
26
Tcl Datascope and Utilities
Scripting Reference
dbsort [-r] [-u] db [fields ..]
sort a table by fields, or the primary key if no fields
are specified
-r
-u
reverse the sense of the sort
eliminate all rows in the output view with
duplicate field values
dbsubset db expression
returns a db pointer to the rows from the specified
table which satisfy expression
dbtheta db1 db2 [ expression ]
theta join the specified tables db1 and db2
dbselect [-b] [-h] [-F separator] [-t] filename db [field ...]
write selected fields from the input view to the specified filename
-b
-h
-t
strip blanks from both ends of each field
add headers
convert times to readable times
dbsave_view [-f] db name
save the specified view as a table in the same database with the specified name
-f
Allow overwriting files of the same name
db2pipe db file [row# ...]
send rows from a database view out a unix pipe
dbunjoin db output
unjoin the specified table, writing new tables into a
new database named output
Miscellaneous Datascope Functions
dbeval db expression [type]
evaluate the specified expression, converting to the
specified type
dbquery db code
query the database for various parameters
dbcompile db string
add attributes and relations to a database by directly
compiling schema file fragments
dbstrtype db string
returns type of string: strREAL, strINTEGER, strNULL, strSTRING, strTIME, strEXPR, strFIELD
or strUNKNOWN
dbfind db first backwards expression [n]
starting from first, locate the next (or nth) row in db
satisfying the given expression; search down from
first if backwards is non-zero.
Tcl Datascope and Utilities
27
Antelope 4.10
dbadd_remark db remark
add the specified remark to the specified row
dbget_remark db
get the remark associated with the specified row
dbgetr db tz i n [expr [fmt]]
return list of values for n rows beginning at row #i
for expr optionally formatted using fmt; tz=0 may be
1 to use epoch2str for times, or a timezone code (eg,
US/Mountain or LOCAL)
dbsetr db field first n expression
set the specified field in the specified table to the
value of the expression in records first to first+n.
dbinvalid
return a db pointer with all elements dbINVALID
dbnextid db name
get the next (integer) id for the specified name
Error Handling
elog_init args
initialize the elog routines with the command name
and arguments
elog_log msg
save a message on the elog message log
elog_notify msg
write a message other than an error message to the
elog facility
elog_complain msg
write an error message to the elog message facility
for immediate output
elog_die msg
write a message to the elog message facility and die
elog_clear
clear the elog message log
clear_register flag
clear the error register, optionally returning contents
elog_mark
returns the count of messages currently held in the
error log
elog_flush deliver first
get rid of messages after #first in the error log, printing them if deliver is a boolean true
28
Tcl Datascope and Utilities
Scripting Reference
Parameter Files
pfget pf name
get value for name from parameter file pf
pfgetarr variable name
return array for name (e.g. %pf#name) in variable
pfgetlist name
return list for name (e.g. @pf#name)
pfput pf name value
save the specified value into the parameter space
pfputarr pf name [array]
save the specified array into the parameter space
pfputlist pf name [list]
save the specified list into the parameter space
pfread pf
force rereading the parameter file
pfwrite pf filename
write the specified parameter file
Seismic Utility Functions
carsph x y z
convert from unit vector x y z to latitude, longitude
in degrees
dbdist lat1 lon1 lat2 lon2
return the angular distance between the specified
locations. All units are degrees.
dblatlon lat lon delta azimuth
return the latitude and longitude of the point at delta
degrees in the direction azimuth from lat, lon
peterson {low|high} frequency rsptype
return Peterson noise model values
sphcar lat lon
convert from latitude, longitude to unit vector x, y, z
read_response filename
reads a CSS3.0 instrument response file and returns
a handle
free_response resphandle
frees the resources associated with a CSS3.0 instrument response object
eval_response resphandle freq_in_hz
returns the complex value of an instrument response
object at a single frequency
Tcl Datascope and Utilities
29
Antelope 4.10
get_response resphandle {nstages | stage_types | paz
stageno}
returns various parameters from an instrument
response object
put_response resphandle stageno param_list
puts a response stage into an instrument response
object
Time Conversion
now
return current time
epoch yearday
convert yearday (eg, 1999234) to epoch time
epoch2str epoch fmt
convert epoch time to a string according to specified
fmt
str2epoch string
convert time strings from many formats to epoch
time
strtime epoch
convert epoch time to a time string like "4/23/2001
15:35:15.000"
strydtime epoch
convert epoch time to a time string like "4/23/2001
(113) 15:35:15.000"
strdate epoch
convert epoch time to a date, eg "4/23/2001"
strtdelta dt
convert the time-difference dt (in seconds) to a
string, eg "30:35 minutes"
yearday epoch
convert from epoch time to yearday
Utility Functions
makedir dir
make the directory hierarchy dir (like "mkdir -p")
writefile filename var
write value of variable var to filename
datafile envname file
returns path for file under $ANTELOPE/data
is_nfs path
returns true if path is nfs mounted
sig2str sig
returns a string describing the signal #sig
30
Tcl Datascope and Utilities
Scripting Reference
tkcolor {colorname|#rrggbb|rrggbb|hue:light:sat}
returns a legitimate tk color string
Tcl Datascope and Utilities
31
Antelope 4.10
Tcl Orb Access
package require Orb
% man tclorb
Orbserver Communications
orbopen orbname permission
open an orb connection
orbclose orb
close an orb connection for the specified orb descriptor
orbafter orb time
set the orb read pointer to the first packet after specified time
orbseek orb whence
set the orb read pointer, returning the new read-position packet id.
orbtell orb
returns the current read/write position pktid fo the
specified orb
orbping orb
returns the version number of the specified orb
orbselect orb expr
read only sources matching expr, returning the current number of matches
orbreject orb expr
don't read sources matching expr, returning the current number of matches
orbreap reap_handle
read a new orb packet from a previously started reap
thread, returning a packet handle
orbreapstart orb [block]
start reaping (reading) packets from orb, returning a
read handle.
Orbserver Status
orbstat orb [args]
returns specified status information for orb
address
errors
maxpkts
nclients
orb_start
rejected
when
32
closes
host
maxsrc
nsources
pid
started
who
connections
maxdata
messages
opens
port
version
Tcl Orb Access
Scripting Reference
orbgetdatasources orb
returns list of source names for orb
orbsources orb
returns handle for orb source status
orbsourcesfree handle
frees orbsources handle resources
orbgetnsources handle
returns the number of individual sources referenced
by the sources_handle
orbgetsource handle n [args]
returns specified source information for the n'th
source
active
nbytes
npkts
slatest
slatest_time soldest
soldest_time srcname
orbclients orb
returns handle for orb client status
orbclientsfree handle
frees orbclients handle resources
orbgetnclients handle
returns the number of clients for client handle
orbgetclient handle n [args]
returns specified client information for the n'th
source
address
fd
lastrequest
nreject
nwrites
pid
priority
select
what
bytes
host
mymessages
nrequests
packets
pktid
read
started
who
errors
lastpkt
nreads
nselect
perm
port
reject
thread
written
Packet Handling
orbpfget pf_handle name
returns the value for parameter name from the referenced pf_handle
orbpfgetstr pf_handle [name]
returns an ASCII string version of a parameter file
object
orbpffree pf_handle
frees the parameter file object referenced by
pf_handle
orbpktfree pkt
frees the orb packet referenced by the pkt
Tcl Orb Access
33
Antelope 4.10
orbpktchanfree pkt
free the specified unstuffed packet-channel
orbpktchangetcd1 packetchan_handle
returns CD1 status information for CD-1-format
packet channels
orbpktchangethdr packetchan_handle
returns packet-channel header information
orbpktunstuffdata pkt
unstuff an orb packet pkt, returning a list of packet
channels, or a database pointer, or a string, depending on the packet
orbpktgetdb pkt db
unstuff a database packet pkt, returning a database
pointer to the (scratch) record
orbpktgethdr pkt
returns {pktid time srcname nbytes} for pkt
orbpktgetlog pkt
unstuffs log packet pkt, returning the log string
orbpktgetpf pkt
unstuffs pf packet pkt, returning a pf reference
str2orbpfpkt orb name string
writes a parameter-file object defined by string as a
parameter-file packet on orb
str2orbpfpkt2 orb srcname string
writes a parameter-file object defined by string as a
parameter-file packet on orb
Quanterra Special
orbpktgetqtping pkt
returns a string with the response to a qt2orb ping
command
orbpktgetstatus pkt
returns a string with qt2orb status information
orbqtpingsend orb
sends a ping command to qt2orb via the specified
command-orb
orbqtshell qtshell_handle
handle qtshell through orb
orbqtshellfree qtshell_handle
free a quanterra shell handle
orbqtshellstart cmdorbname netsta cmd
start a quanterra shell
34
Tcl Orb Access
Scripting Reference
orbhelp
print synopsis lines for orb Tcl commands
Tcl Orb Access
35
Antelope 4.10
Tk Brttplot
package require Brttplot
% man bplot_scg
% man bplot_vector
% man bplot_thistory
% man bplot_utils
% man brttplot
create_scg db tstart tend ?options?
create a station-channel-gather data object for plotting with a viewport gpl object
-net net_expr
-sta sta_expr
-chan chan_expr
-coord coord_flag
-ir ir_flag
-orient orient_flag
destroy_scg scg_handle
destroy a station-channel-gather data object
Vectors
vector_append vector_handle index xvalue ylist [label]
appends a vector element after an existing element
vector_create [ny] [-tag tag]
create an empty generic data-vector object
vector_copy vector_handle [-tag tag]
copy a vector object
vector_eval vector_handle xvalue
compute and return a y (dependent) value from a
vector object
vector_free {-tag tag | vector_handle}
destroys previously created vector objects
vector_get vector_handle {nx|ny|xy ix}
get information relating to a vector handle
vector_maxmin vector_handle [iy]
retrieve min and max x, min and max y from a vector object
vector_puty vector_handle ix ylist [label]
replace dependent values in a vector object
36
Tk Brttplot
Scripting Reference
vector_read filename ?options?
create a vector object from an input ASCII file
-tag tag
-loff line_off
-xpos xpos
-ypos ypos1 [ypos2] [...]
-lpos lpos
vector_transform_edp vector_handle lonr latr
transform vector longitude-latitude coordinates to
equal distance projection coordinates in place
Time Histories
thistory_add thistory time value
add time/value pair to thistory object
thistory_create maxnp [-tag tag] [-file file]
create a thistory object, saving data in file
thistory_eval thistory time
return value corresponding to time for thistory object
thistory_free {-tag tag | thistory}
free thistory object, or all thistories tagged with tag
thistory_get thistory {np|ty it}
return information from a thistory object
thistory_maxmin thistory
return max and min values for thistory object
Utilities
latlon2edp latr lonr lat lon
convert latitude-longitude to equal distance projection coordinates
edp2latlon latr lonr delx dely
convert equal distance projection coordinates to latitude-longitude
getviewportwcoords viewportName x y
transform a canvas pixel coordinate, x, y, to untransformed data world coordinates through viewport
viewportName
hls2colorstring hue lightness saturation [gamma]
convert color in hue-lightness-saturation[-gamma] to
standard X-window rgb color string
Tk Brttplot
37
Antelope 4.10
Plotting
(canvas) create viewport name x y ?options?
create canvas window for graph
-margin left right bottom topmargin widths in pixels
-anchor {n|ne|e|se|s|sw|w|nw|c}
-tags taglist
-width width width in pixels (0: rubber-band)
-height height height in pixels (0: rubber-band)
-wtran {none|edp|merc}
-latr reference latitude
-lonr reference longitude
-xmode {lin|log|time}
-ymode {lin|log}
-xleft x0
data-coordinate of left edge of plot
-xright x1
data-coordinate of right edge of plot
-ybottom ybottomdata-coordinate of bottom edge of plot
-ytop ytop
data-coordinate of top edge of plot
-fill color
background color for plot region
-fill_frame colorbackground color for margins
38
Tk Brttplot
Scripting Reference
(canvas) create axes viewport ?options?
create axes associated with viewport
-tags taglist
-fill_labels colorx and y labels color
-fill_numbers colornumbers color
-fill_axes color axes color
-font_labels fontlabels font
-font_numbers fontnumbers font
-font_numbers_superscripts fontexponent font
-xvisible {0|1}
draw and label xaxis ticks
-yvisible {0|1}
draw and label yaxis ticks
-linewidth width
-linewidth_small width
-mindx dx
-mindy dy
-xincrement dx
-xincrement_small dx
-xlabel label label along x axis
-xformat {auto|none|time}tick label style
-yincrement dy
-yincrement_small dy
-ylabel label label along y axis
-yformat {auto|none}tick label style
-axis_style [nesw]*draw these sides of box
-tic_style ([nesw][ioc])* ticks inward, outward, center
(canvas) create grid viewport ?options?
canvas item to create a mesh of grid lines
-tags taglist
-fill color
-fill_small color
-linewidth width
-linewidth_small width
-visible {0|1}
-visible_x {0|1}
-visible_xsmall {0|1}
-visible_y {0|1}
-visible_ysmall {0|1}
-mindx dx
-mindy dy
-xincrement dx
-xincrement_small dx
-yincrement dy
-yincrement_small dy
Tk Brttplot
39
Scripting Reference
(canvas) create polypoint viewport ?options?
create item to draw set of points or symbols
-vector handle|tagvector containing the points
-tags taglist
-symbol {point|cross|x|triangle|square|circle|dia-
mond|star}
-fill color
fill the symbols with this color
-outline color draw outline in this color
-linewidth width
-textforeground color
-font font
-size size
-visible {0|1}
-showsymbols {0|1}
-showtext {0|1}
(canvas) create polyline viewport ?options?
create item drawn with lines
-vector handle|tagvector containing the points
-thistory handle|tag
-tags taglist
-fill color
if specified, fill object with color
-outline color draw lines in this color
-linewidth width
-label label
-visible {0|1}
(canvas) create ptext viewport textstring x y ?options?
canvas item to plot text in data coordinates
-tags taglist
-fill color
-font font
-visible {0|1}
-justification {n|ne|e|se|s|sw|w|nw|c}
-angle angle
(canvas) create map viewport ?options?
canvas item to plot world maps using equal distance
projection
-tags taglist
-fill_land color
-fill_water color
-coasts color:linewidth
-political index:color:linewidth,...
-rivers color
-visible {0|1}
-resolution {auto|crude|low|intermediate|high|full}
Tk Brttplot
40
Scripting Reference
Tk Gpl
package require Tkgpl
% man tkgpl
tkgpl pathName widgetNamespace dbpick dbname
creates a new gatherplot trace display tk widget in
the style of dbpick(1)
-pf pfname
-sc sta:chan
-ts_sift tstart_sift
-te_sift tend_sift
-ts tstart_display
-tw twin_display
-gaps {segment|zero|interp|none}
-maxchannels maximum_channels_in_display
-comout comfile
-geom WxH+X+Y
-stam {css|seed}
-trcrm {both|time|none}
-ampm {auto|auto0|auto1|autoa}
-bg tracewin_background_color
-fg tracewin_foreground_color
-cr tracecursor_foreground_color
-fgcss sta_css_label_foreground_color
-fgseed sta_seed_label_foreground_color
-fgfil filter_label_foreground_color
-bga arrival_background_color
-fga arrival_foreground_color
-bgsa selected_arrival_background_color
-fgsa selected_arrival_foreground_color
-timefm time_format_string
-datefm date_format_string
-phase_default default_phase_code
-switchbuttons
-noedit
-nosort
-noshowwfs
-noshowarrs
-noshowpreds
-cliptraces
-counts
-palign
-v
(tkgpl) bind {arrivals2|arrivals3} menuPathname
binds mouse button events in arrival flags to popup
menus
Tk Gpl
41
Scripting Reference
gplcolor colorname
returns a legitimate tk color string
Tk Gpl
42
Scripting Reference
Tk Pixmap
package require Pixmap
pixmap create giffile
creates a new pixmap object from a gif file image
pixmap pixmap_handle width
returns the width of a pixmap object
pixmap pixmap_handle height
returns the height of a pixmap object
pixmap pixmap_handle ncolors
returns the number colors in a pixmap object
(canvas) create pixmap ?options?
creates a new canvas item pixmap image from a pixmap object
-pixmap pixmap_handle
-anchor anchor
-tags tags
Tk Pixmap
43
Scripting Reference
Tk Vogle
package require Vogle
% man tkvogle
Device Related Commands
graphic widget-name
create graphic widget for drawing
g_init deviceName
(re)-initialize the Vogle device deviceName. For
example, to initialize the Vogle postscript device.
See also: g_newdev, g_getdev, g_exit, g_output,
graphic
g_exit deviceName
Reset the current Vogle graphics device.
g_output fileName
direct output to fileName instead of stdout (for postscript)
g_newdev deviceName
re-intialize Vogle to use a new device without
changing the current viewport attributes.
g_getdev
g_getdev returns the name of the current Vogle
graphics device.
g_getdepth
g_getdepth returns the number of bit planes for
the current device.
General Commands
g_clear
Flood the device with the current color. Clipping
areas, viewports, etc. are ignored.
g_color colorName
Set the current color.
black
0
red
1
green
2
yellow
3
blue
4
magenta
5
cyan
6
white
7
g_clipping boolean
If boolean is true turn clipping on. If it is false turn
clipping off.
Tk Vogle
44
Scripting Reference
Viewport Commands
g_viewport left right bottom top
set the current viewport using screen coordinates.
g_pushviewport
push the current viewport onto the stack.
g_popviewport
pop the topmost element from the viewport stack
g_getviewport
returns the current viewport {left right bottom top}.
g_getaspect
returns the aspect ratio for the current device. (ratio
of width to height)
g_getfactors [ width [ height ]]
returns the width and height factor of the current
device.
widthfactor = (widthOfDevice / min(widthOfDevice, heightOfDevice))
heightfactor = (heightOfDevice / min(widthOfDevice, heightOfDevice))
Attribute Stack Commands
g_pushattributes
places a copy of the current attributeList (color, fillstyle, hatchstyle, textCentering, textKerning,
textHeight, textWidth, and textFont) on the top of
the attribute stack.
g_popattributes
restores attributes from attribute stack
Projection Commands
g_ortho left right top bottom [ near [ far ]]
Define a parallel projection, 3d if near and far are
supplied, 2d otherwise
g_perspective fieldOfView aspect near far
Specify a perspective viewing pyramid in world
coordinates
g_window left right top bottom near far
Specify a perspective viewing pyramid in world
coordinates
Matrix Stack Commands
g_pushmatrix
push the current transform matrix on the the stack
Tk Vogle
45
Scripting Reference
g_popmatrix
restore the transformation matrix from the stack
Viewpoint Commands
g_polarview distance azimuth increment twist
specify the viewers position in polar coordinates
g_up
ensure the Y axis is pointing up
g_lookat viewX viewY viewZ posX posY posZ twist
specify the viewer position
g_move x y [ z ]
move to point x,y,z
g_rmove x y [ z ]
moves a displacement x, y, z from current position
g_smove x y
moves to point x,y using screen coordinates
g_rsmove x y
moves a displacement x,y in screen coordinates
Drawing Commands
g_draw x y [ z ]
draw to x, y, z
g_rdraw x y [ z ]
draw to current position + x, y, z
g_sdraw x y
draw to x, y in screen coordinates
g_rsdraw x y
draw to current position + x, y in screen coordinates
Arcs and Circles
g_circleprecision numberOfSegments
specify number of line segments to use to draw a
circle
g_arc x y radius startAngle endAngle
draw an arc with center x, y from startAngle to endAngle
g_sector x y radius startAngle endAngle
draw a sector with center x, y from startAngle to
endAngle
g_circle x y radius
draw a radius circle with center x, y
Tk Vogle
46
Scripting Reference
Rectangle and Polygon Commands
g_rect x y x2 y2
draw a rectangle with corners x y and x2 y2
g_polyfill flag
turn polygon filling on or off
g_polyhatch flag
turn on/off polygon hatching
g_hatchangle angle
set the angle for the hatch lines
g_hatchpitch angle
set the pitch for the hatch lines
g_poly x y z...xN yN zN
construct a 3 dimensional polygon
g_poly2 x y...xN yN
construct a 2 dimensional polygon
g_makepoly
starts construction of a polygon constructed with
g_move, g_draw
g_closepoly
completes construction of a polygon started by
g_makepoly
g_backface flag
turn on/off culling of backface polygons
g_backfaceclockwise flag
if flag is true, direction of backfacing is set to clockwise; otherwise the direction is counterclockwise
Text Commands
g_font fontName
The following software fonts are supported:
astrology
futura.l
gothic.ger
japanese
math.upp
script
times.i
cursive
futura.m
gothic.ita
markers
meteorology
symbolic
times.ib
cyrillic
gothic.eng
greek
math.low
music
times.g
times.r
g_numchars
Return the number of characters in the current font
g_textsize width height
set the maximum size of a character in the current
font in world units
g_textangle angle
set the text angle
Tk Vogle
47
Scripting Reference
g_fixedwidth flag
turns fixedwidth text on or off
g_centertext flag
if true, text is drawn centered on the current graphics position, otherwise left justified
g_getcharsize char [ wVar [ hVar ]]
get the width and height of character char
g_fontsize [ wVar [ hVar ]]
get the maximum width and height of a character in
the current font
g_drawstr string
draw the text in string at the current position
g_strlength string
return the length of string in world units
g_boxtext x y w h string
draw string to fit in the box with bottom left hand
corner at x, y, width w, and height h
g_boxfit w h numberOfChars
set scale for text so that a string of characters in the
font fit in box of width w, height h
Transformation Commands
g_identtrans
resets the current transform to the identity matrix.
(screen units and world units become equivalent)
g_translate x y [ z ]
alter the current transform so points are moved distance x,y,z
g_scale xScale yScale [ zScale ]
scale the current transform by xScale, yScale, zScale
g_rotate angle axis
rotate the current transform angle degrees around
axis: x, y, or z
Point Commands
g_point x y [ z ]
draw a point at x y z in world units
Object Commands
g_makeobj objectID
begin construction of an object with identifier objectID
Tk Vogle
48
Scripting Reference
g_closeobj
close the object begun with the g_makeobj command
g_genobj
return a unique objectID identifier
g_getopenobj
return identifier for the object currently under construction
g_loadobj objectID fileName
load the object in fileName into objectID
g_saveobj objectID fileName
save the object objectID into fileName
Double Buffering
g_backbuffer
draw in the offscreen buffer
g_frontbuffer
draw in the onscreen buffer
g_swapbuffers
copy the offscreen buffer to the onscreen buffer
Other Commands
g_getgp [ x [ y [ z ]]]
return current position in world coordinates, optionally saving in x, y, z
g_toscreen xArg yArg [ xVar [ yVar ]]
returns current screen coordinates for device coords
xArg, yArg
g_toworld xArg yArg [ xvar yvar ]
return the current world coordinates for device coordinates xArg yArg
Tk Vogle
49
Scripting Reference
Tcl/Tk Extensions
% man tcl_packages
atcl
Tcl shell
awish
Tk shell
package require XXX
Tclx
Tkx
extended tcl/tk -- variety of extensions to unix functions
BLT
primarily 2d graphics
Itcl
object oriented extensions
Itk
object oriented widget extensions
Iwidgets
extended widgets
Brttplot
extensions for drawing graphs on a tk canvas.
Datascope
Datascope database extensions
Dbe
extensions for implementing dbe
Orb
extensions for reading and writing to an orbserver
Pixmap
extension for pixmaps (used in dbevents)
Rtd
extension for real time trace display
Rtm
extensions for implementing rtm
Ttgrid
extensions for the time travel grid file used by orbassoc and dbgrassoc
Vogle
3-d graphics extension for "Very Ordinary Graphics
Library"
Tcl/Tk Extensions
50
Scripting Reference
Datascope PHP Interface
dl( 'Datascope.so' );
% man datascope_php
Opening a Database
ds_dbopen(database, permissions)
returns a database pointer to the database
ds_dbopen_database(database, permissions)
returns a database pointer to the database or table
ds_dbopen_database(database, permissions)
returns a database pointer to the specified table ("-"
for stdin)
dblookup($db, database, table, field, row)
returns a database pointer for the specified database,
table, field, and row.
ds_dbtmp($schema)
return a database pointer to a temporary database of
the specified schema
ds_dbcreate($filename [, $schema [, $dbpath [, $description [, $detail]]]])
create a database descriptor in the specified filename
ds_dbclose($db)
close a database
dbfree($db)
free memory for a database view
dbdestroy($db)
destroy all tables of a database
dbtruncate($db, $nrecords)
truncate a database table to the specified length
dbdelete($db)
delete rows from a database
dbmark($db)
mark rows for deletion
dbcrunch($db)
remove marked (null) rows from a database table
Manipulating Fields and Records
dbaddv($db, field_name, value, [field_name, value, ...])
add a new row with the specified values to the database
dbaddnull($db)
add a new null row to the database.
Datascope PHP Interface
51
Scripting Reference
dbadd($db [, $record])
add a new row to the database from the scratch
record or from the specified string.
dbputv($db, field_name, value, [field_name, value, ...])
change the fields for an existing row to the specified
values
dbput($db [, string])
put a raw field or an entire record into database from
the scratch record [or the specified string]
dbgetv($db, field_name [, field_name, ...])
returns the values of the specified fields for a particular rows
dbget($db [, 0])
get a raw field or an entire record database from the
[or load it into the scratch record]
dbadd_remark($db, remark)
add comment in remark table for the specified row
dbget_remark($db)
get any comment from remark table for the specified
row
db2xml($db [, string flags [, string rootnode [, string rownode [, array fields [, array expressions]]]]])
returns an XML structure corresponding to a view
Forming Views
dbprocess($db, commands)
returns a new view which is the result of applying
the dbprocess commands to the input view; possible
operations are: dbopen, dbjoin, dbgroup, dbleftjoin,
dbnojoin, dbselect, dbseparate, dbsever, dbsort,
dbsubset, dbtheta, dbungroup
dbsort($db [, -u][, -r][, key, key, ...])
sort a view by the specified fields
dbgroup($db, key [, key, ...])
group the input view according to the specified keys
dbungroup($db)
separate a grouped view into its component rows
dbsubset($db, expression)
returns a new view which is the set of all rows
which satisfy the expression
dbbase($db, tablename)
returns the row of the specified base table corresponding to the row in the input view
Datascope PHP Interface
52
Scripting Reference
dblist2subset($db [, list])
returns a new view with the listed records, or with
the range indicated by the input grouped bundle if
no list is specified
dbget_range($db)
returns the index of the first, and one plus the index
of the last element in a range of rows represented by
a database pointer
dbseparate($db, table)
returns a view containing records from the specified
table that are in the input view
dbsever($db, table)
return a view that omits the specified table
dbjoin($db1, $db2, ['-outer'], [join-keys])
create a new view from the input views, using join
keys if specified
dbtheta($db1, $db2, [expression])
create a new view with all combinations of rows,
matching expression if specified
dbnojoin($db1, $db2, [join-keys])
return view with all rows in db1 which don't join to
db2
dbunjoin($db, database)
create a new database from the records of the input
view
dbwrite_view($db, $filename)
save a database view to a file
dbread_view($filename [, $viewname])
read a database view from the given filename
dbsave_view($db)
save a database view as part of the database
Handling Waveform Data
trloadchan($db, t0, t1, sta, chan)
load a channel of waveform data into a Datascope
trace object
trsample($db, t0, t1, sta, chan [, apply_calib])
load a channel of waveform data into a PHP array of
alternating epoch-time and data-value
trsamplebins($db, t0, t1, sta, chan, binsize [, apply_calib])
same as trsample, but the data points are grouped
into bins of binsize samples and the epochtime,min,max for each group is returned
Datascope PHP Interface
53
Scripting Reference
trapply_calib($tr)
multiply waveform data in trace object by calib
value
trextract_data($tr)
extract waveform data into a PHP array
trdata($tr [, i0 [, npts]])
extract waveform data into a PHP array, specifying
the starting index $i0 and maximum number of
points to return if desired
trdatabins($tr, binsize [, i0 [, npts]])
same as trdata, but the data points are grouped into
bins of binsize samples and the min, max for each
group is returned
trsplit($tr)
break up waveform records at marked bad data
trsplice($tr)
splice together data segments
trfilter($tr, filter)
filter data in-place according to the given filterdescription string
trfree($tr)
free a Datascope trace-object structure
trdestroy($tr)
destroy a Datascope trace-object structure
trtime2samp(double time0, double samprate, double
time1)
find the index of a sample given its timestamp
trsamp2time(double time0, double samprate, int isamp)
find the timestamp of a sample given its index
trsamprate(double time0, int nsamp, double endtime)
find the sample rate of a time-series given its other
attributes
trnsamp(double time0, double samprate, double endtime)
find the number of samples in a time-series given its
other attributes
trendtime(double time0, double samprate, int nsamp)
find the end-time of a time-series given its other
attributes
Error Handling
elog_init(argc, argv)
Initialize the elog message routines
elog_log(msg)
save message on the elog message log
Datascope PHP Interface
54
Scripting Reference
elog_debug(msg)
send a debug message to the elog facility
elog_notify(msg)
send a notification message to the elog facility
elog_alert(msg)
send an alert message to the elog facility
elog_complain(msg)
send a complaint to the elog facility
elog_die(msg)
send a fatal message to the elog facility and exit
elog_string(n)
return error log starting with message n
elog_clear()
clear the elog message log
elog_mark()
return the count of messages currently held in the
error log
elog_flush(deliver, first)
eliminate log messages after first, printing them if
deliver is set
elog_callback(replacement)
replace the standard elog processing with the named
PHP replacement function (this function takes two
arguments, an integer severity code and a string containing the log messages, and returns an integer
which, if nonzero, will cause the log to be cleared)
Miscellaneous Datascope Functions
dbquery($db, code)
query the database for information, e.g.
dbquery($db, "dbRECORD_COUNT"). see Datascope Constants for valid query codes.
dbnrecs($db)
query the database for number of records in a table
or view (same as dbquery for
dbRECORD_COUNT)
dbex_eval($db, expression)
evaluate expression for a particular row
dbcompile($db, string)
dynamically add new attributes or relations to the
schema
dbnextid($db, id_name)
get the next free id value for the specified id_name
Datascope PHP Interface
55
Scripting Reference
dbinvalid()
return a database pointer of dbINVALID
dbstrtype($db, string)
classifies string, returning "strREAL", "strINTEGER", "strNULL", "strSTRING", "strTIME", "strFIELD", or "strUNKNOWN"
dbextfile($db [, base-table])
return the filename for an external file for a particular row in a view
dbfind($db, expression, [, first [, reverse]])
find a record matching an expression
dbmatches($dbk, $dbt, $hookname [, join-keys])
return row numbers of records in $dbt that match the
single row $dbk
Parameter Files
pfget(pfname, key)
return the value for the key from the parameter file
pfname
pfget_boolean(pfname, key)
return 0 or 1 depending on the value of key in the
parameter file pfname
pfupdate(pfname)
reread a parameter file if necessary
pffiles(pfname [, all])
List the files which make up a parameter file object.
If all is specified and nonzero, list all possible filenames, including non-existent files.
pf2string(pfname)
return a string representation of a parameter file
object
pfrequire(pfname, atime)
require pf_revision_time from last file pfname to be
later than atime
pfcompile(string, pfname)
convert the specified string into a parameter file
object
pfput(key, value, pfname)
insert key/value pairs into a parameter file object
pfdel(pfname, key)
remove the specified parameter from a parameter
file object, returning the value
pfwrite(filename, pfname)
write a parameter file object to the specified file
Datascope PHP Interface
56
Scripting Reference
pf2xml(pfname [, flags [, prolog [, name]]])
convert a parameter file to xml
Time Conversion
strtdelta(dt)
convert the time-difference dt (in seconds) to a
string, eg "30:35 minutes"
strtime(epoch)
convert an epoch time to a string date and time
strydtime(epoch)
convert an epoch time to a string date and time
including julian day
strdate(epoch)
convert an epoch time to a string date
strlocaltime(epoch)
convert an epoch time to a string date and time in
local timezone
strlocalydtime(epoch)
convert an epoch time to a string date and time
including julian day, in local timezone
strlocaldate(epoch)
convert an epoch time to a string date in local timezone
now()
return epoch time according to local system clock
is_epoch_string(timestring)
return an epoch time equivalent of a valid timestring,
or an empty result if translation fails
epoch2str(epoch, format [, timezone])
return a string equivalent of an epoch time, optionally converting to the specified timezone
str2epoch(timestring)
return the Unix epoch-time equivalent of a time
string
epoch(yearday)
return the Unix epoch-time equivalent of an integer
julian day
yearday(epoch)
return the integer julian-day corresponding to the
given epoch time
Datascope PHP Interface
57
Scripting Reference
Instrument Response Routines
dbresponse(filename)
return a PHP resource representing the response
curve in $filename
eval_response($response, omega)
return a two-element array of the real and imaginary
response at $omega
Special Functions
yesno(s)
return -1 for yes,ok,true,1,y,on,t; 0 for
no,n,false,0,off,f; 1 otherwise
makedir(d)
make the complete directory path
make_pathdirs(f)
make the complete directory path assuming the last
element is a filename
datafile(env, file)
find the specified file by looking first at the environment variable, then along the path
datapath(env, dir, file, suffix)
find the specified file by looking first at the environment variable, then along the path
abspath(a)
return the absolute path to the specified file
relpath(from,to)
return the path to the file 'to' relative to the directory
'from'
cleanpath(p [, nolinks])
return the path resolving any relative elements, and
symbolic links if requested
concatpaths(a, b)
properly concatenate two path elements
parsepath(a)
split a pathname into directory, filename base, and
suffix (if present)
grn(lat, lon)
return geographic region number based on location
grname(lat, lon)
return geographic region name based on location
srn(lat, lon)
return seismic region number based on location
Datascope PHP Interface
58
Scripting Reference
srname(lat, lon)
return seismic region name based on location
Foreign Keys
map between CSS3.0 station/channel naming conventions and the different conventions of autodrm and SEED.
sta = map_autodrm_netsta(anet, fsta)
chan = map_autodrm_chanaux(sta, fchan, aux)
(anet, fsta) = autodrm_net(sta)
(fchan, aux) = autodrm_aux(sta, chan)
sta = map_seed_netsta(snet, fsta)
chan = map_seed_chanloc(sta, fchan, loc)
(snet, fsta) = seed_net(sta)
(fchan, loc) = seed_loc(sta, chan)
finit_db($db)
cause foreign key routines above to use specified
database $db
Datascope PHP Interface
59
Scripting Reference
Orb PHP Interface
dl( 'Orb.so' );
% man orb_php
orbopen(name, perm)
open an orbserver connection
orbclose(orbfd)
close an orbserver connection
orbping(orbfd)
return the version number of the orbserver
orbtell(orbfd)
return the pktid of the orbserver's current position
orbposition(orbfd, from)
return the pktid after repositioning the orb to the
position specified by the 'from' string ('newest', 'oldest', or any str2epoch(3) time string)
orbseek(orbfd, which)
return the pktid after repositioning the orb to the
specified packet (given either as a packet-id or as
one of ORBCURRENT, ORBPREV, ORBNEXT,
ORBNEXT_WAIT, ORBOLDEST, ORBNEWEST)
orbwait(orbfd, re, mintime, timeout)
wait for clients matching the specified regular
expression all to have read packets younger than
mintime, optionally limited by a timeout. Returns 0 if
no wait is necessary, positive if a wait was necessary, and negative if an error occurred (including
expiration of timeout)
orbafter(orbfd, time)
return the pktid after repositioning the orb to the
next packet after the specified time. The time must be
in epoch seconds
orbselect(orbfd, regex)
subset the source-names for those matching regex
orbreject(orbfd, regex)
reject the source-names matching regex
(pktid, srcname, time, packet, nbytes) = orbreap(orbfd)
get the next packet from the orb
(pktid, srcname, time, packet, nbytes) =
orbreap_nd(orbfd)
get the next packet from the orb, returning if none is
available
Orb PHP Interface
60
Scripting Reference
(pktid, srcname, time, packet, nbytes) =
orbreap_timeout(orbfd, maxseconds)
get the next packet from the orb, returning if timeout
is exceeded
(pktid, srcname, time, packet, nbytes) = orbget(orbfd,
which)
get a single packet from the orb, specified as in orbseek
orbput(orbfd, srcname, time, packet, nbytes)
put a single packet on the orb
pktid = orbputx(orbfd, srcname, time, packet, nbytes)
put a single packet on the orb and return the packetid
pktstring = orbpkt_string(srcname, time, packet, nbytes)
return an forb(5) representation of an orb packet
(result, pkt) = unstuffPkt(srcname, time, packet, nbytes)
unstuff a single packet, returning a result code and a
packet object
kind
---Pkt_wf
Pkt_st
Pkt_db
Pkt_pf
Pkt_cn
Pkt_rw
Pkt_ch
Pkt_tp
kind of packet
-------------waveform packet
status packet
database row
parameter file
control messages
binary data
character string
test packet
The packet object has the following methods which
return various values from the c Packet structure:
parts, time, PacketType, nchannels, channels(i), pf,
string, db, dfile, and version.
The parts method returns (net, sta, chan, loc, suffix,
subcode)
The PacketType method returns the packet kind (also
returned by unstuffPkt) and the corresponding
description.
The channels method takes an index (0..n-1) argument and returns channel object with its own methods:
calib
cuser2
iuser1
net
sta
calper
data
iuser2
nsamp
time
chan
duser1
iuser3
samprate
cuser1
duser2
loc
segtype
The data method returns all the waveform data in a
list of integers.
Orb PHP Interface
61
Scripting Reference
orbstat(orb)
Get the standard status values from the orb; this
return an object with the following methods:
address
errors
maxpkts
nclients
orb_start
rejected
when
closes
host
maxsrc
nsources
pid
started
who
connections
maxdata
messages
opens
port
version
(when, sources ) = orbsources(orb)
return the query time and a list of source objects,
one object per source. Each object has the following
methods:
active
npkts
soldest
nbytes
slatest
slatest_time
soldest_time srcname
(when, clients) = orbclients(orb)
return the query time and a list of client objects, one
object per client. Each object has the following
methods:
address
errors
lastpkt
nreads
nselect
perm.
port
reject
thread
bytes
fd
lastrequest
nreject
nwrites
pid
priority
select
what
host
mymessages
nrequests
packets
pktid
read
started
who
pforbstat(orbfd, flags)
create a nested PHP array containing orb metadata
split_srcname(srcname)
split an orb source-name into net,sta,chan,loc,suffix,subcode
join_srcname(net, sta, chan, loc, suffix, subcode)
return an orb source-name created from the component pieces provided
(name, content, desc ) = suffix2pkttype(suffix)
return name, content type and description for a
given packet-type suffix
Orb PHP Interface
62
Scripting Reference
PHP System Information
dl( 'sysinfo.so' );
% man sysinfo_php
my_ip()
return ip address (eg, 209.193.47.96)
my_os()
return os name (eg, SunOS)
my_hardware()
return hardware string (eg, sun4u)
my_hostname()
return hostname (eg, yukon)
ip2name(ipaddress)
translate a dot-notation IP address to hostname
name2ip(hostname)
translate a hostname to dot-notation IP address
ip(ipaddress)
translate a dot-notation IP address to equivalent
plain-integer address
pidexecname(pid)
return the executable name for a process-id
pidcmdline(pid)
return the command line for a process-id
pidpwd(pid)
return the process working directory for a process-id
pid_exists(pid)
return true if the given process-id is running
pidinfo(pid)
return an associative array of statistics for a processid
nomem(address, nbytes)
test a memory address for validity, returning the first
bad address if the location is invalid, zero otherwise
sysloadavg()
return 1, 5, and 15-minute system load-averages and
number of processes
sysmem()
return an associative array with total, used, and
physical memory in MB
sysmounted()
return mount-point, file-system type, remote host,
and remote source for all mounted filesystems
PHP System Information
63
Scripting Reference
syscpu()
return the number of cpus, then percent of time
spent in idle, user, kernel, iowait, and swap for the
first cpu, then for successive cpu's if present
statvfs(path)
return an associative array with filesystem information about a path
PHP System Information
64
Scripting Reference
Matlab Interface
Getting Help
doc antelope
launch web-browser with html documentation
helpwin antelope
launch Matlab help tool
help antelope
standard Matlab help
help antelope/examples
list of example scripts using Antelope toolbox
doc COMMAND_NAME
web-browser help on specified command
helpwin COMMAND_NAME
Matlab help-tool help on specified command
help COMMAND_NAME
standard Matlab help for specified command
Initialization
setup_antelope
Set the Matlab path to point to the Antelope tools,
examples, and scripts
Opening a Database
DBPTR = dbopen(FILENAME, OPENTYPE)
open a Datascope Database
DBPTR = dblookup(DBPTR, DATABASE, TABLE,
FIELD, RECORD)
aim a Datascope database pointer as specified
DBPTR = dblookup_table(DBPTR, TABLE)
aim a Datascope database pointer at a specified table
dbclose(DBPTR)
close a Datascope database
Manipulating Fields and Fecords
S = db2struct(DBPTR [, FIELD [, FIELD, ... ]])
convert a database view to a Matlab structure array
RECORD_NUMBER = dbadd(DBPTR, RECORD)
add a record to a Datascope database
RECORD_NUMBER = dbaddnull(DBPTR)
add a null record to a Datascope database
dbaddv(DBPTR, FIELD, VALUE [, FIELD, VALUE ... ])
add values to a Datascope database
Matlab Interface
65
Scripting Reference
dbcrunch(DBPTR)
crunch out null rows in a Datascope database table
dbdelete(DBPTR)
delete the specified record in a Datascope database
RECORD = dbget(DBPTR [, 'dbSCRATCH'])
get a table, record, or field from a database
[VALUE, VALUE, ...] = dbgetv(DBPTR, FIELD [, FIELD,
...])
get the specified values from a Datascope database
DBPTR = dbinvalid()
create an invalid database pointer
dbmark(DBPTR)
set the specified Datascope database rows to null
dbput(DBPTR, VALUE)
put the specified value into a Datascope database
dbputv(DBPTR, FIELD, VALUE [, FIELD, VALUE ... ])
put the specified values into a Datascope database
Forming Views
dbfree(DBPTR)
Free resources used by a Datascope database view
DBPTR = dbjoin(DBPTR1, DBPTR2 [, PATTERN1 [,
PATTERN2]] [, 'outer'])
join the specified Datascope database tables
DBPTR = dbnojoin(DBPTR1, DBPTR2 [, PATTERN1 [,
PATTERN2]])
find records in DBPTR1 which do not join with
DBPTR2
DBPTR = dbprocess(DBPTR, STATEMENT_LIST)
construct a view as a series of standard operations
DBPTR = dbgroup(DBPTR, GROUPFIELDS, [TYPE])
group a sorted table by the specified fields
DBPTR = dbungroup(DBPTR)
ungroup a grouped database view into its component records
DBPTR = dbsort(DBPTR [, FIELD, FIELD,...])
sort the specified Datascope database table
DBPTR = dbsubset(DBPTR, EXPRESSION)
subset a Datascope database table
DBPTR = dblist2subset(DBPTR [, LIST])
create a new subset view given a list of record numbers
Matlab Interface
66
Scripting Reference
DBPTR = dbtheta(DBPTR1, DBPTR2 [, EXPRESSION] [,
'outer'])
theta-join two Datascope database tables
dbunjoin(DBPTR, OUTPUT)
unjoin the specified Datascope database view
dbsever(DBPTR, TABLE)
remove a table from a joined view
dbseparate(DBPTR, TABLE)
extract a subset view of a base table from a joined
view
DBPTR = dbread_view(FILENAME [, VIEWNAME])
read a Datascope database view from a file
dbsave_view(DBPTR)
save a datascope database view in the main database
dbwrite_view(DBPTR, FILENAME)
write a datascope database view to the specified file
Getting Information About the Database
DBPTR = dbjoin_keys(DBPTR1, DBPTR2
**or**DBPTR, TABLE1, TABLE2)
show the inferred join keys between two database
tables
QUERY_RESULT = dbquery(DBPTR, CODE)
query a Datascope database for various parameters
NRECS = dbnrecs(DBPTR)
get the number of records in a Datascope table or
view
Evaluating Expressions
RESULT = dbeval(DBPTR, EXPRESSION [, TYPE])
evaluate an expression on a Datascope database
Handling Waveform Data
ENDTIME = tr_endtime(TIME, SAMPRATE, NSAMP)
calculate endtime from time, sample rate, and number of samples
N = tr_nsamp(TIME, SAMPRATE, ENDTIME)
calculate number of samples from time, sample rate,
and endtime
TIME1 = tr_samp2time(TIME0, SAMPRATE,
N_INDEXED_BY_1)
calculate sample time from sample index
Matlab Interface
67
Scripting Reference
SAMPRATE = tr_samprate(TIME, NSAMP, ENDTIME)
calculate sample rate from time, endtime, and number of samples
N_INDEXED_BY_1 = tr_time2samp(TIME0, SAMPRATE, TIME1)
calculate sample index from sample time
trapply_calib(TRPTR)
multiply trace-object waveform data by calib value
trdestroy(TRPTR)
free trace object and its associated memory
DATA = trextract_data(TRPTR)
read a copy of data from a trace object into a matrix
trfilter(TRPTR, FILTER_STRING)
apply time-domain filters to trace data
trfree(TRPTR)
free memory for part of a trace object
[DATA, NSAMP, T0, T1] = trgetwf(DBPTR [, REQS,
REQE])
read trace data from database into matrix
trinsert_data(TRPTR, DATA)
put data from a Matlab matrix into a trace-object
TRPTR = trload_css(DBPTR, TIME, ENDTIME [,
TRPTR] [, TABLE])
load waveform data from CSS database into trace
object
TRPTR = trload_cssgrp(DBPTR, TIME, ENDTIME [,
TRPTR] [, TABLE])
load waveform data from grouped CSS database
into trace object
TRPTR = trnew()
create a new trace-object
trputwf(DBPTR, DATA)
save waveform data into a file
trrotate(TRPTR, PHI, THETA, NEWCHANS)
three-component rotation of trace object
trrotate_to_standard(TRPTR, NEWCHANS)
rotate three-component trace data to standard coordinates
trsave_wf(TRPTR, DBPTR, DATATYPE, WFNAME [,
'overwrite' | 'append'])
save trace-object waveform data to a new database
trsplice(TRPTR, TOLERANCE)
splice together data segments
Matlab Interface
68
Scripting Reference
trwfname(DB [, PATTERN])
generate external file names
S = tr2struct(TR)
Generate an exportable structure of waveform data
Error Handling
clear_register([ 'print' ])
clear the Datascope error register
elog_init([ARGV0])
initialize the error-logging facility
elog_log(MSG)
save a message on the elog message log
elog_alert(MSG)
elog_complain(MSG)
elog_debug(MSG)
elog_notify(MSG)
send alert, complain, debug, notify message to the
elog facility
elog_die(MSG)
send message to the elog facility and kill the Matlab
interpreter
elog_clear()
clear the elog message log
elog_flush(DELIVER, FIRST)
eliminate log messages after the FIRST, printing
them if DELIVER is set
elog_mark()
return the count of messages currently held in the
error log
elog_string(N)
return error log starting with message N
Instrument Response Routines
R = dbresponse(FILE)
dbresponse class constructor
RESPONSE = eval_response(DBRESPONSE, OMEGA)
dbresponse evaluation routine
RESPONSE_PARTS = parse_response(DBRESPONSE)
return internal contents of a response object
DIFFERENT = compare_response(DBRESPONSE1,
DBRESPONSE2)
dbresponse comarison routine
Matlab Interface
69
Scripting Reference
clear(DBRESPONSE)
dbresponse elimination routine
free_response(DBRESPONSE)
dbresponse elimination routine
Computational-geometry Grids
CGG = cggrid(FILE)
CGG = cggrid(X, Y, Z)
cggrid (Computational-geometry grid) class constructor
DX = cggrid_dx(CGG)
x-spacing for cggrid object
DY = cggrid_dy(CGG)
y-spacing for cggrid object
NX = cggrid_nx(CGG)
number of points in x-direction for cggrid object
NY = cggrid_ny(CGG)
number of points in y-direction for cggrid object
[TRIPLETS, NX, NY] = cggrid_get(CGG)
get ordered triplets representing cggrid object
[X, Y, Z] = cggrid_getmesh(CGG)
get X,Y,Z coordinate meshes representing cggrid
object
VAL = cggrid_probe(CGG, X, Y)
probe the cggrid for the value at a given point
cggrid_write(CGG, FORMAT, FILE)
write a cggrid object to a file
cggrid2db(CGG, DBPTR, RECIPE_NAME, GRID_NAME,
OUTPUT_FILE, FMT, UNITS, QGRIDTYPE,
AUTH [, 'overwrite'])
write a cggrid object to a database
cggrid_free(CGG)
cggrid elimination routine
Parameter Files
PF = dbpf()
PF = dbpf(PFNAME)
PF = dbpf(PF, STRING)
dbpf (Parameter File) class constructor
STRING = pf2string(DBPF)
convert a parameter file object to a string
STRUCT = pf2struct(DBPF [, 'recursive' ])
convert a parameter file object to a Matlab struct
Matlab Interface
70
Scripting Reference
FILENAMES = pffiles(PFNAME [, 'all' ])
list file corresponding to parameter file PFNAME
clear(DBPF)
dbpf elimination routine
pffree(DBPF)
dbpf elimination routine
RESULT = pfget(DBPF, NAME [, 'recursive' ])
get a generic parameter from a parameter file object
PF = pfget_arr(DBPF, NAME [, 'recursive' ])
get an associative array from a parameter file object
BOOLEAN = pfget_boolean(DBPF, NAME)
get a boolean value from a parameter file object
NUM = pfget_num(DBPF, NAME)
get a numeric value from a parameter file object
STRING = pfget_string(DBPF, NAME)
get a string from a parameter file object
LIST = pfget_tbl(DBPF, NAME [, 'recursive' ])
get an ordered list from a parameter file object
KEYS = pfkeys(DBPF)
find the parameter names in a parameter file object
NAME = pfname(DBPF)
find the name of a top-level parameter file object
pfput(DBPF, NAME, VALUE)
put a value into a parameter file object
pfput_boolean(DBPF, NAME, VALUE)
put a boolean value into a parameter file object
RESULT = pfresolve(DBPF, NAME [, 'recursive' ])
alternate interface to retrieve parameters
TYPESTRING = pftype(DBPF)
find the type of a parameter file object
[PF, MODIFIED] = pfupdate(DBPF)
refresh a Dbpf object to reflect changes in the file
pfwrite(DBPF, FILENAME)
save a parameter file object to a file
Real-time System Connections
PKTID = orbafter(ORBFD, TIME)
set ORB connection to first packet after a specified
time
orbclose(ORBFD)
close a connection to an Antelope object-ring-buffer
Matlab Interface
71
Scripting Reference
[RESULT, TIME, SRCNAME, PKTID, TYPE] = orbget(ORBFD [, CODE|PKTID])
get packets from an Antelope ORB connection
ORBFD = orbopen(ORBNAME, OPENTYPE)
open a connection to an Antelope object-ring-buffer
VERSION = orbping(ORBFD)
ask for the version number of an Antelope ORB
server
[RESULT, TIME, SRCNAME, PKTID, TYPE] =
orbreap(ORBFD [, 'nodelay'])
get successive packets from an Antelope ORB connection
NSOURCES = orbreject(ORBFD, REGEX)
reject sources on an Antelope ORB read connection
PKTID = orbseek(ORBFD, CODE **or**PKTID)
set an ORB Read connection to the specified position
NSOURCES = orbselect(ORBFD, REGEX)
select sources on an Antelope ORB read connection
PKTID = orbtell(ORBFD)
ask for the current read-position on an Antelope
ORB
Seismic Travel Times
[SLOWNESS, PHASENAMES] = arr_slowness(DELTA,
DEPTH)
Returns predicted seismic phase slownesses in sec/
km
[TIMES, PHASENAMES] = arrtimes(DELTA, DEPTH)
Returns predicted seismic phase arrival times
Special Functions
dbadd_remark(DBPTR, REMARK)
add a remark to a CSS3.0 database table
[FILENAME STATUS] = dbextfile(DBPTR, TABLENAME)
Compose a filename from the specified Datascope
database record
[FILENAME STATUS] = dbfilename(DBPTR)
compose a filename from a database record
IRECORD = dbfind(DBPTR, EXPRESSION [, FIRST [,
COUNT]] [, 'backwards'])
locate a database row satisfying some condition
Matlab Interface
72
Scripting Reference
REMARK = dbget_remark(DBPTR)
get a remark from a CSS3.0 database table
ID = dbnextid(DBPTR, IDNAME)
get the next integer id for id field from a database
[DIR, BASE [,SUFFIX]] = parsepath(PATH)
separate a pathname into component parts
Time Conversion
TIMESTRING = epoch2str(EPOCH, FORMAT)
convert epoch time to a string
EPOCH = str2epoch(TIMESTRING)
convert a string to epoch time
STRDATE = strdate(EPOCH)
convert an epoch time to its corresponding date
STRTDELTA = strtdelta(EPOCH)
convert an epoch time difference to an elapsed time
STRTIME = strtime(EPOCH)
convert an epoch time to a string date and time
STRYDTIME = strydtime(EPOCH)
convert an epoch time to a string date and time,
including day of year
YEARDAY = yearday(EPOCH)
convert an epoch time to a yearday value
TIMESTRING = zepoch2str(EPOCH, FORMAT, TZ)
convert epoch time to a string, specifying time-zone
Misc
PID = getpid()
get the process-id of the calling process
Matlab Interface
73
Compiled
Languages
Interfaces
Contents
libstock : General Utilities ................................ 1
libcoords : Time and Space........................... 25
libds : Database Operations .......................... 27
libtr : Waveform Manipulation ........................ 32
libtrvltm : Travel Times................................... 39
libresponse : Instrument Response............... 40
liborb : Orbserver Access .............................. 41
libPkt : Orb Packets ....................................... 44
libpforbstat : Orb Status Parameter Files....... 46
libxtra : Miscellaneous ................................... 47
libbrttpkt : Packet Processing ........................ 48
libbrttutil : BRTT Utilities ................................ 52
libmappts : Map Data Utilities........................ 55
libproj : Map Projections ................................ 57
libtks : Tk Send IPC....................................... 60
libwffil : Filter Waveforms............................... 61
libwffilave : Averaging Filters ......................... 62
libwffilbrtt : BRTT Filters ................................ 63
Fortran Interfaces .......................................... 64
Programmer Reference
libstock : General Utilities
implements variety of general purpose programming utilities
include "stock.h"
ldlibs=$(STOCKLIBS)
Parameter Files
int pfread(char *name, Pf **pf)
read parameter space name into pf, returning 0 for
success.
int pfupdate(char *name, Pf **pf)
check files which compose parameter space name,
reread and return 1 if changed; on first read, pf must
=0
Tbl *pffiles(char *name, int all)
return list of files which compose name
int pfload(char *env, char *dir, char *fname, Pf **pf)
read single parameter file found by datapath(3) into
pf
int pfcompile(char *s, Pf **pf)
read parameter space from string s into pf
int pfwrite(char *fname, Pf *pf)
write parameter space pf to the file fname
int pfin(FILE *in, Pf **pf)
read parameter space from file in into pf
int pfout(FILE *out, Pf *pf)
write parameter space pf to file out
char *pf2string(Pf *pf)
return new string representation of pf
Pf *pfnew(int type)
start a new parameter space
void pffree(Pf *pf)
free resources for pf
Pf *pfdel(Pf *pf, char *name)
remove branch for name from pf, returning the
deleted branch
int pfconfig("ask", char *(*askx)(char*))
replace default &ask routine with new version askx
int pfget(Pf *pf, char *name, void **result)
put value for name from pf in result, returning type
libstock : General Utilities
1
Antelope 4.10
int pfresolve(Pf *pf, char *name, int create, Pf **result)
put value for name from pf into result, allowing
extended syntax like arr{name}[3], returning type
int pfeval(Pf *pf, char *name, char **result)
put value for name from pf into result, allowing
extended syntax like arr{name}[3], but returning
only scalar values
int pfget_boolean(Pf *pf, char *name)
return boolean value for name from pf
double pfget_double(Pf *pf, char *name)
return double value for name from pf
long pfget_int(Pf *pf, char *name)
return integer value for name from pf
char *pfget_string(Pf *pf, char *name)
return string value for name from pf
double pfget_time(Pf *pf, char *name)
return epoch time for name from pf
double pfget_size(Pf *pf, char *name)
return size for name from pf, interpreting suffix of G
(10^9), M (10^6), or k (10^3)
Tbl *pfkeys(Pf *arr)
return list of keys for pf arr
Arr *pfget_arr(Pf *pf, char *name)
return array value for name from pf
Tbl *pfget_tbl(Pf *pf, char *name)
return list value for name from pf
long pfmaxtbl(Pf *list)
return the number of elements in the pf list
void pfput(Pf *pf, char *name, void *value, int t)
put a value (of type t) into pf under name
int pfset(Pf *pf, char *name, char *value)
put a character value into pf under name, allowing
extended syntax like arr{name}[3]
void pfput_boolean(Pf *pf, char *name, int value)
put boolean value into pf under name
void pfput_double(Pf *pf, char *name, double value)
put double value into pf under name
void pfput_int(Pf *pf, char *name, long value)
put integer value into pf under name
void pfput_string(Pf *pf, char *name, char *value)
put string value into pf under name
2
libstock : General Utilities
Programmer Reference
void pfput_time(Pf *pf, char *name, double time)
put readable time into pf under name
void pfput_arr(Pf *pf, char *name, Arr *value)
put array value into pf under name
void pfput_tbl(Pf *pf, char *name, Tbl *value)
put list value into pf under name
int pfcmp(Pf *pf1, Pf *pf2)
return 0 if pf1 and pf2 are identical, 1 otherwise
Pf *pfdup(Pf *old)
duplicates(clones) a parameter file space
int pfrequire(char *pfname, char *atime)
require pf_revision_code later than atime
Associative Arrays
Arr *newarr(int (*cmp)(char*, char*))
create a new associative array with string compare
routine cmp; if cmp=0, use strcmp().
Arr *duparr(Arr *arr, void *(*adup)(void*))
return duplicate (clone) of the array arr using the
adup routine to duplicate individual values.
int freearr(Arr *arr, void (*afree)(void*))
free array arr, calling afree on each value of the array
void *setarr(Arr *arr, char *key, void *val)
set the value for key in arr to val, returning previous
value
void *getarr(Arr *arr, char *key)
return the value for key in arr
void *delarr(Arr *arr, char *key)
delete the key, value pair for key in arr, returning
value
long cntarr(Arr *arr)
return the number of key, value pairs in arr
Tbl *keysarr(Arr *arr)
return list of all the keys in arr
Tbl *valsarr(Arr *arr)
return list of all the values in arr
int applyarr(Arr *arr, void (*f)(char *key, void *value,
void *p), void *p)
apply function f to each key, value pair in arr
Tbl *arrgrep(Arr *arr, char *s)
match each key of arr as a regular expression
against string s, returning list matching keys
libstock : General Utilities
3
Antelope 4.10
Tbl *greparr(char *re, Arr *arr)
return list of all keys in arr which match regular
expression re
Lists
Tbl *newtbl(long n)
return a new list with n elements
Tbl *inittbl(long left, long right, int direct, void *null, int
sz)
return a new direct list with specified null value and
elements of sz bytes
void freetbl(Tbl *tbl, void (*tfree)(void*))
free memory used by list tbl, calling tfree on each
element
long maxtbl(Tbl *tbl)
return number of elements in list tbl
Tbl *duptbl(Tbl *tbl, void *(*tdup)(void*))
return duplicate (clone) of the list tbl using the tdup
routine to duplicate individual elements.
void clrtbl(Tbl *tbl, void (*tfree)(void*))
empty an existing list tbl, calling tfree on each element
void trunctbl(Tbl *tbl, long last, void (*tfree)(void*))
shorten a list tbl to contain only last elements, calling tfree on other elements
long settbl(Tbl *tbl, long index, void *value)
set element #index of list tbl to value
void *gettbl(Tbl *tbl, long index)
return value for element #index of list tbl
long instbl(Tbl *tbl, long index, void *value)
insert element value at position index of list tbl, shifting other element to the right
void *deltbl(Tbl *tbl, long index)
delete element #index from list tbl, returning the
deleted element
void *poptbl(Tbl *tbl)
remove last element from list tbl, returning that element
void *shifttbl(Tbl *tbl)
remove first element from tbl, returning that element
long pushtbl(Tbl *tbl, void *value)
append an element value to the end of the list tbl
long unshifttbl(Tbl *tbl, void *value)
insert an element value at the front of the list tbl
4
libstock : General Utilities
Programmer Reference
int filetbl(char *name, char *id, long n, void *null, int sz,
Tbl **tbl)
read or create a list in file name with n elements of sz
bytes, returning the tbl
Tbl *readtbl(char *name, char **id, int rw)
read a list from file name
int savetbl(Tbl *tbl, char *name, char *id)
write a list tbl to file name
Tbl *greptbl(char *re, Tbl *tbl)
search each element of list tbl with regular expression re, returning new list of matching rows
Tbl *tblgrep(Tbl *tbl, char *s)
considering each element of list tbl as a regular
expression, return a new list of elements which
match string s
void sorttbl(Tbl *tbl, int (*cmp)(char*, char*, void*), void
*pvt)
sort a list tbl using the comparison function cmp
long searchtbl(char *key, Tbl *tbl, int (*cmp)(char*, char*,
void*), void *pvt, long *ns, long *ne)
search a sorted list tbl for key using a binary search
and comparison function cmp; return count and
range ns <= i <= ne of matches
int applytbl(Tbl *tbl, int (*f)(void*, void*), void *pvt)
apply function f to each elements of list tbl
Tbl *strtbl(char *s1, ...)
create a new list from a variable argument list of
strings, terminated with NULL
char *jointbl(Tbl *tbl, char *s)
return a new string containing all elements of list tbl,
separated by string s.
long cattbl(Tbl *dst, Tbl *src)
append list src to list dst
int cmptbl(Tbl *tbl1, Tbl *tbl2)
return 0 if lists tbl1 and tbl2 are identical
int newmorphtbl(Tbl *list, Morphtbl **map)
create a new Morphtbl: a list of patterns and substi-
tutions
int morphtbl(char *old, Morphtbl *map, int flags, char *r)
apply the patterns and substitutions in map to the
string old, leaving the result in r. flags may contain
MORPH_PARTIAL and/or MORPH_ALL. if
MORPH_PARTIAL is set, the pattern need not
match the entire string. if MORPH_ALL is set, all
libstock : General Utilities
5
Antelope 4.10
the patterns are applied; otherwise replacement
stops at the first matching pattern
void freemorphtbl(Morphtbl *map)
free Morphtbl map
Sorted Lists
Stbl *newstbl(int (*cmp)(void *a, void *b))
create a new sorted list
void *addstbl(Stbl *stbl, void *key)
add an element key to sorted list stbl
void *delstbl(Stbl *stbl, void *key)
delete element key from sorted list stbl
int freestbl(Stbl *stbl, void (*sfree)(void*))
free sorted list stbl, calling sfree for each element
void *getstbl(Stbl *stbl, long i)
return i'th element from sorted list stbl
void *tststbl(Stbl *stbl, void *key)
test if element corresponding to key exists in sorted
list stbl
long maxstbl(Stbl *stbl)
return the number of elements in sorted list stbl
Tbl *tblstbl(Stbl *stbl)
return list of all elements in a sorted list (should be
freed with freetbl(tbl,0))
int applystbl(Stbl *stbl, int (*f)(void*, void*), void *pvt)
call function f for each element of sorted list stbl
Id Maps
Stbl *newidmap(void)
create a new id map, mapping one set of positive
integers to another
void freeidmap(Stbl *map)
free idmap map
long idset(Stbl *map, long key, long x)
set the value of key in map to x; any previous value
for key is returned, or -1
long idget(Stbl *map, long key)
return the value of key in map, or -1 if it's not set
Bit Vectors
Bitvector *bitnew()
create a new bit vector
6
libstock : General Utilities
Programmer Reference
void bitfree(Bitvector *b)
free a bit vector
int bitclr(Bitvector *b, long index)
clear bit index of bit vector b
int bitset(Bitvector *b, long index)
set bit index of bit vector b
int bittst(Bitvector *b, long index)
test bit index of bit vector b
long bitmax(Bitvector *b)
return current allocated size of b
Bitvector *bitnot(Bitvector *b)
return the bitwise NOT of b
Bitvector *bitand(Bitvector *b1, Bitvector *b2)
return the bitwise AND of b1 and b2
Bitvector *bitor(Bitvector *b1, Bitvector *b2)
return the bitwise OR of b1 and b2
Bitvector *bitxor(Bitvector *b1, Bitvector *b2)
return the bitwise eXclusive-OR of b1 and b2
int bitcmp(Bitvector *b1, Bitvector *b2)
compare two bit vectors
Simple Ring Buffer
RingBuffer *openring(char *filename, char *id, int depth,
int flags)
open (or create) a simple ring buffer in filename with
size depth
int newring(char *filename, char *id, int depth, int flags)
create (or reinitialize) a simple ring buffer in filename with size depth
void closering(RingBuffer *rb)
close the ring buffer rb
int pushring(RingBuffer *rb, double time, double value)
push a time/value pair onto the ring buffer rb
int getring(RingBuffer *rb, int i, double *time, double
*value)
get the i'th time/value pair from the ring buffer rb
int countring(RingBuffer *rb)
return the number of pairs in the ring buffer
double maxring(RingBuffer *rb, double tdelta, int *index)
return the maximum value and its index within tdelta
from the ring buffer rb
libstock : General Utilities
7
Antelope 4.10
double minring(RingBuffer *rb, double tdelta, int *index)
return the minimum value and its index within tdelta
from the ring buffer rb
double avgring(RingBuffer *rb, double tdelta)
return the average value over tdelta from the ring
buffer rb
int findring(RingBuffer *rb, double value, double tdelta)
find the index of ring buffer entry which has the
specified value within tdelta entries
int changedring(RingBuffer *rb, double tdelta)
return 1 if the value has changed over the period
tdelta
Time conversion
int is_epoch_string(char *s, double *e)
return true if string s can be interpreted as a time,
returning epoch time e
int is_timezone(char *name)
returns 1 if file corresponding to name is found, 0
otherwise
double now()
return current epoch time, to clock resolution (typically microseconds)
void wait_for_time(double time, int verbose)
sleep until specified epoch time
void snooze(double dt)
sleep (using nanosleep) for specified dt
char *epoch2str(double e, char *f)
return freshly allocated string containing epoch time
e formatted according to format f
char *zepoch2str(double epoch, char *f, char *timezone)
return freshly allocated string containing epoch time
e formatted according to format f for timezone; if timezone == 0, use UTC, if timezone == "", use $TZ
char *strdate(double e)
return string representing date portion of epoch time
char *strtime(double e)
return string representing epoch time
char *strydtime(double e)
return standard string representing epoch time
char *strlocaldate(double e)
return string representing date portion of local timezone time
8
libstock : General Utilities
Programmer Reference
char *strlocaltime(double e)
return string representing local timezone time
char *strlocalydtime(double e)
return string representing local timezone time with
yearday
char *strtdelta(double e)
return a string representation of elapsed time
double epoch(int yearday)
convert yearday to epoch time
long yearday(double e)
return yearday corresponding to given epoch time
Error handling
int elog_init(int argc, char **argv)
initialize elog routines
void elog_log(int flag, char *format, ...)
save the message specified by sprintf style format
and arguments to internal error log; add system
error message if flag!=0
void elog_debug(int flag, char *format, ...)
void elog_notify(int flag, char *format, ...)
void elog_alert(int flag, char *format, ...)
void elog_complain(int flag, char *format, ...)
deliver the message specified by sprintf style format
and arguments, along with any messages on the
error log. include system error message if flag!=0
void elog_die(int flag, char *format, ...)
void elog_fault(int flag, char *format, ...)
deliver the message specified by sprintf style format
and arguments, along with any messages on the
error log. include system error message if flag!=0.
exit with error code 1
char *elog_string(int first)
return new string reproducing the entire error log
char *elogstr(int severity, int flag, char *fmt, ...)
return new string corresponding to single elog call,
without adding to error log
void elog_clear()
clear the log of error messages
int elog_mark()
return the number of messages in the error log
libstock : General Utilities
9
Antelope 4.10
void elog_flush(int deliver, int first)
flush elog messages from first, printing them if
deliver is non-zero
void elog_truncate(int n)
truncate error log to n messages
void elog_print(FILE *file, int first)
print the error log from first to the end
int elog_query(enum Elog_code code, int severity, void
**value)
retrieve various parameters from elog interface
int elog_set(enum Elog_code code, int severity, void
*value)
set various parameters for elog interface
Filename and Path Manipulation
int abspath(char *relp, char *absp)
return absolute path absp for the relative path relp
int relpath(char *fromdir, char *tofile, char *relp)
return a relative path relp from fromdir to tofile
int cleanpath(char *path, int flags, char *new)
remove unnecessary '/', '..', and '.' strings from path,
returning the result in new; if flags is 1, resolve intermediate symbolic links
char *concatpaths(char *seg1, *seg2, ...)
concatenate path segments seg1, seg2, ..., return the
result in a new string
int fspath(char *path, char *host, char *filesystem)
return host and filesystem corresponding to path
InfoPath *infopath(char *path)
return info about path including disk space and
inodes available
int freespace(char *path, double mbavail)
returns 1 if filesystem where path resides has more
than mbavail Mbytes available
int samepath(char *path1, char *path2)
returns 1 if path1 and path2 resolve to same file or
directory
char *homedir(char *user)
return the home directory of the specified user.
unsigned long filesize(char *path)
return file size for plain file, 0 otherwise
unsigned int filemode(char *path)
return file mode for file path
10
libstock : General Utilities
Programmer Reference
int is_present(char *path)
return 1 if path exists, 0 otherwise
int is_empty(char *path)
for plain file, return 1 if file has size zero for directory, return 1 if directory contains no files
int is_file(char *path)
return 1 if path is plain file, 0 otherwise
int is_filename(char *path)
return 1 if path begins with "/", "./" or "../"; 0 otherwise.
int is_writable_file(char *path)
return 1 if path is writable or if not present but directory is writable
int is_dir(char *path)
return 1 if path is directory, 0 otherwise
int is_nfs(char *path)
return 1 if path is on nfs mounted filesystem, 0 otherwise
int is_changed(char *path)
return 1 on first call and when mod time changes, or
zero if file does not exist
int is_timezeone(char *name)
return 1 if name is valid time zone
Tbl *dirfiles(char *dir, int flag)
return list of files in dir; if flag==1, only files, if
flag==2, only dirs
int fstraverse(char *dir, int flag, int (*user)(char*, stat*,
void*), void *pvt)
run user routine on each file below dir;
flag=FS_ONLY_DIR, FS_ONLY_FILE,
FS_DEPTH_FIRST
void parsepath(char *path, char *d, char *b, char *s)
separate path into directory d and basename b, and
suffix s if s!=0
int makedir(char *dir)
make complete directory path dir (like "mkdir -p")
int make_pathdirs(char *path)
make all directories to path (like "mkdir -p `dirname
path`")
long mapfile(char *name, Arr **arr, char **addr)
return memory address addr for file name, mmapping it when not present in arr
libstock : General Utilities
11
Antelope 4.10
int unmapfile(char *name, Arr **arr)
unmap file name, removing it from arr
int mkfile(char *name, ulong nbytes, char *init, int initsize)
make file name nbytes long initialized with the first
initsize bytes of init, otherwise zero
Strings
int blank(char *s)
return non-zero if string is entirely spaces
int whitespace(char *s)
return non-zero if string is entirely whitespace
void copystrip(char *dest, char *source, long n)
copy a string, stripping leading and trailing blanks
void strtrim(char *s)
trim leading and trailing whitespace from string s
char *intactline(FILE *file, char **aline, long *size)
read entire line from file into resizable buffer aline
with current size
void chomp(char *s)
remove trailing linefeed from string s if present
void strtr(char *s, char *from, char *to)
substitute chars in s using lists in from and to
void str2lower(char *s)
void str2upper(char *s)
convert string s to all lower/upper case
char *okstr(char *s)
if s != 0, return s otherwise null
void strsub(char *old, char *s, char *sub, char *r)
replace all occurences of string s in old with sub,
leaving result in r
void regsubstitute(char *old, char *sub, regmatch_t
*matches, char *new)
given results matches of regexec, substitute sub in
old, returning result in new
int patsub(char *old, regex_t *pat, char *sub, char *r)
replace first occurence of regular expression pat in
string old with sub, leaving result in r
int nstrcmp(char *a, char *b)
return 0 if a==b==0, 1 if only one of a, b is null, otherwise strcmp(a,b)
int strmatches(char *s, char *pattern, Hook **hook)
return 1 if entire string s matches the regular expression pattern
12
libstock : General Utilities
Programmer Reference
int strcontains(char *s, char *pattern, Hook **hook, long
*start, long *nchars)
return 1 if string s contains the regular expression
pattern; the index and number of matching chars
nchars are returned.
Tbl *split(char *s, int c)
return list of fields of s which are delimited by the
char c
void sncopy(char *dst, char *src, long n)
copy n chars from string src to dst with no trailing
null, padding with spaces if necessary
void szcopy(char *dst, char *src, long n)
copy n chars from string src to dst, then append null
char *strconcat(char *s, ...)
return the result of concatenating all the input
strings (terminate list with NULL)
char *strjoin(int c, char *s, ...)
return the result of concatenating all the input
strings separated by c (terminate list with NULL)
long pushstrc(void **sbuf, int c)
long pushstrn(void **sbuf, char *s, long n)
long pushstr(void **sbuf, char *s)
add the string s (or char c) to the string buffer sbuf,
creating sbuf if *sbuf == 0, returning new length
char *popstr(void **sbuf, int sfree)
retrieve the entire string from sbuf, freeing sbuf if
sfree != 0
char *strdbl(double x, char *buf)
formats the input double x into a compact and convenient string
Sorting and Searching
void isort(char *a, long n, int size, int (*cmp)(char*, char*,
void*), void *pvt)
sort list a of n elements each size bytes using the
comparison function cmp and an insertion sort
implementation
void quicksort(char *a, long n, int size, int (*cmp)(char*,
char*, void*), void *pvt)
sort list a of n elements each size bytes using the
comparison function cmp and a quick sort imple-
mentation
libstock : General Utilities
13
Antelope 4.10
void shellsort(char *a, long n, int size, int (*cmp)(char*,
char*, void*), void *pvt)
sort list a of n elements each size bytes using the
comparison function cmp and a shell sort implemen-
tation
long ssearch(char *key, int keysize, char *index, long nkeys,
int unique, int (*cmp)(char*, char*, void*), void
*pvt, long *ns, long *ne)
search sorted index for key with binary search, where
keys are size bytes and comparison function cmp.
return number of matches and the index range ns <= i
<= ne of matches. unique indicates index has no
duplicate entries
User Interaction
char *ask(char *format, ...)
query user for a response
char *asknoecho(char *format, ...)
query user for a response with no echo
int askyn(char *format, ...)
query user for a yes/no response
int askynaq(char *format, ...)
query user for a yes/no/all/quit response
int yesno(char *s)
check string for various ways of meaning yes or no
int fdkey(int fd)
tests file descriptor for pending input
int fdwait(int fd, int msec)
wait up to msec milliseconds for pending input
int is_tty(int fd)
return 1 if fd is open to a terminal, 0 otherwise.
int tty_byline(int fd)
int tty_immediate(int fd)
set line protocol buffering mode
int tty_echo(int fd)
int tty_noecho(int fd)
set line protocol echo mode
int tty_reset(int fd)
reset terminal to initial state (before first tty_* call
above)
char *getaline(FILE *file, char *aline, long n)
reads a line from file, replacing any terminal linefeed
with a null byte
14
libstock : General Utilities
Programmer Reference
Hexadecimal Dumps
void hexdump(FILE *file, void *mem, int n)
write a hex and ascii dump of n bytes of buffer mem
char *hexdump_string(long base, void *mem, int n)
return string containing hex dump of buffer mem,
labelling the address of mem as base.
int read_hexdump(FILE *file, char *mem, int n)
read at most n bytes of a hex dump from file into
mem
void asciidump(FILE *file, char *mem, int n)
write ascii dump of n bytes of buffer mem, with
escaped non-printing chars
int read_asciidump(FILE *file, char *mem, int n)
read at most n bytes of a ascii dump from file into
mem
void *nomem(void *mem, int n)
returns first address in range mem to mem+n that is
invalid, 0 otherwise (non-functional in Linux)
int hex2int(char c)
return the integer value of a hexadecimal char
int printable(char *mem, int l)
return 1 if all l bytes at mem are printable
void printable_string(char *buf, int p, char *mem, int n)
copies n bytes from mem to p-byte buf, replacing
unprintable chars with hex
long hex2mem(char *hex, void *vmem)
convert hexadecimal character string hex into binary
in vmem
void mem2hex(void *vmem, int n, char *s)
convert n bytes at vmem into hexadecimal character
string
Byteswap Routines
Over 250 routines for byteswapping, with names chosen to indicate
source and destination type and architecture, for example:
#include "swapbytes.h"
libstock : General Utilities
15
Antelope 4.10
int mf2hd(void *vfrom, double *to, int n)
int uhs2vb(short *from, void *vto, int n)
int vt2hi(void *vfrom, int *to, int n)
int hi2mt(int *from, void *vto, int n)
Leading u means unsigned input and output, next 2 chars indicate
source architecture and data type, and last 2 chars indicate destination
architecture and data type.
Architecture codes
h
current host
a
Intel StrongARM.
m
Motorola/SPARC
v
Vax/Intel
Type codes
code
type
bits
b
byte/char
8
s
short
16
t
3-byte
24
i
int
32
l
long long
64
f
float
32
d
double
64
char *align_double(char *a)
align an address a to a multiple of double
char *align_long(char *a)
align an address a to a multiple of long
char *align_int(char *a)
align an address a to a multiple of int
Compression and Checksums
int gencompress(uchar **out, int *nout, int *szout, int *in,
int n, int len)
compress n input integers in, using run length len,
returning result as *nout bytes in *out.
int genuncompress(int **out, int *nout, int *size, uchar
*in, int n)
uncompress the n bytes buffer in, returning result as
*nout integers in *out.
int ccanada(int *uc, int nuc, char **cmp, int *ncmp, int
*cmpsz)
compress nuc integers from uc to "Canadian Compression" format, result is *ncmp bytes in buffer
*cmp of dynamic size *cmpsz.
16
libstock : General Utilities
Programmer Reference
int ucanada(char *cmp, int ncmp, int **uc, int *nuc, int
*ucsz)
uncompress "Canadian Compression" buffer cmp of
ncmp bytes, result is *nuc integers in buffer *uc of
dynamic size *ucsz.
int cm6(int *uc, int nuc, char **cmp, long *ncmp, long
*cmpsz)
compress nuc integers from uc to plain ascii "GSE
AutoDRM CM6" format, result is *ncmp bytes in
buffer *cmp of dynamic size *cmpsz.
long um6(char *cmp, long ncmp, int **uc, long *nuc, long
*ucsz)
uncompress plain ascii "GSE AutoDRM CM6" format buffer cmp of ncmp bytes, result is *nuc integers
in buffer *uc of dynamic size *ucsz.
int gse_checksum(int *uc, int nuc)
compute gse checksum over nuc integers in uc for
AutoDRM
int cucsd(int *uc, int nuc, char **cmp, int *ncmp, int
*cmpsz)
compress nuc integers from uc to UCSD RefTek data
logger format, result is *ncmp bytes in buffer *cmp
of dynamic size *cmpsz.
int uucsd(int *uc, char **cmp, int ncmp, int nuc)
uncompress nuc integers from "UCSD RefTek data
logger" format buffer cmp of ncmp bytes, advancing
*cmp to the next location after uncompressed data
FILE *gz_cat(char *name)
return FILE opened for reading on the output of
"zcat name"
FILE *gz_open(char *name)
return FILE opened for reading on the uncompressed version of name
Convenience Macros
allot(type*, name, n)
malloc space for n (type *) elements, putting the
address in name
reallot(type*, name, n)
realloc space for n (type *) elements, putting the
address in name
allot and reallot both use ALLOTERROR, which may be defined as
ALLOTDIE (default), ALLOTCOMPLAIN,
ALLOTREGISTER_ERROR, or your own macro
libstock : General Utilities
17
Antelope 4.10
SIZE_BUFFER(type*, buffer, sizevar, needed)
ensure that (type *) buffer (currently allocated with
size in sizevar) has space for at least needed elements
-- if not, free the old buffer, and malloc a new buffer
RESIZE_BUFFER(type*, buffer, sizevar, needed)
ensure that (type *) buffer (currently allocated with
size in sizevar) has space for at least needed elements
-- if not, realloc the old buffer, copying the current
contents
IEEE Arithmetic
int is_infinity(double x)
return 1 if x is infinity
int is_denormalized(double x)
return 1 if x is denormalized
int is_nan(double x)
return 1 if x is nan
int is_negative_infinity(double x)
return 1 if x is -infinity
double an_infinity(void)
return an infinity
double a_nan(void)
return a (quiet) nan
double a_quiet_nan(void)
return a quiet nan
double a_signaling_nan(void)
return a signaling nan
Local Machine/Architecture
int my_hardware(char *hdw)
return processor name (sparc, i386, ..)
int my_hostname(char *name)
return hostname
int my_ip(char *hostname, char *ipc, int *ip)
return ip address, as integer and in dot notation
int my_os(char *name)
return operating system (Solaris, Linux, ...)
int my_username(char *name)
return the login id
int ip2name(int addr, char *name)
return name corresponding to addr
int name2ip(char *name, struct in_addr *addr, char *ipstr)
return ip address for name
18
libstock : General Utilities
Programmer Reference
int pid_exists(int pid)
return 1 if process pid exists, 0 otherwise.
char *pidexecname(int pid)
return path to executable for process pid
char *pidcmdline(int pid)
return command line for process pid
char *pidpwd(int pid)
return working directory for process pid
int pidinfo(int pid, Pidstat *process)
return ppid, uid, memory size, resident set size, run
state, start time, cpu time for process pid
void syscpu(int *ncpu, CpuUsage **cpu)
return user, nice, system and idle time for each cpu
void sysloadavg(double *avg, int *nproc)
return 1 minute, 5 minute and 15 minute load averages
void sysmem(double *total, double *physical, double
*used)
return size of virtual and actual physical memory,
and size of memory in use.
int sysproc(Tbl **procsp)
return list of system processes, with pid, uid, ppid,
pcpu, state, and cpu time for each
int sysmounted(Tbl **sysmnt)
return list of mounted filesystems, with mount point,
filesystem type, and remote host and filesystem if
mounted remotely.
Environment
int envfile(char *filename)
set environment using list in $ANTELOPE/data/
env/filename
int fixup_env(char **list, int n, int force)
set environment using list; if force==0, set only unset
variables
char *expand_env(char *s)
return new string substituting $env or ${env} in s
with value from environment
Data File References
char *datafile(char *env, char *file)
return path of filename file in $ANTELOPE/data,
perhaps overridden by environment variable env
libstock : General Utilities
19
Antelope 4.10
char *datapath(char *env, char *dir, char *file, char *sfx)
return path of filename file (with suffix sfx) in directory dir under $ANTELOPE/data, perhaps overridden by environment variable env
int newdata(char *path, char *env, char *dir, char *file,
char *sfx)
return complete path for file (with suffix sfx) in directory dir under $ANTELOPE/data, allowing environment variable env to override
Tbl *datasearch(char *search, char *dir, char *file, int
flags)
return paths matching dir/file along the path search.
If (flags & 1), expand $name in search; if (flags & 2),
return non-existent paths too
State Files
int bury()
save state file, specified by exhume and resurrect
calls
int exhume(char *nm, int *stop, int sec, void (*f)(Pf*))
recover state file nm, and set up to save new copy. set
up interrupt handlers to set flag stop and timer. If
timer expires sec seconds later, calls bury and exits.
int resurrect(char *name, Relic value, Relic_type type)
recover old value for name from state file, set up to
save on later calls to bury. type is INT_RELIC,
DOUBLE_RELIC or STRING_RELIC
Buffered Network Stream I/O
Bns *bnsnew(int fd, long sz)
create a new network stream I/O buffer
void bnsfree(Bns *bns)
free space for bns
int bnsclose(Bns *bns)
close file descriptor and free space for bns
void bnsuse_sockio(Bns *bns)
setup bns to use socket routines rather than read and
write
int bnsget(Bns *bns, void *data, int t, long n)
get n elements of type t from bns, returning the result
in data ; t may be BYTES, TWO_BYTES,
INT_FOUR_BYTES, INT_EIGHT_BYTES,
FLOAT_FOUR_BYTES, or
FLOAT_EIGHT_BYTES
20
libstock : General Utilities
Programmer Reference
int bnsgetc(Bns *bns, void *data, long mx, int c)
search for first char c in input, returning up to mx
chars including c
long bnsin(Bns *bns)
return count of chars gotten since previous bnsin
call
long bnsout(Bns *bns)
return count of chars written since previous bnsout
call
char *bnsid(Bns *bns, char *id)
return existing value, sets to new id if id != 0
int bnsput(Bns *bns, void *data, int t, long n)
put n elements of type t from data, into buffer of bns
int bnsflush(Bns *bns)
write all data currently in bns buffer
void bnsmark(Bns *bns)
save the current read point in the input buffer; keep
all data after this mark until bnsrelease
void bnsrelease(Bns *bns)
reset mark on the input buffer
void bnsrestore(Bns *bns)
back up bns pointer to previous mark
void bnsclr(Bns *bns)
wipe clean the bns buffer
long bnscnt(Bns *bns)
return count of bytes in bns buffer
int bnseof(Bns *bns)
return non-zero when end of file occurs on input
int bnserr(Bns *bns)
return non-zero after an error occurs on a bns
int bnserrno(Bns *bns)
return any system errno recorded by bns after read or
write
long bns2buf(Bns *bns, char *buf, long maxbuf)
copy bns buffered data elsewhere
int buf2bns(Bns *bns, char *buf, long nbytes)
put data directly into a bns buffer
int bnstimeout(Bns *bns, int milliseconds)
set the bns timeout period
int bnswait(Bns *bns)
wait until the bns timeout for data to appear
libstock : General Utilities
21
Antelope 4.10
int gbnsSync(Bns *bns, char *sync, int nsync, int strict)
read bns input until nsync chars matching sync are
encountered
int pbnsSync(Bns *bns, char *sync, int nsync)
write nsync chars of sync to bns output
Miscellaneous
void cbanner(char *version, char *usage, char *author,
char *location, char *email)
print header with program name, version, usage, and
author contact information
void *usermethod(char *method)
return pointer to routine method from libuser.so
int verbose_exists()
return 1 if file "verbose" exists, 0 otherwise
Hook *new_hook(void (*hookfree)(void*))
create a standard structure which contains a pointer
to a free routine and a (void *) pointer
void free_hook(Hook **hook)
free a hook structure, first calling the hookfree routine to free the private pointer, and then freeing the
structure
int runcmd(char **argv, char **result)
execute a command, returning a result and the exit
code
void xargs(char *cmd, Tbl *list, char *tail, int verbose)
run cmd repeatedly on elements of list until list is
exhausted. tail is appended to each command; verbose causes each to be printed.
double sz2dbl(char *size)
takes input like 10k and return 10000 -- knows G,
M, k, u and m
void *memdup(void *a, long n)
return pointer to copy of n bytes of memory at
address a
int xlatname(char *name, Xlat *xlat, int nxlat)
return number corresponding to name in translation
table xlat
char *xlatnum(int num, Xlat *xlat, int nxlat)
return name corresponding to number in translation
table xlat
void fill_random(char *buffer, int nbytes, int *position)
fill a buffer with random values
22
libstock : General Utilities
Programmer Reference
int check_random(char *buffer, int nbytes)
compare a buffer previously filled with fill_random
with the values expected.
int set_random(int nbytes)
set the size of the check_random internal buffer
double disordered()
uniform [0,1] pseudo random number
int legit_ip(char *pfname, unsigned int ip, char **limit)
int legit_ip_pf(Pf *pf, unsigned int ip, char **limit)
int legit_fd(char *pfname, Pf **pf, int fd, char **limit)
compare input ip address to list of
valid_ip_addresses (and optional list of
rejected_ip_addresses) in pf, returning 1 if valid, and
remainder of matching line in limit
int units_convert(double x, char *x_units, char *want,
double *y, char *y_units)
convert input value x x_units to units want, leaving
result y y_units
Tbl *units_match(char *x_units)
return a list of all units which match x_units (except
x_units)
Signatures
int sgsign(char *signer, char *data, int nbytes, char *signature)
computes a signature for nbytes of data using method
dictated by signer
int sgverify(char *signer, char *data, int nbytes, char *signature)
verifies the signature for nbytes of data using method
dictated by signer
Reading Files with mmap
int gxopen(char *filename)
return fd for filename using mmap
int gxclose(int fd)
closes fd (unmaps file)
int gxline(int fd, char *aline, int maxchars)
return line from file
int gxseek(int fd, int p)
seeks to position p in file
int gxtell(int fd)
return current position in file
libstock : General Utilities
23
Antelope 4.10
int gxpipe(char *cmd, char **env, int *cmdin)
execute cmd with environment env, cmdin is fd for
stdin of cmd
24
libstock : General Utilities
Programmer Reference
libcoords : Time and Space
2-d and 3-d coordinate transformations, and seismic region routines
include "coords.h"
ldlibs=$(STOCKLIBS)
Earth Units conversion
double deg2km(double degrees)
convert from degrees at equator to kilometers
double km2deg(double km)
convert from kilometers to degrees at equator
Flinn-Engdahl Regions
int grnumber(double lat, double lon)
return Flinn-Engdahl geographic region number
which contains lat, lon
int grname(int grn, char *name)
return Flinn-Engdahl geographic region name for
geographic region grn
int srnumber(int grn)
return Flinn-Engdahl seismic region number for
geographic region grn
int srname(int srn, char *name)
return Flinn-Engdahl seismic region name for seismic region number srn
Spherical Geometry
double deg(double r)
convert input radians r to degrees
double rad(double d)
convert input degrees d to radians
void dist(double lat1, double lon1, double lat2, double lon2,
double *delta, double *azimuth)
return angular distance delta and direction azimuth
between two points (lat1,lon1) and (lat2,lon2) (angles
in radians)
void latlon(double lat1, double lon1, double delta, double
azimuth, double *lat2, double *lon2)
return new position (lat2,lon2) after moving delta
radians in direction azimuth from (lat1,lon1) (angles
in radians)
void dcarsph(double u[3], double *ra, double *dec)
convert a unit 3-vector u to ra and dec (radians)
libcoords : Time and Space
25
Antelope 4.10
void dsphcar(double ra, double dec, double u[3])
convert ra and dec (in radians) to cartesian coords u
void deatom(double a, double b, double c, double m[9])
convert Euler angles a, b, c to rotation matrix m
void dmtoea(double m[9], double *a, double *b, double *c)
convert rotation matrix m to Euler angles a, b, c
void rotmat(double u[3], double A[9], double theta)
create matrix A which rotates by angle theta about
axis u
void xrotate(double u[3], v[3], w[3], theta)
rotate v by angle theta about axis u, returned in w
void dr3add(double u[3], double v[3], double w[3])
add two 3-vectors u and v
void dr3cros(double u[3], double v[3], double w[3])
return cross product w of two 3-vectors u and v
double dr3dot(double u[3], double v[3])
return dot product of two 3-vectors u and v
double dr3mag(double u[3])
return length of a 3-vector
void dr3mov(double u[3], double v[3])
move a vector u to a vector v
void dr3mxm(double A[9], double B[9], double C[9])
multiply two 3x3 matrices A and B, returning result
C
void dr3mxv(double A[9], double u[3], double v[3])
multiply 3x3 matrix A by 3-vector u, returning vector v
void dr3norm(double u[3])
make u a unit vector
void dr3ortho(double u[3], double v[3])
makes u and v orthonormal vectors
void dr3sub(double u[3], double v[3], double w[3])
subtracts v from u, returning result w
void dr3sxv(double c, double v[3], double w[3])
multiply 3-vector v by scalar c, returning result w
26
libcoords : Time and Space
Programmer Reference
libds : Database Operations
implements the Datascope relational database system
include "db.h"
ldlibs=$(DBLIBS)
typedef struct Dbptr {
long database ;
long table ;
long field ;
long record ;
} Dbptr ;
Opening/Closing a Database
int dbopen(char *path, char *p, Dbptr *db)
open database path with permission p ("r" or "r+"),
return database pointer db
long dbopen_database(char *path, char *p, Dbptr *db)
open database or table path, return database pointer
db
long dbopen_table(char *path, char *p, Dbptr *db)
open table path, return database pointer db
Dbptr dblookup(Dbptr db, char *d, char *t, char *f, char
*r)
return database pointer for database d, table t, field f,
and first row where field f==r
int dbcreate(char *path, char *schema, char *dbpath, char
*description, char *detail)
create new database descriptor file path
Dbptr dbtmp(char *schema)
create temporary database using schema
int dbclose(Dbptr db)
close database db
Adding and Retrieving Values
long dbadd(Dbptr db, char *r)
add row r to table db, return new record number
long dbadd_remark(Dbptr db, char *r)
add comment r to CSS table db
long dbaddnull(Dbptr db)
add null row to table db
libds : Database Operations
27
Antelope 4.10
long dbaddv(Dbptr db, char *t, char *f1, v1, ... NULL)
add new row to table db/t, with values v1,... for corresponding fields f1, ... ; terminate list with zero.
return record number of new row (or existing
matching row), or negative result if no row can be
added
int dbget(Dbptr db, char *s)
get row (or field or whole table) from database into s
int dbgetv(Dbptr db, char *t, char *f1, &v1, ... NULL)
read values from row db/t for fields f1, ..., return corresponding values in v1, ...; terminate list with
NULL. return -1 if problem occurs.
int dbget_remark(Dbptr db, char **remark)
get comment from row db of CSS tables, into new
string remark
int dbput(Dbptr db, char *s)
put row (or field or whole table) from s into database/table/field/row db
int dbputv(Dbptr db, char *t, char *f1, v1, ... NULL)
write values v1, ... to corresponding fields f1, ... in
database row db. terminate list with zero.
int dbselect(Dbptr db, Tbl *l, FILE *f)
for each row in view db or range (db.record to
db.field), print value of expressions in list l to file f.
Removing and Deleting Rows
int dbdelete(Dbptr db)
delete row db from view
int dbmark(Dbptr db)
mark row db by setting all fields to NULL value
int dbcrunch(Dbptr db)
remove marked (all null) rows from table db
int dbtruncate(Dbptr db, long n)
truncate table db to first n rows
int dbdestroy(Dbptr db)
remove descriptor file and each table in database db.
Manipulating and Saving Views
Dbptr dbsubset(Dbptr db, char *s, char *name)
create new view with rows from db which satisfy
expression s
28
libds : Database Operations
Programmer Reference
Dbptr dbjoin(Dbptr db1, Dbptr db2, Tbl **keys1, Tbl
**keys2, int outer, Tbl **nojoin, char *name)
return new joined view from two input views db1
and db2. Uses keys keys1 and keys2, or inferred join
keys. Return join keys used and list nojoin of db1
rows which did not join. Setting outer causes every
row in db1 to appear in output view, joined to null
record for db2 if necessary.
Dbptr dbnojoin(Dbptr db1, Dbptr db2, Tbl **keys1, Tbl
**keys2, char *view_name)
return view of rows from view db1 which do not
match row in view db2.
long dbmatches(Dbptr db1, Dbptr db2, Tbl **keys1, Tbl
**keys2, Hook **hook, Tbl **t)
return in t list of row from db2 matching row db1.
hook is used by dbmatches for specific join; it must
=zero at first call, is freed with free_hook when
done.
Dbptr dbtheta(Dbptr db1, Dbptr db2, char *s, int outer,
char *name)
return joined view of rows from db1 and db2 where
expression s, evaluated against trial join of two
rows, is non-zero.
Dbptr dbseparate(Dbptr db, char *tablename)
creates new subset of base table tablename, containing only rows which participate in input view db
Dbptr dbsever(Dbptr db, char *t, char *name)
remove table t from joined view db, return new view
Dbptr dbsort(Dbptr db, Tbl *t, int f, char *name)
sort input view db according to list t of fields or
expressions; sort uniquely if f & dbSORT_UNIQUE
is true; reverse sort order if f & dbSORT_REVERSE
is true.
Dbptr dbgroup(Dbptr db, Tbl *fields, char *name, long
type)
return view in which each row references groups of
1 or more adjacent rows of input view db, where all
fields in list for each group are identical.
Dbptr dbungroup(Dbptr db, char *name)
return view containing all rows referenced in input
grouped view db
Dbptr dbprocess(Dbptr db, Tbl *operations, Dbptr
(*unknown)())
construct new view using list of operations, which
may include: dbopen, dbjoin, dbgroup, dbleftjoin,
libds : Database Operations
29
Antelope 4.10
dbnojoin, dbselect, dbseparate, dbsever, dbsort,
dbsubset, dbtheta, dbungroup
Dbptr dblist2subset(Dbptr db, Tbl *t)
convert list t of rows for view db to subset view
int dbread_view(FILE *f, Dbptr *db, char *name)
read database view from open file f, return new database pointer in db. Return dbINVALID if unsuccessful.
int dbwrite_view(Dbptr db, FILE *f)
write database view db to open file f.
int dbsave_view(Dbptr db)
save database view db to file named according to
view and database name
int dbunjoin(Dbptr db, char *name, int rewrite)
using base table rows referenced in view db, write
new tables (files) to an output database name. fails if
any output tables are already present, unless rewrite
is non-zero, in which case old tables are replaced.
int dbuntangle(Dbptr db, Arr **a)
return an array a indexed by table with lists of rows
present in view db
void dbfree_untangle(Arr *a)
free array a of lists of rows returned by dbuntangle
int dbfree(Dbptr db)
free space taken by database view: specify db.table.
base tables and views referenced by other views
should not be freed.
Dbptr dbbase(Dbptr db, char *table)
returns the base table dbptr for a record of a join/
subset/sort view
void dbget_range(Dbptr db, long *s, long *e)
get row number range from grouped view bundle
pointer
int dbcopy(Dbptr dbin, Dbptr dbout, Arr *expressions)
copy rows field by field from table dbin to table
dbout, translating fields as indicated by array expressions.
Evaluating Database Expressions
int dbex_compile(Dbptr db, char *s, Expression **e, int
type)
compile string s as database expression, return compiled representation e. type may be dbBOOLEAN,
dbINTEGER, dbREAL, dbTIME, dbYEARDAY, or
30
libds : Database Operations
Programmer Reference
dbSTRING (forcing result type) or 0 letting result
type be dictated by expression
int dbex_eval(Dbptr db, Expression *e, int f, void *v)
evaluate expression e for database row db. If flag f is
non-zero, allow expression to change field values in
row.
int dbex_free(Expression *e)
free database expression e
int dbex_evalstr(Dbptr db, char *s, int type, void *v)
evaluate string s as an expression for database row
db, convert result to type, return result v
long dbfind(Dbptr db, char *string, int flags, Hook **hook)
search for row matching string in view db, where
string is regular expression, Datascope expression,
or plain string. if flags&1, search backward.
int dbstrtype(Dbptr db, char *s)
return strREAL, strINTEGER, strNULL, strSTRING, strTIME, strEXPR, strFIELD, or strUNKNOWN, indicating how s might be evaluated
External Files
int dbextfile(Dbptr db, char *table, char *p)
compose path p using dir and dfile from database
row db; specify table when view db contains multiple
tables with dfile.
int dbfilename(Dbptr db, char *filename)
compose filename from dir/dfile in database row db,
creating directories if needed
Managing Ancillary Information
int dbquery(Dbptr db, int code, void *value)
return variety of information for database pointer db
(see Datascope Constants)
Tbl *dbtables(Dbptr db, char *f)
return list of tables which use field f
int dbcompile(Dbptr db, char *s)
compile some fragment of schema, to add new relations and perhaps attributes to schema
Dbptr dbinvalid()
return database pointer with all elements set to
dbINVALID
long dbnextid(Dbptr db, char *name)
generate unique id for field name of database db
libds : Database Operations
31
Antelope 4.10
libtr : Waveform Manipulation
implements routines for reading and writing waveforms from a database, and performing some standard operations on them.
include "tr.h"
ldlibs=$(TRLIBS)
Trace Objects
Dbptr trnew(char *tr_path, char *schema_name)
create a new trace database
int trcopy(Dbptr *trout, Dbptr trin)
copy trace table from trin to trout, duplicating data
and records
int trfree(Dbptr tr)
free up memory and clear trace object tables
int trdestroy(Dbptr *trp)
close a trace database and free its resources
int trtruncate(Dbptr tr, long n)
truncate a tr database table after record n
Reading and Writing Waveforms
int trgetwf(Dbptr db, Arr **maparr, float **data, long
*datasz, double reqt0, double reqt1, double *t0,
double *t1, long *npts, int (*fill)(), void *pvt)
read waveform data for single record db between
times reqt0 and reqt1 into buffer data, returning
#points npts and actual time range t0 to t1. returns 0
for success
void trgetwf_error(Dbptr db, int code)
add error message to log for trgetwf errors
int trload_css(Dbptr db, char *reqt0, char *reqt1, Dbptr
*trp, char *table, Arr **map)
load waveform data between reqt0 and reqt1 from all
records in database view db into trace table trp
int trload_cssgrp(Dbptr db, char *reqt0, char *reqt1,
Dbptr *trp, char *table, Arr **map)
load waveform data between reqt0 and reqt1 from
pre-sorted database view or bundle db into trace
table trp
Dbptr trloadchan(Dbptr db, double t0, double t1, char *sta,
char *chan)
read waveform data for specified sta and chan from
db for time range t0 to t1
32
libtr : Waveform Manipulation
Programmer Reference
int trloadwf(Dbptr db, double t0, double t1, Dbptr tr)
read waveform data for specified database record
from t0 to t1 into tr
int trsave_wf(Dbptr tr, Dbptr db, char *dt, char *wf, int
flags)
save waveform data from tr to database db creating
waveforms of specified datatype dt in data files
named by trwfname(3) using the pattern wf. trAPPEND flag bit causes data to be appended to existing files; trOVERWRITE flag bit causes data to
overwrite existing files.
int trwfname(Dbptr db, char *wf, char **path)
generate waveform file name for database row db
using specified pattern wf and creating any non-existent directories.
Network, Aux and Loc Code Remapping
Autodrm and SEED introduce extra keys to uniquely identify station
and channel. These extra keys must be mapped into sta and chan to
work with the CSS3.0 schema. These routines implement that mapping.
int finit_db(Dbptr db)
set the database the routines below use to look up
snetsta and schanloc
int refinit_db(Dbptr db)
change the database the routines below use to look
up snetsta and schanloc
int map_autodrm_netsta(char *anet, char *fsta, char
*sta)
map an autodrm net anet and station code fsta to a
CSS3.0 sta code
int autodrm_net(char *sta, char *anet, char *fsta)
return autodrm network code anet and station code
fsta corresponding to CSS3.0 sta code
int map_autodrm_chanaux(char *sta, char *fchan, char
*aux, char *chan)
map an autodrm channel fchan and aux code into a
CSS3.0 chan code for station sta
int autodrm_aux(char *sta, char *chan, char *fchan, char
*aux)
return autodrm channel code fchan and aux code corresponding to CSS3.0 sta/chan
int map_seed_netsta(char *snet, char *fsta, char *sta)
map a SEED net and station code into a CSS3.0 sta
code
libtr : Waveform Manipulation
33
Antelope 4.10
int seed_net(char *sta, char *snet, char *fsta)
return seed network code snet and station code fsta
corresponding to CSS3.0 sta code
int map_seed_chanloc(char *sta, char *fchan, char *loc,
char *chan)
map a SEED channel fchan and loc code into a
CSS3.0 chan code for station sta
int seed_loc(char *sta, char *chan, char *fchan, char *loc)
return seed channel code fchan and loc code corresponding to CSS3.0 sta/chan
Generating Test Data
int trsignal_argv(Dbptr tr, int argc, char **argv)
generate test signal data in a trace table
int trsignal(Dbptr tr, char *params)
generate test signal data in a trace table; params is
split into an argc/argv list
void mksignal(char *type, Trsample *data, double time,
long nsamp, double samprate, double t0, double
freq, double slew, double amp)
generate a signal of a specified type: type may be sin,
cos, sqr, tri, saw, dlt, ran, stp, pkt or dif. creates
floating-point numbers.
void imksignal(char *type, int *data, double time, long
nsamp, double samprate, double t0, double freq,
double slew, double amp)
generate a signal of a specified type. creates integers.
Miniseed and Steim Compression
Msd *msdnew()
create new configuration block for miniseed generation
void msdfree(Msd *msd)
free miniseed configuration block
int msdclose(Msd *msd)
close the file descriptor with msd
int msdget(Msd *msd, int code, void *val, ...)
get a parameter from msd struct
int msdput(Msd *msd, int code, void val, ...)
set a parameter in msd struct
The possible parameter names are:
34
libtr : Waveform Manipulation
Programmer Reference
MSD_ACTIVITY_FLAGS
MSD_CHAN
MSD_CNT
MSD_DATAFORMAT
MSD_FD
MSD_FILENAME
MSD_FIRST_DATA_FRAME
MSD_FRAMES_PER_RECORD
MSD_HAS_B100
MSD_HAS_B1000
MSD_HAS_SEED_HEADER
MSD_IO_FLAGS
MSD_LEVEL
MSD_LOC
MSD_MSEED
MSD_MSEED_NBYTES
MSD_NET
MSD_NSAMP
MSD_OFFSET
MSD_QUALITY_FLAGS
MSD_RECORD_SIZE
MSD_SAMPRATE
MSD_SAMPRATE_FLAGS
MSD_SEQUENCE
MSD_SPARC_ORDER
MSD_STA
MSD_TIME
MSD_TIME_CORRECTION
int msd2wf(Msd *msd, Dbptr db, int (*add_wfdisc)(Dbptr,
char*, char*, Wfdisc*))
reads through a miniseed volume with msdnxt(3),
calls add_wfdisc whenever a new data segment is
found
int msdnxt(Msd *msd)
read header of next input record
int msdrec(Msd *msd, long rec)
read header of input record #rec
int dmsd(FILE *file, Msd *msd, int verbose)
print headers for a miniseed data block (in detail if
verbose=1)
void msdpackhdr(Msd *msd, unsigned char *record)
create a miniseed header in record using info from
msd
int umsd(Msd *msd, int **data, long *npts)
unpack the msd data record, returning the samples
int cmsd(Msd *msd, int (*save_record)(Msd*, long, long),
int *data, long npts)
compress integer data into miniseed
int ustc(Msd *msd, int **data, long *npts)
uncompresses a single Steim level 1 or level 2 miniseed record
int cstc(Msd *msd, int (*save_record)(Msd*, long, long), int
*data, long npts)
compresses the npts input sample data into a miniseed record that is accumulated inside the msd
struct, and written by save_record when full. npts=0
flushes msd.
libtr : Waveform Manipulation
35
Antelope 4.10
int dstc(FILE *file, char *rcd, int nbytes)
prints out a single Steim compressed miniseed
record
Filters
int trfilter(Dbptr tr, char *f)
apply time-domain filters f to trace data tr
int trfilter_segs(int n, int *nsamp, double *dt, float **data,
char *f)
apply time-domain filters f to n waveform segments
int trfilter_pkt(int nsamp, double dt, float *data, char *f,
Hook **hook)
apply time-domain filters f to data, retaining state in
hook
int trrotate(Dbptr tr, double phi, double theta, char
**newchan)
rotate three component data
int rotate_to_standard(Dbptr tr, char **newchan)
rotate three component data to standard orientation
int trapply(Dbptr tr, int (*filter)(), void *pvt)
apply filter routine to each waveform segment
int trapply_calib(Dbptr tr)
multiply waveform data in trace object by calib
value
int trdemean(Dbptr tr)
subtract mean (DC) value from trace
int trdemean_seg(Dbptr tr)
subtract mean (DC) value from trace segment
int trderiv(Dbptr tr)
compute derivative of trace data
int trintegral(Dbptr tr)
integrate waveform segments
Utilities
long trclip(double time, double samprate, long nsamp, double from, double until, long *pt0, long *npts, double
*t0, double *t1)
find sample range corresponding to time range
36
libtr : Waveform Manipulation
Programmer Reference
int trsplit(Dbptr tr, int (*fill)(Dbptr*, Trsample*, long*,
long*, long*), int (*findbad)(Trsample*, long,
char*, Tbl*))
break up waveform records, eliminating marked
missing data
int trsplice1(Dbptr tr, int factor_calib, double tolerance, int
(*fill)(Dbptr *dbp, Trsample *data, long *i0, long
*i1, long *imaxp), int (*resample)(Dbptr*, Trsample*, Trsample*, long, Dbptr*, Trsample*, long*,
double*, double*))
splice together any data segments which fit together,
eliminating overlapping portions. don't splice sections with different calibs together if factor_calib is
0.
int trsplice(Dbptr tr, double tolerance, int (*fill)(Dbptr
*dbp, Trsample *data, long *i0, long *i1, long
*imaxp), int (*resample)(Dbptr*, Trsample*,
Trsample*, long, Dbptr*, Trsample*, long*, double*, double*))
splice together any data segments which fit together,
eliminating overlapping portions. splice sections
with different calibs together, multiplying later values by the ratio of calibs.
double traligned(double atime, double std_time, double
std_samprate)
returns a time properly aligned with a specific time
and sample rate
void trfill_gap(Trsample *data, long nsamp)
fills a data segment with the 'standard' "t4" gap value
long wfchanid(Dbptr db)
lookup chanid for a wfdisc record in the sensor or
sitechan table
long arrchanid(Dbptr db)
lookup chanid for an arrival record in the sensor or
sitechan table
int trlookup_segtype(char *segtype, char **units, char
**desc)
returns units and description for a segtype code
Wftype *trwflist(int i)
return the i'th waveform type
Wftype *trwftype(char *datatype)
get waveform type structure for specified type
libtr : Waveform Manipulation
37
Antelope 4.10
Convenience Macros
double ENDTIME(t0, samprate, nsamp)
return endtime based on input parameters
int NSAMP(t0, samprate, endtime)
return number of samples based on input parameters
double SAMP2TIME(t0, samprate, n)
return a sample time given a sample index
double SAMPRATE(t0, nsamp, endtime)
return samprate based on input parameters
int TIME2SAMP(t0, samprate, t1)
return a sample index given a time
int TRCONTIGUOUS(t0, t1, samprate, nsamp)
test whether a segment of nsamp samples beginning at t0 with sample rate samprate abut to t1,
within the tolerance specified in trdefaults.pf.
int TRSAMERATE(samprate0, samprate1)
test whether certain values of sample rate are the
same to within the tolerance specified in trdefaults.pf.
int TRSAMETICKS(t0, t1, samprate)
test whether two values of time are on the same
tick marks, within the tolerance specified in trdefaults.pf.
int TRSAMETIME(t0, t1, samprate)
test whether two values of time are the same to
within the tolerance specified in trdefaults.pf.
38
libtr : Waveform Manipulation
Programmer Reference
libtrvltm : Travel Times
provides generic interface for various travel time calculators
include "tt.h"
ldlibs=-ltrvltm $(STOCKLIBS)
int ttcalc(char *method, char *model, char *phase, int flags,
TTGeometry *geom, Tbl **times, Hook **hook)
return travel times using specified method and model
for phase given 3d source and receiver in geom
int ucalc(char *method, char *model, char *phase, int flags,
TTGeometry *geom, Tbl **slows, Hook **hook)
return slowness values using specified method and
model for phase given 3d source and receiver in geom
The following routines use the ttcalc and ucalc routines above and the
ttmethod and ttmodel from trvltm.pf.
int arrtimes(double delta, double depth, char ***phases,
double **times)
return all calculated phases and travel times for specified delta (degrees) and depth (km)
int arr_slowness(double delta, double depth, char
***phases, double **slowness)
return all calculated phases and slowness values for
specified delta (degrees) and depth (km)
double phasetime(char *phase, double delta, double depth)
return the arrival time for the specified phase, delta
(degrees) and depth (km)
double phase_slowness(char *phase, double delta, double
depth)
return the slowness value for the specified phase,
delta (degrees) and depth (km)
double pphasetime(double delta, double depth)
return the first P arrival time for specified delta
(degrees) and depth (km)
double pphase_slowness(double delta, double depth)
return the slowness for the first P arrival for specified delta (degrees) and depth (km)
double sphasetime(double delta, double depth)
return the first S arrival time for specified delta
(degrees) and depth (km)
double sphase_slowness(double delta, double depth)
return the slowness for the first S arrival for specified delta (degrees) and depth (km)
libtrvltm : Travel Times
39
Programmer Reference
libresponse : Instrument
Response
routines for reading, writing and evaluating CSS 3.0 response files
include "response.h"
ldlibs=$(STOCKLIBS)
Response *new_response()
initialize a new response object
int get_response(char *filename, Response **rsp)
read response from file filename into rsp
int read_response(FILE *file, Response **rsp)
read a response from open file into rsp
int save_response(char *filename, Response *rsp)
write response rsp to file filename
int write_response(FILE *file, Response *rsp)
write a response to a file
int free_response(Response *rsp)
free memory for a response
void init_response_group(Response_group *gp)
initialize a new Response_group object
int add_response_group(Response *rp, Response_group
*gp)
add a new response stage gp to response rp
int compare_response(Response *r1, Response *r2)
compare two responses r1 and r2, returning 0 if
identical, 1 otherwise
int eval_response(double omega, Response *rsp, double
*r, double *i)
evaluate a response rp at the frequency omega,
returning real and imaginary components r and i.
libresponse : Instrument Response
40
Programmer Reference
liborb : Orbserver Access
routines which implement the orb protocol
include "orb.h"
ldlibs=$(ORBLIBS)
int orbopen(char *name, char *p)
open a connection to the orbserver name, with permission p = "r" or "w", with "&" appended to cause
reconnections; returns orb or -1 for failure
int orbclose(int orb)
close the orbserver connection orb
int orbselect(int orb, char *re)
select packets from orb which match the regular
expression re
int orbreject(int orb, char *re)
reject packets from orb which match the regular
expression re
int orbafter(int orb, double t)
set the read position for connection orb after the
specified time t
int orbposition(int orb, char *w)
set the read position for connection orb according to
string w, which may be an epoch time or "newest" or
"oldest".
int orbseek(int orb, int which)
set the read position for connection orb according to
the which code: ORBPREV, ORBNEXT,
ORBNEXT_WAIT, ORBOLDEST, ORBNEWEST.
int orbresurrect(int orb, int *last_pktid, double *last_t)
sets up and uses a bury(3) state file to save and
restore a packet position for the connection orb.
Reading
int orbget(int orb, int which, int *pktid, char *srcname, double *time, char **pkt, int *nbytes, int *bufsize)
get packet which from orb, returning pktid, srcname,
time, and nbytes of data pkt. size of buffer pkt is
adjusted as needed; pktid may be explicit pktid or
ORBPREV, ORBNEXT, ORBNEXT_WAIT,
ORBOLDEST, ORBNEWEST.
liborb : Orbserver Access
41
Programmer Reference
int orbgetstash(int orb, char *srcname, double *time, char
**packet, int *nbytes, int *bufsize)
get stash packet for srcname
int orbreap(int orb, int *id, char *nm, double *t, char **p,
int *n, int *sz)
read next packet from orb, returning standard packet
information
int orbreap_nd(int orb, int *id, char *nm, double *t, char
**p, int *n, int *sz)
read next packet from orb, returning standard packet
information, or ORB_INCOMPLETE if no packet
is available
int orbreap_timeout(int orb, int sec, int *id, char *nm,
double *t, char **p, int *n, int *sz)
read next packet from orb, returning standard packet
information, or ORB_INCOMPLETE if no packet
is available after sec seconds
Writing
int orbput(int orb, char *srcname, double time, char
*packet, int nbytes)
write the nbytes of packet data onto orb with specified
srcname and time
int orbputx(int orb, char *srcname, double pkttime, char
*pkt, int nbytes)
write the nbytes of packet data onto orb with specified srcname and time, waiting for acknowledgement
int orbput_nolag(int orb, char *srcname, double t, char
*packet, int nbytes, LagParams *params)
write to output orb ensuring that certain readers have
read previous packets first, using lag parameter
Status Information
int orbtell(int orb)
return current pktid position for orb
int orbping(int orb, int *version)
verify active connection to orb, returning an orb version number
int orbclients(int orb, double *when, Orbclient **client, int
*nclient)
get list of orb clients
int orbsources(int orb, double *when, Orbsrc **source, int
*nsource)
get list of srcnames available from orb
int orbstat(int orb, Orbstat **orbstat)
get some status information from orb
liborb : Orbserver Access
42
Programmer Reference
double orblag(int orb, char *match, char *reject, Laggards
**laggards)
return stats showing how far behind clients are
void freeLaggards(Laggards *laggards)
free Laggards structure returned by orblag
liborb : Orbserver Access
43
Programmer Reference
libPkt : Orb Packets
Orb packet contain some data and associated srcname and time. The
srcname indicates at least the source and packet structure.
include "Pkt.h"
ldlibs=$(ORBLIBS)
int unstuffPkt(char *srcname, double time, char *packet,
int nbytes, Packet **pkt)
unpack binary packet wth size nbytes and specified
srcname and time into c struct Packet pkt.
void showPkt(int pktid, char *srcname, double time, char
*packet, int nbytes, FILE *file, int mode)
display the input orb packet on output file; mode may
be PKT_TERSE, PKT_PEEK,
PKT_NOSAMPLES, PKT_UNSTUFF or
PKT_DUMP.
void showPktMatch(int pktid, char *srcname, double
time, char *packet, int nbytes, FILE *file, char
*match, int mode)
display matching input orb packets on output file;
mode may be PKT_TERSE, PKT_PEEK,
PKT_NOSAMPLES, PKT_UNSTUFF or
PKT_DUMP.
int stuffPkt(Packet *pkt, char *srcname, double *time, char
**buffer, int *n, int *size)
from c structure pkt, create binary representation of
packet in buffer. returns srcname, time, length of
packet n, and size of buffer (size >= n).
int stuffStashPkt(char *stash, int nstash, char **packet, int
*nbytes, int *packetsz)
stuff input stash into output packet, allocating space
in packet as necessary and returning size nbytes
Packet *newPkt(void)
create a new, empty, initialized Packet structure
void freePkt(Packet *pkt)
free memory associated with a Packet structure
void clrPkt(Packet *pkt)
reset all parameters in a Packet structure
PktChannel *newPktChannel(void)
create a new, empty, initialized PktChannel structure
void freePktChannel(PktChannel *achan)
free memory associated with a PktChannel structure
libPkt : Orb Packets
44
Programmer Reference
void clrPktChannel(PktChannel *achan)
reset all parameters in a PktChannel structure
void join_srcname(Srcname *parts, char *srcname)
create orb srcname
void split_srcname(char *srcname, Srcname *parts)
tear apart orb srcname
PacketType *suffix2pkttype(char *suffix)
return PacketType corresponding to srcname suffix
PacketType *header2pkttype(short hdrcode, short bodycode)
return PacketType corresponding to hdrcode and
bodycode (when no suffix is available).
libPkt : Orb Packets
45
Programmer Reference
libpforbstat : Orb Status
Parameter Files
routines to return parameter-files with orb status
include "pforbstat.h"
ldlibs=$(ORBLIBS)
Pf *pforbstat(int orb, int flags)
return orb-status as a parameter-file
Pf *orbstat2pf(Orbstat *orbstat, int orbversion)
Translate an orbstat structure into a parameter file
Pf *orbsources2pf(double atime, Orbsrc *sources, int
nsources)
Translate an orbsources structure into a parameter
file
Pf *orbclients2pf(double atime, Orbclient *clients, int
nclients)
Translate an orbclients structure into a parameter
file
libpforbstat : Orb Status Parameter Files
46
Programmer Reference
libxtra : Miscellaneous
contains assorted routines which use multiple libraries, and are gathered in one library to avoid complex interdependencies between other
libraries
include "xtra.h"
ldlibs=$(ORBLIBS)
int dbget_calib(char *sta, char *chan, double time, char
*database, double *calib, double *calper, char
*segtype)
lookup calib, calper, and segtype from a dynamic
database
int netstachanloc(int orb, Arr **netstachan, Arr **srcnames)
return net/sta/chan/loc combinations and srcnames
for an orb
int trdisp(Dbptr tr, char *title)
display a trace object in a dbpick-like window
libxtra : Miscellaneous
47
Programmer Reference
libbrttpkt : Packet Processing
utilities for processing ORB waveform packets
include "brttpkt.h"
ldlibs=-lbrttpkt -lgrx -lol $(THREAD) -ltkrtd -lbrttfilter -lbrttutil -ltkbrttplot $(ORBLIBS) $(TKLIBS)
Channel Trace Buffers
Chantracebuf *chantracebuf_new(double tstart, double
tend, double latency, int apply_calib)
create a new channel trace buffer object
int chantracebuf_add(Chantracebuf *cp, PktChannel
*pktchan)
add new data packets to trace-buffer object
int chantracebuf_free(Chantracebuf *cp)
free a channel trace buffer object
Chantraceproc chantraceproc_new(double latency)
create a new channel trace process object
int chantraceproc_addchan(Chantraceproc *cp, char
*netstachan, int (*callback)(), void *pvt, double
tstart, double tend, double latency, int apply_calib)
specify a channel to be processed by a process
object
int chantraceproc_free(Chantraceproc *cp)
free a channel trace process object
int chantraceproc_process(Chantraceproc *cp, int orb)
process data with a channel trace process object
int chantracebuf_filter(void **fil, int *type, Chantracebuf
*icp, Chantracebuf **ocp, char *filspec, int filinit)
apply a filter to a trace-buffer object
Orb Reap/Put Threads
OrbreapThr *orbreapthr_new(int orb, double timeout, int
queuesize)
create a new ORB reap thread that will read from
orb with a read timeout and queuesize slots in the
FIFO
OrbreapThr *orbreapthr_new2(char *orbname, char
*select, char *reject, double tafter, double timeout,
int queuesize)
create a new ORB reap thread that will read from
orb with a read timeout and queuesize slots in the
FIFO
libbrttpkt : Packet Processing
48
Programmer Reference
int orbreapthr_select(OrbreapThr *orbth, char *select)
cause a new orbselect to be processed on a running
ORB reap thread
int orbreapthr_reject(OrbreapThr *orbth, char *reject)
cause a new orbreject to be processed on a running
ORB reap thread
int orbreapthr_after(OrbreapThr *orbth, double after)
cause a new orbafter to be processed on a running
ORB reap thread
int orbreapthr_set_to_stop(OrbreapThr *orbth)
instruct the orbth ORB reap thread to stop from
reading new packets and return immediately
int orbreapthr_is_stopped(OrbreapThr *orbth)
has the orbth ORB reap thread stopped?
int orbreapthr_stop_and_wait(OrbreapThr *orbth)
stop the orbth ORB reap thread from reading new
packets and wait for it to stop
int orbreapthr_destroy(OrbreapThr *orbth)
destroy the orbth ORB reap thread and free all
resources
int orbreapthr_data_available(OrbreapThr *orbth)
check for data availability on the orbth ORB reap
thread
int orbreapthr_set_timeout(OrbreapThr *orbth, double
timeout)
(re)set the read timeout on the orbth ORB reap thread
int orbreapthr_get(OrbreapThr *orbth, int *pktid, char
*srcname, double *time, char **packet, int *nbytes,
int *bufsize)
get the next packet from the orbth ORB reap thread
OrbputThr *orbputthr_new(int orb, int queuesize)
create a new ORB put thread that will write to orb
with queuesize slots in the FIFO
int orbputthr_stop(OrbputThr *orbth)
stop the orbth ORB put thread from writing new
packets
int orbputthr_destroy(OrbputThr *orbth)
destroy the orbth ORB write thread and free all
resources
int orbputthr_put(OrbputThr *orbth, char *srcname, double time, char *packet, int nbytes)
put a packet into the orbth ORB reap thread FIFO for
eventual writing to the ORB
libbrttpkt : Packet Processing
49
Programmer Reference
Packet-Channel Calib Caching
PktChannelCalib *pktchannelcalib_new(char *dbname,
int need_calib, int need_response, int need_site)
create a new packet-channel calib object from
dbname database with need_calib, need_response,
need_site metadata needs
int pktchannelcalib_free(PktChannelCalib *ch)
destroy the ch packet-channel calib object and free
all resources
int pktchannelcalib_get(PktChannelCalib *ch, char
*snet, char *ssta, char *schan, char *sloc, double
time, int check, char *sta, char *chan, double *lat,
double *lon, double *elev, double *calib, double
*calper, char *segtype, Response **response)
get metadata from the ch packet-channel calib object
for snet, ssta, schan, sloc SEED codes at this time and
check the database table access times to see if it is
necessary to reread the database
Packet-Channel Pipe Processing
PktChannelPipe *pktchannelpipe_new(Tbl
*channels_select, Tbl *channels_reject, int maxpkts, int (*callback)(void *private, PktChannel
**pktchan, int queue_code, double gaptime), void
*private)
create a new packet-channel pipe object using
channels_select expressions for selecting channels,
channels_reject expressions for rejecting channels,
maxpkts packets in the time-ordered queue, and
using the user supplied callback function when
packet-channels are ready for processing
int pktchannelpipe_free(PktChannelPipe *pcp)
destroy the pcp packet-channel pipe object and free
all resources
int pktchannelpipe_push(PktChannelPipe *pcp, char
*srcname, double pkttime, char *pkt, int nbytes)
push a new ORB packet onto the pcp packet-channel
pipe object
int pktchannelpipe_flush(PktChannelPipe *pcp)
flush all packet-channels from the pcp packet-channel pipe object
Packet-Channel To Trace Accumulation
libbrttpkt : Packet Processing
50
Programmer Reference
PktChannel2Trace *pktchannel2trace_new(Dbptr
dbmaster, Dbptr dbtrace, Dbptr dbwf, int
need_calib, int need_response, int need_site)
create a new pktchannel2trace object
int pktchannel2trace_free(PktChannel2Trace *pt)
free a pktchannel2trace object
int pktchannel2trace_put_from_db(PktChannel2Trace
*pt, char *sta, char *chan_expr, int calibfrommaster, double tstart, double tend)
fill a pktchannel2trace object from an archive database
int pktchannel2trace_put(PktChannel2Trace *pt,
PktChannel *pchan, int calibfrommaster, double
tstart, double tend)
fill a pktchannel2trace object from an ORB PacketChannel
int pktchannel2trace_get_stats(PktChannel2Trace *pt,
char *sta, char *chan, int *ngood, int *nbad)
determine the numbers of good and gap sample values in a pktchannel2trace object
libbrttpkt : Packet Processing
51
Programmer Reference
libbrttutil : BRTT Utilities
other miscellaneous utilities
include "brttutil.h"
ldlibs=-lbrttutil $(STOCKLIBS)
Pf Parameter Processing
int parse_param(Pf *pf, char *name, int type, int need,
void *val)
parse name parameter from pf parameter file object
of a certain type into val and return an error if need is
set and name with type does not exist; type may be
P_SINT, P_LINT, P_FLT, P_DBL, P_STR,
P_BOOL, P_TBL, P_TBLPF, P_ARR, P_ARRPF
MT-Safe FIFO
Pmtfifo *pmtfifo_create(int maxqueue, int block, int
check)
create a POSIX MT-safe FIFO queue of maximum
size maxqueue, block when the queue is full and check
all subsequent calls to see if the queue still exists
int pmtfifo_set_timeout(Pmtfifo *mtf, double timeout)
(re)set a read timeout on the mtf POSIX MT-safe
FIFO queue
int pmtfifo_destroy(Pmtfifo *mtf, void (*free_value)(void
*ptr))
destroy the mtf POSIX MT-safe FIFO queue and
free all resources
int pmtfifo_push(Pmtfifo *mtf, void *ptr)
push pointer ptr onto the mtf POSIX MT-safe FIFO
queue
int pmtfifo_pop(Pmtfifo *mtf, void **ptr)
pop pointer *ptr from the mtf POSIX MT-safe FIFO
queue
int pmtfifo_unpop(Pmtfifo *mtf, void *ptr)
unpop pointer ptr back onto the mtf POSIX MT-safe
FIFO queue
int pmtfifo_data_available(Pmtfifo *mtf)
check for data availability on the mtf POSIX MT-
safe FIFO queue
int pmtfifo_release_block(Pmtfifo *mtf)
release an existing blocking condition on the mtf
POSIX MT-safe FIFO queue
libbrttutil : BRTT Utilities
52
Programmer Reference
int pmtfifo_release_blocks(Pmtfifo *mtf)
release any existing and all future blocking conditions (i.e. make the FIFO non-blocking) on the mtf
POSIX MT-safe FIFO queue
Time History Utility
BUHistory *buhistory_create(int maxnp, char *tag, char
*filename, char *handle)
create a time history object with maxnp maximum
number of points
int buhistory_free(char *handle)
free a time history object referenced by handle
int buhistory_free_tag(char *tag)
free a time history object referenced by tag
void buhistory_free_history(BUHistory *history)
free a time history object with pointer history
BUHistory *buhistory_get_history(char *handle)
get the time history object pointer corresponding to
handle
int buhistory_add(char *handle, double time, double
value)
add a time-value point to a time history
int buhistory_get_points(char *handle, int *npts, double
**tpts, double **ypts)
get all of the time-value points from a time history
int buhistory_eval(char *handle, double time, double
*value)
evaluate a time history at time
int buhistory_maxmin(char *handle, double *tmin, double *tmax, double *vmin, double *vmax)
get the minimum and maximum time and data
ranges for a time history
Vector Utility
BUVector *buvector_create(int nx, int ny, char *tag, char
*handle)
create a vector object with nx X-values and ny Y-val-
ues
int buvector_free(char *handle)
free a vector object referenced by handle
int buvector_free_tag(char *tag)
free a vector object referenced by tag
void buvector_free_vector(BUVector *vector)
free a time history object with pointer vector
libbrttutil : BRTT Utilities
53
Programmer Reference
BUVector *buvector_get_vector(char *handle)
get the vector object pointer corresponding to handle
BUVector *buvector_read(char *fname, char *tag, int
line_off, int xpos, int ny, int *ypos, int lpos, char
*handle)
create a vector object and fill it by reading an ASCII
file
BUVector *buvector_create_tsamp(int nsamp, double
time, double samprate, double *data, char *tag,
char *handle)
create a vector object and fill it from a time series
waveform
BUVector *buvector_create_response_fap(char *filename, char *tag, char *handle, int *err)
create a vector object and fill it from a instrument
response file
int buvector_resize(char *handle)
resize a vector object
BUVector *buvector_copy(char *in_handle, char *tag,
char *handle)
copy a vector object
int buvector_append(char *handle, int index, double x,
double *y, char *label)
append to a vector object
int buvector_puty(char *handle, int index, double *y, char
*label)
replace a point in a vector object
int buvector_get_point(char *handle, int index, double
*x, double *y, char *label)
get all of the data for a single point in a vector object
int buvector_get_points(char *handle, int *npts, int *ny,
double **xpts, void *vypts, char ***labels)
get all of the data for a all of the points in a vector
object
int buvector_eval(char *handle, double x, double *y)
evaluate a vector object at X-value x
int buvector_maxmin(char *handle, int iy, double *xmin,
double *xmax, double *ymin, double *ymax)
get the minimum and maximum ranges for a vector
object
int buvector_transform_edp(char *handle, double lonr,
double latr)
transform a vector object into equal distance map
projection coordinates
libbrttutil : BRTT Utilities
54
Programmer Reference
libmappts : Map Data Utilities
routines to read various map data formats
include "netcdf.h"
include "gmtmap.h"
include "gshhsmap.h"
ldlibs=-lmappts
NetCDF Format Processing
int netcdf_unstuff_header(unsigned char **stream,
NETCDFHdr **hdr)
Unstuff the file header from a NetCDF file
int netcdf_print_header(NETCDFHdr *hdr, FILE *file)
Print the file header from a NetCDF file
GMT/NetCDF Format Processing
int gmtmap_open(void **handle)
create a GMT map object
int gmtmap_select(void *handle, char *types, char *resolution, double bb_lonwest, double bb_loneast, double bb_latsouth, double bb_latnorth)
select GMT map coordinates of certain types, resolu-
tions and contained witin a lat-lon bounding box
int gmtmap_nextseg(void *handle, int *npts, int *bufsize,
float **lon, float **lat, char *type, int *level)
get the next segment of GMT map coordinates in
*lon and *lat with *npts number of coordinates
GSHHS Format Processing
int gshhs_unstuff_hdr(GSHHSHdr **gshhs, char
**stream)
Unstuff a data block header from a GSHHS file
int gshhs_skip_pts(GSHHSHdr *gshhs, char **stream)
skip over a GSHHS file data block
int gshhsmap_open(void **handle)
create a GSHHS map object
int gshhsmap_select(void *handle, char *types, char *resolution, double bb_lonwest, double bb_loneast,
double bb_latsouth, double bb_latnorth, double
bb_lonref, double bb_latref)
select GSHHS map coordinates of certain types, res-
olutions and contained witin a lat-lon bounding box
libmappts : Map Data Utilities
55
Programmer Reference
int gshhsmap_nextseg(void *handle, int *npts, int *bufsize, float **lon, float **lat, char *type, int *level,
int *antipode)
get the next segment of GSHHS map coordinates in
*lon and *lat with *npts number of coordinates
libmappts : Map Data Utilities
56
Programmer Reference
libproj : Map Projections
Various map projections
include "proj.h"
ldlibs=$(STOCKLIBS)
PJ *pj_init(int argc, char **argv)
select and initialize a cartographic projection
UV pj_fwd(UV val, PJ *proj)
perform a forward cartographic projection
UV pj_inv(UV val, PJ *proj)
perform an inverse cartographic projection
void pj_free(PJ *proj)
free a cartographic projection
libproj : Map Projections
57
Programmer Reference
Map Projections
aea
aeqd
alsk
apian
bipc
bonne
cass
cc
cea
collg
eck1
eck2
eck3
eck4
eck5
eck6
eqc
eqdc
gall
gnom
gs50
gs48
hataea
labrd
laea
leac
lee
lcc
loxim
lsat
mbtfpp
mbtfps
mbtfpq
merc
mill
mil
moll
mtm
nsper
nzmg
ocea
omerc
ortho
parab
poly
putp2
putp5
quau
robin
sinu
stere
tcc
tcea
Albers Equal Area
Azimuthal equidistant
Alaska Mod.-Stereographics
Apian Globular
Bipolar Conic
Bonne
Cassini
Central Cylindrical
Cylindrical Equal Area
Collignon
Eckert I
Eckert II
Eckert III
Eckert IV
Eckert V
Eckert VI
Equidistant Cylindrical
Equidistant Conic
Gall (Stereographic)
Gnomonic
50 State U.S. Mod.-Stereographic
48 State U.S. Mod.-Stereographic
Hatano Asymmetrical Equal Area
Laborde
Lambert Azimuthal Equal Area
Lambert Equal Area Conic
os Lee Oblate Stereographics Pacific
Lambert Conformal Conic
Loximuthal
LANDSAT Space Oblique Mercator
McBryde-Thomas Flat-Polar Parabolic
McBryde-Thomas Flat-Polar Sinusoidal
McBryde-Thomas Flat-Polar Quartic
Mercator
Miller
os Miller Oblate Stereographics Eur-Africa
Mollweides
Mercator Transverse Modifiee (Quebec)
General Vertical Persepective
New Zealand Map Grid
Oblique Cylindrical Equal Area
Oblique Mercator
Orthographic
Caster Parabolic
Polyconic (American)
PutninsP2
PutninsP5
QuarticAuthalic
Robinson
Sinusoidal
Stereographic
Transverse Central Cylindrical
Transverse Cylindrical Equal Area
libproj : Map Projections
58
Programmer Reference
tmerc
tpers
ups
utm
vandg
wink1
Transverse Mercator
Tilted Perspective
Universal Polar Stereographic
Universal Transverse Mercator
Van der Grinten
Winkel 1
libproj : Map Projections
59
Programmer Reference
libtks : Tk Send IPC
provides a c interface to the tcl/tk send IPC mechanism
include "tks.h"
ldlibs=-ltks $(X11LIBS) -lposix4
TkSend *Tks_Create(Display *display, Window window,
int version)
optionally connect to X-server and create communication window
int Tks_Send(TkSend **tksptr, char *name, char *msg,
char **response, int async)
send a message via the tksend IPC mechanism
int Tks_Reply(TkSend *tks, char *reply)
return a reply to an application that has just sent a
message
int Tks_GetmsgEventProc(TkSend *tks, XEvent *event,
char **msg_ptr, int *replyrequest)
process an X-event that may contain a message
int Tks_ValidateName(TkSend *tks, char *name, char
*disposition, int *version)
validate an application name
char *Tks_SetAppName(TkSend *tks, char *name)
set an application name in the X registry
int Tks_ClearAppName(TkSend *tks, char *name)
clear an application name from the X registry
void Tks_SetVerbose()
turn on tksend verbose mode
libtks : Tk Send IPC
60
Programmer Reference
libwffil : Filter Waveforms
provides a c interface to general purpose time-domina waveform filtering with user-written dynamic link libraries to implement the filters
include "wffil.h"
ldlibs=$(STOCKLIBS)
int wffil_define_filters(char *pfname, void *user_data)
define new filter methods
int wffil_parse_filter(void *user_data, char *filter_string)
parse a filter specification
int wffil(void *user_data, char *filter_string, double
gap_tolerance, int *nsamps, double *tstart, double
*dt, float **data, int *data_size, char *input_units,
char *output_units, Hook **state)
filter data in place
libwffil : Filter Waveforms
61
Programmer Reference
libwffilave : Averaging Filters
example of extension filters for libwffil
ldlibs=$(STOCKLIBS)
int wffilave_filter(void *user_data, char *filter_string,
double gap_tolerance, int *nsamps, double *tstart,
double *dt, float **data, int *data_size, char
*input_units, char *output_units, Hook **state)
filter data in place
libwffilave : Averaging Filters
62
Programmer Reference
libwffilbrtt : BRTT Filters
provides a c interface to BRTT time-domain waveform filtering using
digital recursion filters
ldlibs=$(STOCKLIBS)
int wffilbrtt_filter(void *user_data, char *filter_string,
double gap_tolerance, int *nsamps, double *tstart,
double *dt, float **data, int *data_size, char
*input_units, char *output_units, Hook **state)
filter data in place
libwffilbrtt : BRTT Filters
63
Programmer Reference
Fortran Interfaces
Database Operations
declarations for variables used below:
include "db.i"
integer db(4)
char record(*)
character table_name, field_name
character s
integer expression # expression is pointer to compiled expression
integer type
integer pattern1, pattern2, nojoin # pattern1 and pattern2 are
pointers to Tbl lists
integer outer
character name(*)
integer dbadd(db, record)
add a record to a table
integer dbadd_remark(db, remark)
add a remark to CSS database tables
integer dbaddv(db, table_name, field_name, value1, ...)
write values to fields in a new database row
integer dbcrunch(db)
crunch out null rows in database
integer dbdelete(db)
delete rows from database tables
integer dbdestroy(db)
remove all base tables for a database
integer dbex_compile(db, s, expression, type)
compile a database expression
integer dbex_eval(db, expression, setflag, result)
evaluate a database expression for a record
integer dbex_free(expression)
free memory for a database expression
integer dbextfile(db, tablename, filename)
compose filename from database record
integer dbget(db, s)
get ascii tables, records, or fields from a database
integer dbget_remark(db, remark)
get a remark from CSS database tables
integer dbgetv(db, table_name, field_name, value1, ...)
read values from fields in a database
Fortran Interfaces
64
Programmer Reference
subroutine dbjoin(dbresult, db1, db2, pattern1, pattern2,
outer, nojoin, name)
join two database tables
subroutine dblookup(dbr, db, database, table, field, record)
lookup database pointer indexes from ascii names
integer dbmark(db)
mark rows for deletion
integer dbnextid(db, name)
generate unique id from the lastid table
integer dbopen(name, opentype, db)
open a database
integer dbopen_database(name, opentype, db)
open a database or table pathname
integer dbopen_table(name, opentype, db)
open a database or table
integer dbput(db, s)
put ascii tables, records, or fields into a database
integer dbputv(db, table_name, field_name, value1, ...)
write values to fields in a database
subroutine dbquery(db, code, value)
get ancillary information about a database
subroutine dbsort(result, db, tbl, flag, name)
create a sorted view
subroutine dbsubset(result, db, s, name)
create a subset view
integer dbtruncate(db, nrows)
truncate a database table to specified length
integer dbunjoin(db, database_name, rewrite)
create new tables from a joined table
subroutine trgetwf(db, 0, data, NMAX, t0_req, t1_req, t0,
t1, npts, fill, fill_value)
read trace data from file into memory
Spatial Transformations
subroutine dist(lat1, long1, lat2, long2, delta, azimuth)
compute angular distance and azimuth between two
points (all in radians)
subroutine latlon(lat1, long1, del, azimuth, lat2, long2)
compute lat and long given starting point and distance (all radians)
Fortran Interfaces
65
Programmer Reference
Time Transformations
subroutine doy2mday(doy, year, month, day)
convert day of year to month and day
subroutine e2h(epoch, iyear, iday, ihour, imin, sec)
split epoch time into output components
real *8 epoch(yearday)
convert yearday to epoch time
subroutine epoch2str(s, e, f)
convert epoch time to formatted string
real*8 h2e(year, day, hour, min, sec)
convert input parameters to epoch time
integer mday2doy(year, month, day)
convert month and day to day of year
double now()
return current epoch time
real *8 str2epoch(s)
convert string to epoch time
subroutine strdate(s, e)
convert epoch time to string date
subroutine strtime(s, e)
convert epoch time to string time
integer yearday(e)
convert epoch time to yearday
Error Handling
subroutine clear_register(printflag)
clear the error register
subroutine complain(sysflag, msg)
log an error message and print
subroutine die(sysflag, msg)
log an error message and die
subroutine register_error(sysflag, msg)
register an error message
General Programming Utilities
subroutine datafile(path, envname, filename)
return path corresponding to either environment
variable envname or file relative to $ANTELOPE/
data
Fortran Interfaces
66
Programmer Reference
subroutine datapath(path, envname, dirname, filename,
suffix)
return path corresponding to either environment
variable envname or dir/file.suffix relative to
$ANTELOPE/data
subroutine isort(a, n, size, compare, pvt)
insertion sort routine
integer newdata(pathname, envname, dirname, filename,
suffix)
construct pathname for a new datafile
subroutine shellsort(a, n, size, compare, pvt)
shell sort implementation
integer ssearch(key, keysize, a, n, unique, compare, pvt, ns,
ne)
binary search of index
Niceplot
subroutine axis(xdim, ydim, xmarg, ymarg, xlow, ylow,
xmax, xmin, ymax, ymin, dxsmal, dxnumb, dysmal,
dynumb, fmtx, fmty, labelx, labely, title, iclear)
draw a box with tic marks and labels
subroutine box(xleft, xright, ybot, ytop, thick, ithick, iclip)
draw a box
subroutine cfont(integer jfont)
change font
subroutine chrdir(real angle)
change text labelling direction
subroutine chrsiz(height, ratio, slant)
change size and slant of text labelling
subroutine circle(xc, yc, r, narc, iclose, iclip, thick, ithick)
draw a circle
subroutine clear()
clear the window
subroutine clrrgn(xmn, xmx, ymn, ymx)
clear a region in the window
subroutine cpyrgn(xmn, xmx, ymn, ymx)
copy a region from the pixmap to the window
subroutine cursor(x, y, chr)
reads in the cursor position upon keypress
subroutine finitt()
finish plotting
subroutine fplot(n, x, y)
fast plotting routine
Fortran Interfaces
67
Programmer Reference
subroutine getchr(c, nstrks, npoint, ioff, ix, iy)
compute the outline of a character
subroutine getsiz(c, ihite, iwidth)
compute the size of a character
subroutine initt(itran, plotfile, display, program, ssize, xwin,
ywin)
initialize window
subroutine laxis(xdim, ydim, xmarg, ymarg, xlow, ylow,
xmax, xmin, ymax, ymin, dysmal, dynumb, fmty,
labelx, labely, title, iclear)
draw log-linear axes
subroutine line(x1, y1, x2, y2, thick, ithick, iclip)
draw a line
subroutine llaxis(xdim, ydim, xmarg, ymarg, xlow, ylow,
xmax, xmin, ymax, ymin, labelx, labely, title, iclear)
draw log-log axes
subroutine ltype(integer n)
set line type
0 - solid
1 - dotted
-dashed
-dashed
-dashed
subroutine ncontour(nx, nxmax, ny, x, y, z, ctype, zmin,
zmax, dz)
render a contour map
subroutine nplot(n, x, y, igraf, iclip, thick, ithick, asymb)
plot a set of points
subroutine ntype(xtype, ytype)
define plot scales
subroutine plot1(n, x, y, roff, iclip)
plot a curve
subroutine sclsiz(real*4 scale)
scale character sizes
subroutine setbac(hue, light, sat)
set background color
subroutine setbg(character *(*) color)
set background color
subroutine setcursor(type, param1, param2)
set the appearance of the graphics cursor
subroutine setdim(xdim, ydim, xlow, ylow)
set plotting area dimensions
Fortran Interfaces
68
Programmer Reference
subroutine setfg(character *(*) color)
set foreground color
subroutine setfor(hue, light, sat)
set foreground color
subroutine setscl(xmin, xmax, ymin, ymax)
set plotting area scaling
subroutine text(x, y, angle, iref, string, iclip)
plot a text string
subroutine tics(x1, y1, x2, y2, stic, ntic, dtic, tlen, thick, idir)
plot tic marks
subroutine trackcursor(external track(x, y))
calls routine track with coordinates x, y as cursor
moves
subroutine trackcursoroff()
disables cursor tracking callback routine
subroutine xmap(real x)
convert from plotting to raster units
subroutine ymap(real y)
convert from plotting to raster units
Lists
integer maxtbl(itbl)
return the number of elements in a list
subroutine strfreetbl(itbl)
free memory associated with a list
subroutine strgettbl(itbl, i, s)
copy the i'th string from a list to a FORTRAN string
subroutine strputtbl(itbl, i, s)
copy a string to the i'th element of a list
subroutine strtbl(itbl, s, ...)
create a new list from a list of strings
Parameter Files
subroutine pfcompile(string, pf, retcode)
read a parameter file from a string
subroutine pffree(pf)
free resources for a parameter space
subroutine pfget(pf, name, result, retcode)
get a value from a parameter file
subroutine pfget_arr(pf, name, iresult)
get an associative array from a parameter file
subroutine pfget_boolean(pf, name, iresult)
get a boolean value from a parameter file
Fortran Interfaces
69
Programmer Reference
subroutine pfget_double(pf, name, fresult)
get a double precision value from a parameter file
subroutine pfget_int(pf, name, iresult)
get an integer value from a parameter file
subroutine pfget_string(pf, name, svalue)
get a string value from a parameter file
subroutine pfget_tbl(pf, name, iresult)
get an ordered list from a parameter file
subroutine pfnew(type, result)
start a new parameter space
subroutine pfput(pf, name, value, type)
put a value into a parameter space
subroutine pfput_arr(pf, name, value)
put an associative array into a parameter space
subroutine pfput_boolean(pf, name, value)
put a boolean value into a parameter space
subroutine pfput_double(pf, name, fvalue)
put a double precision value into a parameter space
subroutine pfput_int(pf, name, value)
put an integer value into a parameter space
subroutine pfput_string(pf, name, svalue)
put a string value into a parameter space
subroutine pfput_tbl(pf, name, value)
put an ordered list into a parameter space
subroutine pfread(name, pf, retcode)
read a parameter file
subroutine pfwrite(pf, filename, retcode)
write a parameter file object to the specified file
Seismic Information
integer arrtimes(delta, depth, phases, times)
returns all the calculated phases
integer grname(grn)
return the name of a Flinn-Engdahl geographic
region
integer grnumber(lat, lon)
return the Flinn-Engdahl geographic region number
real*8 phasetime(phase, delta, depth)
returns the time for a specified phase
real*8 ptime(delta, depth)
returns the first P arrival
Fortran Interfaces
70
Programmer Reference
integer srname(srn)
return the name of a Flinn-Engdahl seismic region
integer srnumber(grn)
return the Flinn-Engdahl seismic region number
real*8 stime(delta, depth)
returns the first S arrival
Fortran Interfaces
71
Appendices
Contents
ANTELOPEMAKE ........................................... 1
Schemas.......................................................... 3
Datascope Constants ...................................... 5
Expression Calculator...................................... 9
Environment variables ................................... 14
Tcl/Tk Extensions .......................................... 17
Waveform Filtering......................................... 18
Parameter Files ............................................. 19
Epoch Format Codes..................................... 20
Acceptable Time Formats.............................. 21
Directory Structure ........................................ 22
Tables Reference
ANTELOPEMAKE
Targets
all
Include
install
uninstall
clean
purge
BIN
DLIB
SLIB
PF
DATA
INCLUDE
MAN
create everything in current directory
install include files only
install everything
uninstall everything
remove all intermediate files
remove .make.state, other files
install executables
install dynamic libraries
install static libraries
install parameter files
install data files
install include files
install man pages
User Macros
BIN
LIB
DLIB
INCLUDE
PF
DATA
DEMO
DOC
MAN1
MAN3
MAN3F
MAN3H
MAN3P
MAN3T
MAN5
executables to install into $(DEST)/bin
static libraries to install into $(DEST)/static
dynamic libraries to install into $(DEST)/lib
include files to install into $(DEST)/include
parameter files to install into $(DEST)/data/pf
data files to install into $(DEST)/data/$(DATADIR)
demos to install into $(DEST)/data/$(DEMODIR)
documents to install into $(DEST)/data/$(DOCDIR)
program man pages for $(DEST)/man/man1
c interface man pages for $(DEST)/man/man3
fortran man pages for $(DEST)/man/man3f
files to install into $(DEST)/man/man3h
perl man pages for $(DEST)/man/man3p
tcl man pages for $(DEST)/man/man3t
format man pages for $(DEST)/man/man5
cflags
fflags
ldflags
ldlibs
special c compilation flags
special fortran compilation flags
special linker flags
libraries to be linked with the executable
DIRS
DEST
SUBDIR
often local
sub directories (in order) into which make descends
installation directory: $(ANTELOPE)$(SUBDIR)
alternate destination hierarchy below $ANTELOPE,
ANTELOPEMAKE
1
Antelope 4.10
Predefined Link Library Macros
STOCKLIBS
DBLIBS
TRLIBS
ORBLIBS
THREAD
X11LIBS
F77LIBS
2
-lcoords -lstock + required libraries
-lds + required libraries
-ltr + required libraries
-lPkt -lorb -lforb + required libraries
multi-threading libraries
X libraries
fortran libraries
ANTELOPEMAKE
Tables Reference
Schemas
The following schemas are included with the Antelope distribution.
autodrm1.0
logs of messages sent and received by autodrm
certify2.0
database of regression tests and results
contacts1.0
phone-numbers and contact names for investigation
of felt reports from earthquakes
css2.8
predecessor to css3.0. See css3.0.
css3.0
Center for Seismic Studies schema version 3.0;
seismic information including waveforms, parametric data, and station details.
css_vel
supports the dblocgrad program
cvs1.0
alternative representation for CVS (Concurrent Version System) log information
Db2sd1.0
additions to css3.0 for generating SEED volumes
dbrecenteqs1.1
expansion of css3.0 and rt1.0 to support web-based
mapping of hypocenters and related information
genloc1.0
extensions of css3.0 to support the genloc program
gmt1.0
schema to track GMT grid files
iceworm1.3
extensions to css3.0 schema for use with the Iceworm system
Id1.0
used by the database id server program dbids
Logs1.0
defines a table to hold log files
models0.4
prototype css3.0 expansion schema to store traveltime models
MWavelet1.1
extension of css3.0 for multiwavelet array-processing
Schemas
3
Antelope 4.10
notify1.2
holds contact information used in earthquake
response procedures
pde
Datascope schema representation of the Preliminary
Determination of Epicenters reports from the
National Earthquake Information Center
places1.2
Describes places on the earth: cities, populated
places, summits etc. Includes support for specifying
polygonal regions.
rt1.0
Depricated: use css3.0 instead
rtexec1.0
supports Antelope real-time executive program
rtexec
statrans1.1
Supports translation of station-names from stationname-only (used by some networks in the past) to
css3.0-compatible station and channel names.
Status1.0
monitoring and maintenance of one or more Antelope real-time systems
strawman1.0
strawman proposal for a schema which fixes some
of the problems with css3.0
takeoff
extensions to css3.0 used for focal mechanisms and
theoretical travel-times
tcpmonitor1.0
keep TCP link statistics
Trace4.0
trace manipulation and processing database; provides the parameter information needed during standard processing of seismic waveform data, and their
representation in memory.
USGS_pde1.0
USGS 1995 format for Preliminary Determination
of Epicenters
wfrecords1.0
schema for cataloging non-digital records, e.g. helicorder paper
4
Schemas
Tables Reference
Datascope Constants
Dbptr Values
A database pointer has four elements: database, table, field and
record. Each of these elements takes on a nonnegative integer value to
refer to a specific database, table, field or record, but may also take
one of the following special values:
dbINVALID
error indication
dbALL
all tables, all fields, or all records
dbSCRATCH
scratch record for a table or view
dbNULL
null record for a table or view
Routine Flags
dbOUTER_JOIN
set to force join of every record in first table
dbSORT_UNIQUE
set to cause the result to contain only one record for
each unique set of sort key values
dbSORT_REVERSE
reverse the sense of the sort
Dbquery Codes
dbSCHEMA_NAME
schema name
dbSCHEMA_DESCRIPTION
short description for schema
dbSCHEMA_DETAIL
long description for schema
dbSCHEMA_DEFAULT
return the schema used for databases lacking a
descriptor file.
dbSCHEMA_TABLES
return a Tbl list of all the relations in the schema
dbSCHEMA_FIELDS
return a Tbl list of all the attributes in the schema
dbLINK_FIELDS
return a Tbl list of all id attributes in the schema
dbTIMEDATE_NAME
name of attribute automatically filled with current
time when record is changed
Datascope Constants
5
Antelope 4.10
dbLASTIDS
returns Arr array of lastid by table name, for tables
with added records
dbDATABASE_DESCRIPTION
short description for database
dbDATABASE_DETAIL
short description for database
dbDATABASE_NAME
database name
dbDATABASE_FILENAME
return the name of database descriptor file
dbDATABASE_IS_WRITABLE
return non-zero if database was opened with permission "r+"
dbIDSERVER
return the name of the idserver, or 0 if not used
dbLOCKS
returns value of DBLOCKS
dbDATABASE_COUNT
count of databases open
dbDBPATH
return the path along which database tables may be
found
dbTABLE_COUNT
count of relations in database
dbTABLE_NAME
relation name
dbTABLE_DESCRIPTION
short description for relation
dbTABLE_DETAIL
short description for relation
dbTABLE_FILENAME
return complete path for file holding table
dbTABLE_DIRNAME
return the directory path for the table
dbTABLE_PRESENT
return non-zero if table has at least one record
dbTABLE_SIZE
return total size in bytes of a table
dbRECORD_COUNT
count of records in table
6
Datascope Constants
Tables Reference
dbRECORD_SIZE
return size in bytes of a record in the table
dbTABLE_FIELDS
return a Tbl list of the fields in the table
dbFIELD_COUNT
count of attributes in relation
dbTABLE_IS_WRITABLE
return non-zero if table is writeable
dbTABLE_IS_ADDABLE
return non-zero if locks and permissions allow adding records
dbTABLE_IS_TRANSIENT
return non-zero if table has no actual file
dbPRIMARY_KEY
return the primary key for a table
dbALTERNATE_KEY
return the alternate key for a table
dbFOREIGN_KEYS
return any foreign keys in the table
dbUNIQUE_ID_NAME
return name of id defined by the table, if any
dbTABLE_IS_VIEW
returns non-zero if table is a view
dbVIEW_TABLE_COUNT
return the number of relations participating in the
view
dbVIEW_TABLES
return a Tbl list of tables which are present in the
view
dbFIELD_BASE_TABLE
return the base table for the field
dbFIELD_NAME
attribute name
dbFIELD_DESCRIPTION
short description for attribute
dbFIELD_DETAIL
short description for attribute
dbFIELD_RANGE
return the expression which defines the valid range
of values for a field
Datascope Constants
7
Antelope 4.10
dbFIELD_FORMAT
return printf format string used to save attibute value
into database
dbFIELD_SIZE
return size in bytes of an attribute
dbFIELD_TYPE
return type of an attribute:
dbBOOLEAN
dbDBPTR
dbINTEGER
dbREAL
dbTIME
dbYEARDAY
dbSTRING
dbFIELD_UNITS
return units for an attribute (not used by Datascope)
dbFIELD_INDEX
return the offset in bytes of a field into a record
dbFIELD_TABLES
return a Tbl list of tables which contain the field
8
Datascope Constants
Tables Reference
Expression Calculator
Aggregate Functions
count()
count records in a group or table
count_table()
count records in a table
max(expr)
find the maximum of the expression in a group or a
table
max_table(expr)
find the maximum of the expression in a table
min(expr)
find the minimum of the expression in a group or a
table
min_table(expr)
find the minimum of the expression in a table
sum(expr)
add an expression across a group or a table
sum_table(expr)
add an expression across a table
record()
return the Datascope record number
Arithmetic Functions
abs(x)
absolute value
atan(x,y)
arctangent of angle from x-axis to point (x,y)
ceil(x)
next integer >= x
cos(x)
cosine of x in degrees
exp(x)
e^x
floor(x)
next integer <= x
int(x)
floor(abs(x))*sign(x)
log(x)
natural logarithm
Expression Calculator
9
Antelope 4.10
log10(x)
base 10 logarithm
max(x,y)
maximum of x,y
min(x,y)
minimum of x,y
sign(x)
1 if x>0, -1 if x<0, 0 otherwise
sin(x)
sine of x in degrees
sqrt(x)
square root
tan(x)
tan of x in degrees
Time Conversion
date2e(year, month, day, seconds)
convert to epoch time
epoch(jdate)
convert from jdate to time
now()
the current epoch time
strdate(epoch)
convert time to date string
strtdelta(epoch)
convert time difference to string
strtime(epoch)
convert time to string
strydtime(epoch)
convert time to string with yearday
epoch2str(epoch,format[,timezone])
convert time to string using format, optionally for a
timezone
yearday(epoch)
convert from epoch time to yearday (jdate)
Flinn-Engdahl Regions
grname(lat,lon)
geographic region name
grn(lat,lon)
geographic region number
srname(lat,lon)
seismic region name
10
Expression Calculator
Tables Reference
srn(lat,lon)
seismic region number
Seismic Travel Times
pphasetime(delta,depth)
ptime(delta,depth)
elapsed time for first p-arrival from event at delta,
depth
sphasetime(delta,depth)
stime(delta,depth)
elapsed time for first s-arrival from event at delta,
depth
phasetime(phase, delta, depth)
elapsed time for specified phase for event at delta,
depth
parrival()
time of first p-arrival
sarrival()
time of first s-arrival
arrival(phase)
arrival of specified phase
phase_arrival(velocity)
time of phase arrival, given velocity in degrees/second
pphase_slowness(delta,depth)
slowness of first p-arrival from event at delta, depth
sphase_slowness(delta,depth)
slowness of first s-arrival from event at delta, depth
phase_slowness(phase, delta, depth)
slowness for specified phase for event at delta, depth
Spherical Geometry
azimuth(lat1, lon1, lat2, lon2)
azimuth from point 1 to point 2
distance(lat1, lon1, lat2, lon2)
distance in degrees between two points
latitude(lat, lon, distance, azimuth)
latitude of the point a distance away from (lat,lon) in
the direction azimuth
longitude(lat, lon, distance, azimuth)
longitude of the point a distance away from (lat,lon)
in the direction azimuth
Expression Calculator
11
Antelope 4.10
km2deg(km)
convert kilometers to (nominal) degrees
deg2km(deg)
convert degrees to (nominal) kilometers
Strings
substr(str,x0,n)
null("fieldname")
strlen(sta)
External Files and Commands
concatpaths(dir,dfile)
dirname(path)
basename(path)
["wc" extfile()]
execute a unix command, as in this example
extfile([ table ])
generate the complete path for an external file
Operators
+
-
arithmetic addition
arithmetic subtraction
*
^
arithmetic multiplication
exponentiation
/
%
arithmetic division
arithmetic modulus
>>
<<
bit shift right
bit shift left
.
string concatenation
:=
assignment
"
'
_
surrounds a string expression
surrounds a string expression
surrounds a time expression (suitable for str2epoch)
expr ? a : b
conditional expression: evaluates to a when expr is
true, b when expr is false.
Pattern Matching
A =~ /regular-expression/
regular expression match
12
Expression Calculator
Tables Reference
A !~ /regular-expression/
regular expression does not match
patsub(old, pattern, replacement)
replaces the first pattern matched in old with
replacement
Relational Operators
==
!=
equals
not equal to
a == NULL
true if field a has the null value for that field
a != NULL
true if field a does not have the null value for that field
<
<=
less than
less than or equal to
>
>=
greater than
greater than or equal to
||
&&
logical or
logical and
|
&
bitwise or
bitwise and
Expression Calculator
13
Antelope 4.10
Environment variables
The following environment variables may be used to change the
default Antelope behavior. See antelopeenv(5) for more information.
ANTELOPE
identifies the Antelope base directory, eg, "/opt/
antelope/4.10"
ANTELOPEMAKE
specifies file with standard make(1) rules for Antelope
BNS_RESEND
# of packets to resend when orbput fails and reconnects; default 1
BNS_TIMEOUT
overrides the default timeout used by Antelope routines on orb socket connections (and other sockets
handled by bns(3) routines).
DATAPATH
overrides the default directory $ANTELOPE/data
where Antelope programs find a variety of data files.
EDITOR
XEDITOR
specify an editor to use when editing pf files from
rtm
ELOG_DELIVER
list of error message destinations: filenames,
"stderr" or "stdout", or "orb:hostname:port".
ELOG_DEBUG
when set, a debugger is started for program faults
ELOG_SIGNALS
signals for which handlers are set up; default is
"ILL:TRAP:FPE:BUS:SEGV:SYS". if null, don't
install any handlers.
ELOG_MAXMSG
maximum number of messages allowed on the error
log. If zero, no limit.
14
Environment variables
Tables Reference
ELOG_TAG
tag prepended to each message; see elog.pf for
default.
%a argument list
%h host name
%p pid
%P program name
%r complete path to program
%t local time tag, eg "Thu May 29 15:27:59 1997"
%T thread id
-149 21:27:59"
EUROPEAN_DATE
when set, interpret dates like xx/xx/xx as day/
month/year. various output formats are also changed
equivalently; see time_formats.pf for alternative.
FORBRECVTIME
when set, record time packet is received in forb(5)
files
GRX_PSCOLOR
affects niceplot hardcopy output, eg from dbpick:
full full color PostScript fore color PostScript
for contour images, but background is white color
color PostScript only for color contour images unset
grayscale or black&white output
GRX_FONTPATH
overrides the default location $ANTELOPE/data/
fonts.bin for the binary font file used by niceplot
ORB_IP_ADDRESS
cause orb client connections to bind to the specified
ip address
PFPATH
overrides the default path to parameter files:
"$(ANTELOPE)/data/pf:."
SCHEMA_DEFAULT
overrides the default schema (css3.0) to use when
no descriptor file is present.
SCHEMA_DIR
overrides the default location ($(ANTELOPE)/data/
schemas) for Datascope schema files
TTMETHOD
override default travel time method (tttaup)
TTMODEL
override default travel time model (iasp91)
Environment variables
15
Antelope 4.10
TAUP_PATH
TAUP_TABLE
override the default directory $(ANTELOPE)/data/
tables/taup_ttimes for the tau-p travel time tables
and the default tau-p model iasp91
16
Environment variables
Tables Reference
Tcl/Tk Extensions
% man tcl_packages
atcl
Tcl shell
awish
Tk shell
package require XXX
Tclx
Tkx
extended tcl/tk -- variety of extensions to unix functions
BLT
primarily 2d graphics
Itcl
object oriented extensions
Itk
object oriented widget extensions
Iwidgets
extended widgets
Brttplot
extensions for drawing graphs on a tk canvas.
Datascope
Datascope database extensions
Dbe
extensions for implementing dbe
Orb
extensions for reading and writing to an orbserver
Pixmap
extension for pixmaps (used in dbevents)
Rtd
extension for real time trace display
Rtm
extensions for implementing rtm
Ttgrid
extensions for the time travel grid file used by orbassoc and dbgrassoc
Vogle
3-d graphics extension for "Very Ordinary Graphics
Library"
Tcl/Tk Extensions
17
Antelope 4.10
Waveform Filtering
A variety of time domain waveform filter routines are available across
Antelope programs and routines. A filter spec is made by combining
the filter names (and associated parameters) defined below.
Standard Filters
BW lowfreq loworder highfreq highorder
General bandpass Butterworth minimum phase filter.
BWZ lowfreq loworder highfreq highorder
General bandpass Butterworth zero phase filter.
WAA [nominal]
Wood-Anderson instrument filter for acceleration sensor
WAV [nominal]
Wood-Anderson instrument filter for velocity sensor
WAD [nominal]
Wood-Anderson instrument filter for displacement sensor
INT [n|sfreq]
Integration
INT2 [sfreq]
Double integration
DIF [n]
Differentiation
DIF2
Double differentiation
DEMEAN
Demean waveform
G fac1 [fac2 [...]] [segtype]
Apply gain factor
Simple Averaging Filters
AVE twin[toffset]
Boxcar average waveform
ABS
Compute waveform absolute value
SQ
Compute waveform square value
SQRT
Compute waveform square root value
18
Waveform Filtering
Tables Reference
Parameter Files
PFPATH
combine all parameter files found along PFPATH or
$ANTELOPE/data/pf:.
&Tbl{
ordered list of values
&Arr{
key/value pairs
&ask(prompt) ask for the value using prompt
&Literal{
everything until matching closing bracket: {[(<`'>)]}
&Undef{}
eliminate previous value
&exec(cmd)
result from executing cmd
&file(path)
contents of path
&filename(path) path filename
&datafile(path) contents of data file $ANTELOPE/data/path
&datafilename(path) $ANTELOPE/data/path
&env(name)
value of environment variable name
&ref(pf, key) look up key in parameter file pf
&glob(glob)
list of paths matching glob
&reference
use another value from this parameter file
&{reference} use another value from this parameter file
&user-function(args) write your own function
__DATA__
__END__
__EOF__
end of the parameter file
end of the parameter file
end of the parameter file
Example
Try with "pfecho -i"
# comment
"key with spaces"
value # comment
list
&Tbl{
1
2
}
array
&Arr{
three
3
one
1
}
literal &Literal{
proc a {b} { # example
puts hi
}
}
sta
AAK
date
&exec(date +%Y-%j)
pfnames
&glob(*.pf)
name
&{sta}.&date
antelope
&env(ANTELOPE)
Parameter Files
19
Antelope 4.10
Epoch Format Codes
The two character combinations on the left in the list below are
replaced by the value indicated on the right by the epoch(1) command
and the epoch2str(3) function.
%%
%
%B
month
%b
abbreviated month
%D
date as %m/%d/%y
%d
day of month (01-31)
%a
abbreviated day of week
%A
day of week
%E
epoch time to milliseconds (xxxxxxxxxxx.xxx)
%e
day of month (1-31)
%H
hour (00-23)
%I
hour (01-12)
%j
day number of year (001-366)
%k
hour ( 0-23)
%l
hour ( 1-12)
%L
month number ( 1-12)
%M
minute (00-59)
%m
month number (01-12)
%n
(linefeed)
%o
ordinal day of month ("1st", "2nd", "23rd")
%O
ordinal day of year ("1st", "2nd", "365th")
%p
AM or PM, whichever is appropriate
%S
seconds (00-59)
%s
milliseconds (000-999)
%t
(tab)
%u
tens of microseconds (00000-99999)
%Y
year including century (eg, 1988)
%y
year within century (00-99)
%Z
timezone code
%z
timezone code
Example:
% epoch +"%a %b %d %H:%M" now
Thu Nov 30 23:09
% epoch +"wf/%Y-%j" now
wf/2000-335
20
Epoch Format Codes
Tables Reference
Acceptable Time Formats
All the following representations for
August 9 1993 1:34
are acceptable. The order of the fields doesn't matter.
9 Aug 1993 1:34:56.789 am
8/9/93 1:34:56.789
8/9/1993 1:34:56.789
1:34:56.789 8/9/1993
Aug 09 93 1:34:56.789
AUG 9 93 1:34:56.789
9 August 1993 1:34:56.789
1993221 1:34:56.789
1993 (221) 1:34:56.789
744860096.789
744860096
1993 (221) 1:34
9 August 1993 1:34:56.789
1993221 1:34:56.789
1993221:1:34:56.789
1993221:1:34:56.789
1993:221:1:34:56.789
1993:221:1:34:56:789
1993 (221) 1:34:56.789
1993:aug:9:1:34:56.789
1993-221 1:34:56.789
1993-08-09 1:34:56.789
The string "now" indicates the current time.
A leading + (plus) or - (minus) sign indicates
a time relative to now:
now
-1:00
-0:00:10
+0:15
To specify a previous day, use -Ndays:
2:00 -1day
-10days 13:35
Acceptable Time Formats
21
Antelope 4.10
Directory Structure
/opt/antelope/
perl*
tcltk*
data
/rtdemo
/db
perl release
Tcl/Tk release
demo realtime data
demo databases
/opt/antelope/4.10
antelope.html
Changes
bin
data
/doc
/instruments
/maps
/pf
/perl
/pkt
/responses
/schemas
/system
/tables
/tcl
/www
demo
doc
example
include
/antelopemake
lib
man
/html
patches
patched
README
Release
setup.csh
setup.sh
master guide to documentation
list of changes for current release
executable programs
program data
files related to documentation
data files for dbbuild
map databases and images
parameter files
perl extensions
packet library source code
datalogger and sensor responses
schema descriptions
restart on boot scripts
travel time tables
tcl extensions
web related data files
real time demos
miscellaneous Antelope documention
Antelope source examples
include files for program development
Antelope make rules
libraries
man pages
html version of man pages
patches in tar format
descriptions of applied patches
introductory information about Antelope
compilation information about release
sets up csh shell environment variables
sets up bourne shell environment variables
Real Time Directory
bin
db
dbmaster
logs
orb
pf
rtexec.pf
rtsys
state
22
special executables
dynamic database tables and waveform data
"static" database tables like site
program log files
ring buffer files
parameter files
real time system configuration file
process database used by rtexec
files preserving state between program executions
Directory Structure
© Copyright 2026 Paperzz