API Reference

This section documents the public API of pymseed. Every name listed here is importable directly from the pymseed package.

Classes

pymseed.MS3Record([reclen, encoding])

A wrapper for miniSEED data records supporting formats v2 and v3.

pymseed.MS3RecordReader(source, *[, ...])

Read miniSEED records from a file or file descriptor.

pymseed.MS3RecordValidator(source, *[, ...])

Validate miniSEED records with comprehensive error detection.

pymseed.ValidationError(offset, message[, ...])

An error or warning found during miniSEED record validation.

pymseed.MS3TraceList([file_name, buffer, ...])

A container for a list of traces read from miniSEED

Trace list internals

Iterating a MS3TraceList yields MS3TraceID objects, which in turn yield MS3TraceSeg objects. Reading with record_list=True additionally exposes MS3RecordList and MS3RecordPtr. These types are not imported at the top level of the package, since they are only ever obtained from a trace list rather than constructed directly.

pymseed.mstracelist.MS3TraceID(cffi_ptr, ...)

Wrapper around CFFI MS3TraceID structure

pymseed.mstracelist.MS3TraceSeg(cffi_ptr, ...)

A continuous span of samples for a single trace ID

pymseed.mstracelist.MS3RecordList(cffi_ptr, ...)

Wrapper around CFFI MS3RecordList structure

pymseed.mstracelist.MS3RecordPtr(cffi_ptr, ...)

A record that contributed samples to a trace segment

Enumerations

pymseed.DataEncoding(*values)

Data encoding format codes

pymseed.TimeFormat(*values)

Time format codes for nstime2timestr()

pymseed.SubSecond(*values)

Subsecond resolution codes for nstime2timestr()

Functions

pymseed.nstime2timestr(nstime[, timeformat, ...])

Convert a nanosecond timestamp to a date-time string

pymseed.timestr2nstime(timestr)

Convert a date-time string to nanoseconds since Unix epoch

pymseed.sample_time(time, offset, samprate)

Calculate time for a sample at given offset from a given time and sample rate

pymseed.system_time()

Get the current system time in nanoseconds

pymseed.configure_logging([log_prefix, ...])

Configure libmseed logging for the current thread.

pymseed.clear_error_messages()

Clear all log messages from the registry without returning them.

pymseed.get_error_messages()

Get all error/warning messages from the libmseed logging registry.

Source Identifiers

Converting between FDSN Source Identifiers and classic SEED NSLC (Network, Station, Location, Channel) codes deserves special care – the two are not a symmetric mapping. See Tutorial for a worked explanation of the conversion rules and the error cases.

pymseed.nslc2sourceid(net, sta, loc, chan)

Convert network, station, location, channel to FDSN Source ID

pymseed.sourceid2nslc(sourceid)

Convert an FDSN Source ID to a tuple of (net, sta, loc, chan)

Exceptions

pymseed.PymseedError

Base class for all pymseed exceptions.

pymseed.MiniSEEDError(status_code[, message])

Exception for libmseed return values.

Module Constants

pymseed.libmseed_version

Version string of the underlying libmseed library.

pymseed.NSTERROR

Nanosecond time value indicating an error condition.

pymseed.NSTUNSET

Nanosecond time value indicating an unset/unknown time.

pymseed.NSTMODULUS

Modulus value for nanosecond time calculations (nanoseconds per second).

CFFI layer

pymseed.ffi and pymseed.clibmseed give direct access to the CFFI-generated bindings for libmseed’s C API. They are an escape hatch for calling library functions pymseed does not itself wrap, not part of the documented Python API: their surface follows the bundled libmseed C headers and is not covered by pymseed’s own API stability guarantees.