English | 中文
Streams live seismic waveforms from a SeedLink server through ObsPy and stores
them in Apache IoTDB over the native RPC interface of the apache-iotdb
Python client.
- Subscribes to
NET.STA.CHAstreams on a SeedLink server withobspy.clients.seedlink.easyseedlink.EasySeedLinkClient. - Creates
root.<database>.seismic.<net>.<sta>.<loc>.<cha>.sampletimeseries (DOUBLE,GORILLAencoding) on demand; each stream component is base32-encoded into a path-safe segment. - Writes samples as IoTDB
Tabletbatches ofIOTDB_BATCH_SIZErows (default10000) through aSessionPoolopened on the Tree RPC port. - Stores timestamps in milliseconds and rejects sampling rates above 1000 Hz instead of letting samples collide.
| Component | Supported |
|---|---|
| Apache IoTDB server | 2.0.x, Tree model, timestamp_precision=ms |
| Data model | Tree (root.<database>.seismic.<stream>.sample) |
| Protocol | Native Thrift RPC on port 6667 (not REST, not MQTT) |
| Python | 3.9 and 3.12 (both run in CI) |
Dependency pins are in requirements-iotdb.txt: apache-iotdb>=2.0.10,<2.1.0
and obspy>=1.4.0.
Requires Python 3.9 or newer and access to PyPI. Nothing is packaged or installed as a distribution; the scripts run from the checkout.
git clone https://github.com/iotdb-ecosystem/seedlink-iotdb-connector.git
cd seedlink-iotdb-connector
python -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements-iotdb.txtpython -m pip install -r requirements-dev.txt
python -m pytest -qCI runs exactly that command. tests/test_iotdb.py replaces the session pool
with a mock, so it passes without an IoTDB server and without a SeedLink
connection: it covers path encoding, tablet batching, millisecond timestamps
and SEEDLINK_STREAMS parsing.
Not exercised in CI, because it needs infrastructure:
tests/test_live_iotdb.pywrites and queries real tablets; it is skipped unlessIOTDB_TEST_PORT,IOTDB_TEST_USERandIOTDB_TEST_PASSWORDare set.- Reception from
rtserve.iris.washington.eduand MiniSEED decoding of real packets.
Everything is read from environment variables.
| Variable | Default | Meaning |
|---|---|---|
IOTDB_HOST |
127.0.0.1 |
IoTDB RPC host |
IOTDB_PORT |
6667 |
IoTDB RPC port |
IOTDB_USER |
root |
IoTDB user |
IOTDB_PASSWORD |
root |
IoTDB password |
IOTDB_DATABASE |
iotdb_seismic |
Tree database, name or root.name |
IOTDB_BATCH_SIZE |
10000 |
Samples per tablet |
IOTDB_CONNECTION_TIMEOUT_MS |
30000 |
Connection timeout |
SEEDLINK_SERVER |
rtserve.iris.washington.edu:18000 |
SeedLink endpoint |
SEEDLINK_STREAMS |
IU.ANMO.BHZ,IU.ADK.BHZ |
Comma separated NET.STA.CHA |
LOG_LEVEL |
INFO |
Log level |
export IOTDB_HOST=127.0.0.1
export IOTDB_DATABASE=seismic
export SEEDLINK_STREAMS=IU.ANMO.BHZ,IU.ADK.BHZpython -m pip install -r requirements-iotdb.txt
IOTDB_DATABASE=seismic python seedlink2iotdb.pyThe writer runs until interrupted and Ctrl+C closes the session pool. With
the default settings samples land under
root.iotdb_seismic.seismic.<encoded stream>.sample.
Independent project. Maintained here; contributions and adoption inquiries are welcome.
Apache-2.0 - see LICENSE for the full text.