Usage

Generally either

import * as seedcodec from 'seisplotjs-seedcodec'
seedcodec.xxxx

or

import * as seisplotjs from 'seisplotjs'
seisplotjs.seedcodec.xxxx

Core Functionality

Decompress the samples from the provided DataView 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.

decompress(compressionType: number, dataView: DataView, numSamples: number, littleEndian: boolean): Array<number>
Parameters
compressionType (number) compression format as defined in SEED blockette 1000
dataView (DataView) input DataView to be decoded
numSamples (number) the number of samples that can be decoded from array b
littleEndian (boolean) if true, dataView is little-endian (intel byte order) b .
Returns
Array<number>: array of length numSamples .
Throws
  • any: CodecException fail to decompress.
  • any: UnsupportedCompressionType unsupported compression type

CodecException

src/seedcodec.js
new CodecException(message: string)

Extends Error

Parameters
message (string)

UnsupportedCompressionType

src/seedcodec.js
new UnsupportedCompressionType(message: string)

Extends Error

Parameters
message (string)

Compression Types

Constants for the various compresstion types.

ascii

ASCII

Type: number

16 bit integer, or java short

SHORT

Type: number

24 bit integer

INT24

Type: number

32 bit integer, or java int

INTEGER

Type: number

ieee float

FLOAT

Type: number

ieee double

DOUBLE

Type: number

Steim1 compression

STEIM1

Type: number

Steim2 compression

STEIM2

Type: number

Other/Private

CDSN 16 bit gain ranged

CDSN

Type: number

(A)SRO

SRO

Type: number

DWWSSN 16 bit

DWWSSN

Type: number

decodeSteim1

src/seedcodec.js

Decode the indicated number of samples from the provided byte array and return an integer array of the decompressed values. Being differencing compression, there may be an offset carried over from a previous data record. This offset value can be placed in bias, otherwise leave the value as 0.

decodeSteim1(dataView: DataView, numSamples: number, littleEndian: boolean, bias: number): any
Parameters
dataView (DataView) input DataView to be decoded
numSamples (number) the number of samples that can be decoded from array b
littleEndian (boolean) if true, dataView is little-endian (intel byte order) b .
bias (number) the first difference value will be computed from this value. If set to 0, the method will attempt to use the X(0) constant instead.
Returns
any: int array of length numSamples .
Throws
  • any: CodecException - encoded data length is not multiple of 64 bytes.

decodeSteim2

src/seedcodec.js

Decode the indicated number of samples from the provided byte array and return an integer array of the decompressed values. Being differencing compression, there may be an offset carried over from a previous data record. This offset value can be placed in bias, otherwise leave the value as 0.

decodeSteim2(dataView: DataView, numSamples: number, swapBytes: boolean, bias: number, b: any): Array<number>
Parameters
dataView (DataView)
numSamples (number) the number of samples that can be decoded from array b
swapBytes (boolean) if true, swap reverse the endian-ness of the elements of byte array b .
bias (number) the first difference value will be computed from this value. If set to 0, the method will attempt to use the X(0) constant instead.
b (any) input byte array to be decoded
Returns
Array<number>: int array of length numSamples .
Throws
  • any: SteimException - encoded data length is not multiple of 64 bytes.