SeedLink
SeedLink is a TCP/IP-based data transmission protocol that allows near-real-time access to data from thousands of geophysical monitoring instruments. See data keywords list and channel id syntax for options.
SeisBase.seedlink
— Functionseedlink(mode, chans)
See seedlink!
for details.
SeisBase.seedlink!
— Functionseedlink!(S, mode, chans)
S = seedlink(mode, chans)
Begin acquiring seedlink data to SeisData structure S
using mode mode
. New channels are added to S
automatically based on chans
. Connections are added to S.c
. When finished, close connection manually with close(S.c[n])
where n is connection #.
This function is fully described in the official documentation at https://SeisBase.readthedocs.io/ in subsection SeedLink.
Keywords: gap, kai, port, refresh, s, t, u, v, w, xonerr
See also: get_data!
Initiate a SeedLink session in DATA mode to feed data from channels chans
with selection patterns patts
to SeisData structure S
. A handle to a TCP connection is appended to S.c
. Data are periodically parsed until the connection is closed. One SeisData object can support multiple connections, provided that each connection's streams feed unique channels.
mode SeedLink mode ("DATA", "FETCH", or "TIME"; case-sensitive).
chans Channel specification can use any of the following options:
- A comma-separated String where each pattern follows the syntax NET.STA.LOC.CHA.DFLAG, e.g. UW.TDH..EHZ.D. Use "?" to match any single character.
- An Array{String,1} with one pattern per entry, following the above syntax.
- The name of a configuration text file, with one channel pattern per line; see Channel Configuration File syntax.
patts Data selection patterns. See official SeedLink documentation; syntax is identical.
Keywords
- v, w
SeedLink Keywords
kw | def | type | meaning |
---|---|---|---|
gap | 3600 | R | a stream with no data in >gap seconds is considered offline |
kai | 600 | R | keepalive interval (s) |
port | 18000 | I | port number |
refresh | 20 | R | base refresh interval (s) [1 ] |
seq | "" | S | Starting sequence hex value, like "5BE37A" |
u | "rtserve.iris.washington.edu" | S | base SeedLink service URL, no "http://" |
x_on_err | true | Bool | exit on error? |
Table Footnotes
- [
1
] This value is a base value; a small amount is added to this number by each new SeedLink session to minimize the risk of congestion
Change these with SeisBase.KW.SL.[key] = value
, e.g., SeisBase.KW.SL.refresh = 30
.
Special Behavior
- SeedLink follows unusual rules for wild cards in
sta
andpatts
: a.*
is not a valid SeedLink wild card. b. The LOC and CHA fields can be left blank insta
to select all locations and channels. - DO NOT feed one data channel from multiple SeedLink connections. This leads to TCP congestion on your computer, which can have severe consequences: a. A channel fed by multiple SeedLink connections will have many small segments, all out of order. merge! might fix this if caught quickly, but with hundreds of disjoint segments, expect memory and CPU issues. b. Your SeedLink connection will probably reset. c. Julia may freeze, requiring
kill -9
. To the best of our knowledge Julia has no special handling to mitigate TCP congestion. d. Your data may be corrupted, including disk writes from w=true.
Special Methods
close(S.c[i])
ends SeedLink connectioni
.!deleteat(S.c, i)
removes a handle to closed SeedLink connectioni
.
SeedLink Utilities
SeisBase.sl_info
— Functioninfo_xml = sl_info(level=LEVEL::String; u=URL::String, port=PORT::Integer)
Retrieve XML output of SeedLink command "INFO level
" from server URL:PORT
. Returns formatted XML. level
must be one of "ID", "CAPABILITIES", "STATIONS", "STREAMS", "GAPS", "CONNECTIONS", "ALL".
SeisBase.has_sta
— Functionhas_sta(sta[, u=url, port=N])
Check that streams exist at url
for stations sta
, formatted NET.STA. Use "?" to match any single character. Returns true
for stations that exist. sta
can also be the name of a valid config file or a 1d string array.
Returns a BitArray with one value per entry in sta.
SeedLink keywords: gap, port
SeisBase.has_stream
— Functionhas_stream(cha[, u=url, port=N, gap=G)
Check that streams with recent data exist at url u
for channel spec cha
, formatted NET.STA.LOC.CHA.DFLAG, e.g. "UW.TDH..EHZ.D, CC.HOOD..BH?.E". Use "?" to match any single character. Returns true
for streams with recent data.
cha
can also be the name of a valid config file.
has_stream(sta::Array{String,1}, sel::Array{String,1}, u::String, port=N::Int, gap=G::Real)
If two arrays are passed to has_stream, the first should be formatted as SeedLink STATION patterns (formated "SSSSS NN", e.g. ["TDH UW", "VALT CC"]); the second be an array of SeedLink selector patterns (formatted LLCCC.D, e.g. ["??EHZ.D", "??BH?.?"]).
SeedLink keywords: gap, port