Crate mseedio

Source
Expand description

§mseedio

A lib that can read/write miniseed file written in rust. Support no_std.

Only minimaleed3 is supported now If you want to use miniseed2 in rust, you can use libmseed’s rust binding

Supports all encodings of minimaleed3 except steim3.

§usage

  • Read

Use MS3Volume to read a miniseed3 file, and get each records’s summary using iter.

let ms3 = mseedio::MS3Volume::from_file("path/to/your/file.mseed3").unwrap();
for rcd in ms3 {
    println!("{}", rcd.summary());
}

from_file needs std feature, you can replace it with from_bytes in no_std environment easily.

  • Write
let payload: [i32; 500] = [/*...*/];
let rcd = MS3RecordBuilder::new()
        .data_payload_encoding(DataEncoding::Steim1)
        .data(DecodedData::I32(payload.to_vec()))
        .sample_rate(1.0)
        // "2022-06-05T20:32:38.123456789Z"
        .start_time(MS3Time::from_parts(2022, 6, 5, 20, 32, 38, 123456789)) 
        .flag(FieldFlag::ClockLocked)
        .data_public_version(1)
        .sid("FDSN:XX_TEST__L_H_Z")
        .unwrap()
        .build()
        .unwrap();

§todo

  • Optimize steim decoding
  • Make encoding and decoding optional features
  • Add miniseed2 support
  • More tests
  • benchmark

§ref

§license

MIT

Structs§

DataEncoding
Data payload encodings in the format are identified by a code (number).
FDSNSchema
Extra headers in miniSEED 3 data format
FieldFlag
UINT8
MS3Data
The body of a miniseed record. encodeing format and length should be determined by crate::MS3Header
MS3Header
The header of a miniSEED 3.0 record. A record is composed of a header followed by a data payload. The byte order of binary fields in the header must be least significant byte first (little endian).
MS3Record
The fundamental unit of miniseed.
MS3RecordBuilder
MS3Time
MS3Volume
A collection of MS3Record, general miniseed file form
SampleRP
Sample Rate and Period

Enums§

DecodedData

Traits§

Steim1Decode
Steim1Encode
Steim2Decode
Steim2Encode
Steim3Decode
Steim3Encode

Functions§

devide_into_record_chunk
is_vaild_ms3
check the each MS3 indicator and byte length only check the first record