Skip to content

About

SeedLink seismic waveform writer for Apache IoTDB, built on ObsPy

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

SeedLink to IoTDB Writer

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.

CI

What it does

  • Subscribes to NET.STA.CHA streams on a SeedLink server with obspy.clients.seedlink.easyseedlink.EasySeedLinkClient.
  • Creates root.<database>.seismic.<net>.<sta>.<loc>.<cha>.sample timeseries (DOUBLE, GORILLA encoding) on demand; each stream component is base32-encoded into a path-safe segment.
  • Writes samples as IoTDB Tablet batches of IOTDB_BATCH_SIZE rows (default 10000) through a SessionPool opened on the Tree RPC port.
  • Stores timestamps in milliseconds and rejects sampling rates above 1000 Hz instead of letting samples collide.

Compatibility

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.

Build

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.txt

Test

python -m pip install -r requirements-dev.txt
python -m pytest -q

CI 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.py writes and queries real tablets; it is skipped unless IOTDB_TEST_PORT, IOTDB_TEST_USER and IOTDB_TEST_PASSWORD are set.
  • Reception from rtserve.iris.washington.edu and MiniSEED decoding of real packets.

Configuration

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.BHZ

Usage

python -m pip install -r requirements-iotdb.txt
IOTDB_DATABASE=seismic python seedlink2iotdb.py

The 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.

Project status

Independent project. Maintained here; contributions and adoption inquiries are welcome.

License

Apache-2.0 - see LICENSE for the full text.

About

SeedLink seismic waveform writer for Apache IoTDB, built on ObsPy

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages