mseed

miniSEED is a subset of SEED (Standard for the Exchange of Earthquake Data) data, which is commonly used for the archival and exchange of seismological time series data. DolphinDB mseed plugin provides read and write support for the miniSEED files, which uses the read-write interface of the IRIS libmseed.

1. Installation (with installPlugin)

Required server version: DolphinDB 2.00.10 or higher

Supported OS: Windows x86-64 and Linux X86-64.

Installation Steps:

(1) Use listRemotePlugins to check plugin information in the plugin repository.

Note: For plugins not included in the provided list, you can install through precompiled binaries or compile from source. These files can be accessed from our GitHub repository by switching to the appropriate version branch.

login("admin", "123456")
listRemotePlugins()

(2) Invoke installPlugin for plugin installation.

installPlugin("mseed")

(3) Use loadPlugin to load the plugin before using the plugin methods.

loadPlugin("mseed")

2. Methods References

read

Syntax

read(file)

Details

Read a miniSEED file and return a DolphinDB in-memory table containing the following columns:

  • value: An INT/FLOAT/DOUBLE column indicating the miniSEED records.
  • time: A TIMESTAMP column indicating the corresponding timestamp of each miniSEED record.
  • id: A SYMBOL column indicating the source identifier of the miniSEED block where the value is located.

Parameters

  • file: A STRING scalar indicating the absolute path of the miniSEED file to be read.

Examples

ret = mseed::read("<FileDir>/SC.JZG.00.BHZ.D.2013.001");

write

Syntax

write(file, sid, startTime, sampleRate, value, [overwrite=false])

Details

Write a continuous series to a miniSEED file and return a BOOLEAN scalar. If the writing succeeds, it returns true.

Parameters

  • file: A STRING scalar indicating the absolute path of the miniSEED file to be written.
  • sid: A STRING scalar indicating the source identifier of the block that is written to the miniSEED file.
  • startTime: A TIMESTAMP scalar indicating the start time to write each record to the miniSEED file.
  • sampleRate: An INT/LONG/FLOAT/DOUBLE scalar indicating the sample rate to write to the miniSEED file.
  • value: An INT/FLOAT/DOUBLE vector indicating the miniSEED records.
  • overwrite: A BOOLEAN scalar indicating whether to overwrite the previously written data. The default value is false.

Examples

time = timestamp(2013.01.01);
sampleRate = 100.0;
vec = rand(100, 100);
ret = mseed::write("/home/zmx/aaa", "XFDSN:SC_JZG_00_B_H_Z", time, sampleRate, vec);

parse

Syntax

parse(data)

Details

Parse the miniSEED stream and return a DolphinDB in-memory table containing the following columns:

  • value: An INT/FLOAT/DOUBLE column indicating the miniSEED records.
  • time: A TIMESTAMP column indicating the corresponding timestamp of each miniSEED record.
  • id: A SYMBOL column indicating the source identifier of the miniSEED block where the value is located.

Parameters

  • data: A STRING/CHAR vector indicating the miniSEED stream.

Examples

fin = file("/media/zmx/aaa");
buf = fin.readBytes(512);
ret = mseed::parse(buf);

stringBuf = concat(buf);
ret = mseed::parse(stringBuf);

parseStream

Syntax

parseStream(data)

Details

Parse the miniSEED stream.

  • If succeeded, return a dictionary containing an in-memory table and the length of the stream that is successfully parsed.
  • If failed, return a dictionary containing the length of the stream that is successfully parsed.

The returned dictionary contains the following key-values:

  • "data": A DolphinDB in-memory table containing the following columns.
    • value: An INT/FLOAT/DOUBLE column indicating the miniSEED records.
    • time: A TIMESTAMP column indicating the corresponding timestamp of each miniSEED record.
    • id: A SYMBOL column indicating the source identifier of the miniSEED block where the value is located.
  • "size": A LONG scalar indicating the length of the stream that is successfully parsed.
  • "metaData": A DolphinDB in-memory table containing the following columns.
    • id: A SYMBOL column indicating the source identifier of the miniSEED block where the value is located.
    • startTime: A TIMESTAMP column indicating the time to read the miniSEED data.
    • receivedTime: A TIMESTAMP column indicating the time to receive the miniSEED data.
    • actualCount: An INT column indicating the amount of parsed data.
    • expectedCount: An INT column indicating the amount of data specified by the miniSEED packed header.
    • sampleRate: A DOUBLE column indicating the rate to read data sample from the miniSEED file.

Parameters

  • data: A STRING/CHAR vector indicating the miniSEED stream.

Examples

fin = file("/media/zmx/aaa");
buf = fin.readBytes(512);
ret = mseed::parseStream(buf);

stringBuf = concat(buf);
ret = mseed::parseStream(stringBuf);

parseStreamInfo

Syntax

parseStreamInfo(data)

Details

Parse the information of the miniSEED stream.

Return a dictionary containing the following key-values:

  • "data": A DolphinDB in-memory table containing the following columns.
    • sid: A STRING column indicating the source identifier of the block read from the miniSEED file.
    • blockLen: An INT column indicating the length of the block.
  • "size": An INT scalar indicating the length of the stream that is successfully parsed.

Parameters

  • data: A STRING/CHAR vector indicating the miniSEED stream.

Examples

fin = file("/media/zmx/aaa");
buf = fin.readBytes(512);
ret = mseed::parseStreamInfo(buf);

stringBuf = concat(buf);
ret = mseed::parseStreamInfo(stringBuf);

streamize

Syntax

streamize(data, sampleRate, [blockSize])

Details

Convert the miniSEED records to CHAR Vector (in miniseed format) by rows. Columns “sid” and “timestamps” need to be sorted in advance.

Parameters

  • data: A table containing the following columns:
    • sid: of SYMBOL or STRING type
    • timestamp: of TIMESTAMP type
    • value: of INT, FLOAT, or DOUBLE type
  • sampleRate: An INT/LONG/FLOAT/DOUBLE scalar indicating the rate to read data sample from the miniSEED file.
  • blockSize: An INT scalar indicating the size of the miniSEED block. The default value is 512.

Examples

sidVec = take("XFDSN:SN_C0059_40_E_I_E", 1000).symbol()
tsVec = now() + 1..1000
dataVec = 1..1000
data = table(sidVec as sid, tsVec as ts, dataVec as data)
ret = mseed::streamize(data, 1000)