Rust libmseed
A pure-Rust port of libmseed for reading, writing
and managing miniSEED 2 and 3 seismological time
series data. No unsafe code, a compact API in Rust idiom, and a WebAssembly build.
Features
- Read files and streams record by record, auto-detecting the miniSEED version, record length,
byte order and encoding, into a format agnostic
Record - All data encodings are supported
- Build trace lists by adding records, in any order, with merging and gap healing
- Rolling-buffer operation: add data to a trace list as it arrives and create full records when they can be, keeping the remainder for later; flush idle data
- Write miniSEED 3 or 2 records from trace lists or individual records
- JSON extra headers with JSON Pointer access, mapped to and from miniSEED 2 blockettes
- Data selections (glob patterns, time windows, publication versions), byte ranges, record lists for two-pass reading, leap second handling
- WebAssembly build published to npm
Usage
[]
= "0.1"
use ;
Build a trace list and pack records from it:
use ;
See the API documentation for the guide, including rolling-buffer operation, extra headers and differences from the C library.
Examples
For trying the library on your own data, the example mseedview program prints each
record in one or more files (-p for full headers, -pp to also print samples) and,
with -T (or -g to include gaps), the trace list they assemble into; -d decodes
data payloads (reporting decode errors without printing samples), -n skips the
per-record output, -s adds a summary and -C validates CRCs. A byte range can be
given as file@start-end:
More examples in examples/ show common tasks, run with
cargo run --example <name>:
read_buffer: read miniSEED from a memory buffer into a trace listread_recordlist: build a trace list with record lists, optionally decoding dataread_selection: read a file limited by data selectionspack_rollingbuffer: add data to a trace list as it arrives and pack full recordsextraheaders: set, get and modify extra headerssids: map between FDSN Source Identifiers and network, station, location and channel codestimestr: convert time strings to the supported output formats
WebAssembly
From npm, with a bundler (webpack, Vite, ...), which loads and initializes the WebAssembly module on import:
import from "libmseed";
const records = ;
Each release also attaches a standalone build for direct use in browsers without a bundler
(libmseed.js, libmseed.wasm, libmseed.d.ts), which is initialized explicitly:
import init from "./libmseed.js";
await ;
See libmseed-wasm, which also describes a browser demo and a
Node.js example for trying the WebAssembly build locally.
Development
Branches: work on develop, releases are tagged from main. Pushes to either run CI;
publishing a GitHub release publishes to crates.io (and so docs.rs) and npm.
See CONTRIBUTING.md. Minimum supported Rust version: 1.88.
Citing
Each release is archived on Zenodo with a DOI (see the badge above). Citation metadata is in CITATION.cff; GitHub's "Cite this repository" button formats it as APA or BibTeX.
License
Apache License, Version 2.0. See LICENSE.