simplemseed.seedcodec
Seismic compression and decompression algorithms.
Ported from Java, https://github.com/crotwell/seedcodec/
Module Contents
Classes
A holder for compressed data independent of the file format. |
Functions
Get the typecode for a python array.array from the mseed encoding type. |
|
True if the given encoding can be decompressed by this library. |
|
Decompress the samples from the provided bytes and return an array of the decompressed values. Only 16 bit short, 32 bit int, 32 bit float and 64 bit double along with Steim1 and Steim2 are supported. |
|
Encode the given numpy.ndarray or array.array into bytes. |
|
Textual name for integer SEED encoding. |
|
True if the compression is not representable by integers, so not compressable via the standard compression types. |
|
True if the compression is one of the primitive types, short, int float or double. |
|
Get the mseed3 encoding type for a python array.arry typecode and itemsize. |
|
Get the mseed3 encoding for a numpy dtype code |
|
Get a numpy dtype for a mseed3 encoding |
Data
Data is big endian, 1 |
|
Encoding for 64 bit floating point |
|
Encoding for 32 bit floating point |
|
Encoding for 24 bit integer |
|
Encoding for 32 bit integer |
|
Data is little endian, 0 |
|
Encoding for 16 bit integer |
|
Encoding for Steim1 compression |
|
Encoding for Steim2 compression |
|
API
- simplemseed.seedcodec.BIG_ENDIAN = 1
Data is big endian, 1
- class simplemseed.seedcodec.EncodedDataSegment(compressionType, dataBytes: Union[bytes, bytearray], numSamples, littleEndian: bool)
A holder for compressed data independent of the file format.
Initialization
- decode()
- simplemseed.seedcodec.LITTLE_ENDIAN = 0
Data is little endian, 0
- simplemseed.seedcodec.arrayTypecodeFromMSeed(encoding: int) str
Get the typecode for a python array.array from the mseed encoding type.
- simplemseed.seedcodec.canDecompress(encoding: int) bool
True if the given encoding can be decompressed by this library.
- simplemseed.seedcodec.decompress(compressionType: int, dataBytes: bytearray, numSamples: int, littleEndian: bool) numpy.ndarray
Decompress the samples from the provided bytes and return an array of the decompressed values. Only 16 bit short, 32 bit int, 32 bit float and 64 bit double along with Steim1 and Steim2 are supported.
@param compressionType compression format as defined in SEED blockette 1000 @param dataBytes input bytes to be decoded @param numSamples the number of samples that can be decoded from array <b>b</b> @param littleEndian if True, dataBytes is little-endian (intel byte order) <b>b</b>. @returns array of length <b>numSamples</b>. @throws CodecException fail to decompress. @throws UnsupportedCompressionType unsupported compression type
- simplemseed.seedcodec.encode(data, encoding=None, littleEndian=True)
Encode the given numpy.ndarray or array.array into bytes.
Note that currently no actual compression is done, the resulting bytes will occupy the same space, just converted for output. If encoding is not given, the encoding will be guessed from the array type. If endian is not given, defaults to little endian.
- simplemseed.seedcodec.encodingName(encoding)
Textual name for integer SEED encoding.
- simplemseed.seedcodec.getFloat64(dataBytes, offset, littleEndian)
- simplemseed.seedcodec.isFloatCompression(compressionType: int) bool
True if the compression is not representable by integers, so not compressable via the standard compression types.
- simplemseed.seedcodec.isPrimitiveCompression(compressionType: int) bool
True if the compression is one of the primitive types, short, int float or double.
- simplemseed.seedcodec.mseed3EncodingFromArrayTypecode(typecode: str, itemsize: int) int
Get the mseed3 encoding type for a python array.arry typecode and itemsize.