json_object

src/mseed3.ts
json_object

Type: Record<string, any>

MINISEED_THREE_MIME

src/mseed3.ts
MINISEED_THREE_MIME

Type: string

UNKNOWN_DATA_VERSION

src/mseed3.ts

const for unknown data version, 0

UNKNOWN_DATA_VERSION

Type: number

CRC_OFFSET

src/mseed3.ts

const for offset to crc in record, 28

CRC_OFFSET

Type: number

FIXED_HEADER_SIZE

src/mseed3.ts

const for size of fixed header part of record, 40

FIXED_HEADER_SIZE

Type: number

FDSN_PREFIX

src/mseed3.ts

const for fdsn prefix for extra headers, FDSN

FDSN_PREFIX

Type: string

LITTLE_ENDIAN

src/mseed3.ts

const for little endian, true

LITTLE_ENDIAN

Type: boolean

BIG_ENDIAN

src/mseed3.ts

const for big endian, false

BIG_ENDIAN

Type: boolean

toMSeed3(seis: Seismogram, extraHeaders: Record<string, any>?): Array<MSeed3Record>
Parameters
seis (Seismogram)
extraHeaders (Record<string, any>?)
Returns
Array<MSeed3Record>

parseMSeed3Records

src/mseed3.ts

parse arrayBuffer into an array of MSeed3Records.

parseMSeed3Records(arrayBuffer: ArrayBuffer): Array<MSeed3Record>
Parameters
arrayBuffer (ArrayBuffer) bytes to extract miniseed3 records from
Returns
Array<MSeed3Record>: array of all miniseed3 records contained in the buffer

MSeed3Record

src/mseed3.ts

Represents a MSEED3 Data Record, with header, extras and data.

new MSeed3Record(header: MSeed3Header, extraHeaders: Record<string, any>, rawData: DataView)
Parameters
header (MSeed3Header) miniseed3 fixed record header
extraHeaders (Record<string, any>) json compatible object with extra headers
rawData (DataView) waveform data, in correct compression for value in header
Static Members
parseSingleDataRecord(dataView)
createFromDataView(dataView)
Instance Members
header
extraHeaders
rawData
calcSize()
getSize()
decompress()
asEncodedDataSegment()
codes()
save(dataView)
calcCrc()
toString()

MSeed3Header

src/mseed3.ts

Fixed header of an MSeed3 data record.

new MSeed3Header()
Static Members
createFromDataView(dataView)
Instance Members
recordIndicator
formatVersion
flags
nanosecond
year
dayOfYear
hour
minute
second
encoding
sampleRatePeriod
numSamples
crc
publicationVersion
identifierLength
extraHeadersLength
identifier
extraHeaders
dataLength
start
sampleRate
getSize()
toString()
getStartFieldsAsISO()
setStart(starttime)
timeOfSample(i)
save(dataView, offset, zeroCrc)
_startToMoment()

parseExtraHeaders

src/mseed3.ts

Parses extra headers as json.

parseExtraHeaders(dataView: DataView): Record<string, any>
Parameters
dataView (DataView) json bytes as DataView
Returns
Record<string, any>: json object

Creates a string version of a number with zero prefix padding. For example padZeros(5, 3) is 005.

padZeros(val: number, len: number): string
Parameters
val (number) number to stringify
len (number) total length of string
Returns
string: zero padded string

makeString

src/mseed3.ts

creates a string from bytes in a DataView.

makeString(dataView: DataView, offset: number, length: number): string
Parameters
dataView (DataView) data bytes
offset (number) offset to first byte to use
length (number) number of bytes to convert
Returns
string: string resulting from utf-8 conversion

areContiguous

src/mseed3.ts

Checks if two miniseed3 records are (nearly) contiguous.

areContiguous(dr1: MSeed3Record, dr2: MSeed3Record, sampRatio: any): boolean
Parameters
dr1 (MSeed3Record) first record
dr2 (MSeed3Record) second record
sampRatio (any = 1.5) tolerence expressed as ratio of sample period, default 1.5
Returns
boolean: true if contiguous

createSeismogramSegment

src/mseed3.ts

Concatentates a sequence of MSeed3 Records into a single seismogram object. Assumes that they are all contiguous (no gaps or overlaps) and in order. Header values from the first MSeed3 Record are used.

createSeismogramSegment(contig: Array<MSeed3Record>): SeismogramSegment
Parameters
contig (Array<MSeed3Record>) array of miniseed3 records
Returns
SeismogramSegment: seismogram segment for the records

Merges miniseed3 records into a Seismogram object, each of which consists of SeismogramSegment objects containing the data as EncodedDataSegment objects. DataRecords are sorted by startTime. This assumes all data records are from the same channel, byChannel can be used first if multiple channels may be present. Gaps may be present.

merge(drList: Array<MSeed3Record>): Seismogram
Parameters
drList (Array<MSeed3Record>) list of miniseed3 records to convert
Returns
Seismogram: the seismogram

mergeSegments

src/mseed3.ts

merges contiguous MSeed3Record into SeismogramSegments.

mergeSegments(drList: Array<MSeed3Record>): Array<SeismogramSegment>
Parameters
drList (Array<MSeed3Record>) array of data records
Returns
Array<SeismogramSegment>: array of SeismogramSegments for contiguous data

byChannel

src/mseed3.ts

splits a list of data records by channel identifier, returning an object with each NSLC mapped to an array of data records.

byChannel(drList: Array<MSeed3Record>): Map<string, Array<MSeed3Record>>
Parameters
drList (Array<MSeed3Record>) array of miniseed3 records
Returns
Map<string, Array<MSeed3Record>>: map of channel id to array of miniseed3 records, possibly not contiguous

seismogramSegmentPerChannel

src/mseed3.ts

splits the records by channel and creates a single SeismogramSegment for each contiguous window from each channel.

seismogramSegmentPerChannel(drList: Array<MSeed3Record>): Array<SeismogramSegment>
Parameters
drList (Array<MSeed3Record>) MSeed3Records array
Returns
Array<SeismogramSegment>: Array of SeismogramSegment

seismogramPerChannel

src/mseed3.ts

splits the MSeed3Records by channel and creates a single Seismogram for each channel.

seismogramPerChannel(drList: Array<MSeed3Record>): Array<Seismogram>
Parameters
drList (Array<MSeed3Record>) MSeed3Records array
Returns
Array<Seismogram>: Map of code to Seismogram

convertMS2toMSeed3

src/mseed3.ts

Convert array of Miniseed2 DataRecords into an array of MSeed3Records.

convertMS2toMSeed3(mseed2: Array<DataRecord>): Array<MSeed3Record>
Parameters
mseed2 (Array<DataRecord>) array of DataRecords
Returns
Array<MSeed3Record>: array of MSeed3Records

convertMS2Record

src/mseed3.ts

Converts a single miniseed2 DataRecord into a single MSeed3Record.

convertMS2Record(ms2record: DataRecord): MSeed3Record
Parameters
ms2record (DataRecord) Miniseed2 DataRecord to convert
Returns
MSeed3Record: MSeed3Record

calculateCRC32C

src/mseed3.ts

Copy from https://github.com/ashi009/node-fast-crc32c/blob/master/impls/js_crc32c.js and modify to use ArrayBuffer. Rename calculateCRC32C

This code is a manual javascript translation of c code generated by pycrc 0.7.1 (http://www.tty1.net/pycrc/). Command line used: './pycrc.py --model=crc-32c --generate c --algorithm=table-driven'

calculateCRC32C(buf: (ArrayBuffer | Uint8Array), initial: any): number
Parameters
buf ((ArrayBuffer | Uint8Array)) input data
initial (any = 0) starting value, from earlier data
Returns
number: calculated crc32c value

crcToHexString

src/mseed3.ts

Convert crc as a number into a hex string.

crcToHexString(crc: number): string
Parameters
crc (number) crc as a number
Returns
string: hex representation