import { FDSNSourceId } from "./fdsnsourceid.mjs"; import { EncodedDataSegment } from "./seedcodec.mjs"; import { SeismogramSegment } from "./seismogramsegment.mjs"; import { Seismogram, SeismogramDisplayData } from "./seismogram.mjs"; import { DataRecord } from "./miniseed.mjs"; import { DateTime } from "luxon"; export type json_object = Record; export declare const MINISEED_THREE_MIME = "application/vnd.fdsn.mseed3"; /** const for unknown data version, 0 */ export declare const UNKNOWN_DATA_VERSION = 0; /** const for offset to crc in record, 28 */ export declare const CRC_OFFSET = 28; /** const for size of fixed header part of record, 40 */ export declare const FIXED_HEADER_SIZE = 40; /** const for fdsn prefix for extra headers, FDSN */ export declare const FDSN_PREFIX = "FDSN"; /** const for little endian, true */ export declare const LITTLE_ENDIAN = true; /** const for big endian, false */ export declare const BIG_ENDIAN = false; export declare function toMSeed3(seis: Seismogram, extraHeaders?: Record): Array; /** * parse arrayBuffer into an array of MSeed3Records. * * @param arrayBuffer bytes to extract miniseed3 records from * @returns array of all miniseed3 records contained in the buffer */ export declare function parseMSeed3Records(arrayBuffer: ArrayBufferLike): Array; /** * parse arrayBuffer into an array of MSeed3Records. * * @param arrayBuffer bytes to extract miniseed3 records from * @returns array of all miniseed3 records contained in the buffer */ export declare function mightBeMSeed3Records(arrayBuffer: ArrayBufferLike): boolean; /** * Represents a MSEED3 Data Record, with header, extras and data. * * @param header miniseed3 fixed record header * @param extraHeaders json compatible object with extra headers * @param rawData waveform data, in correct compression for value in header */ export declare class MSeed3Record { header: MSeed3Header; extraHeaders: Record; rawData: DataView; constructor(header: MSeed3Header, extraHeaders: Record, rawData: DataView); /** * Parses an miniseed3 data record from a DataView. * * @param dataView bytes to parse * @returns parsed record */ static parseSingleDataRecord(dataView: DataView): MSeed3Record; /** * Calculates the byte size of the miniseed3 record to hold this data. * This should be called if the size is needed after modification * of the extraHeaders. * * @returns size in bytes */ calcSize(): number; /** * Gets the byte size of the miniseed3 record to hold this data. * Note that unless calcSize() has been called, this may not * take into account modifications to the extra headers. * * @returns size in bytes */ getSize(): number; /** * Decompresses the data , if the compression * type is known * * @returns decompressed data as a typed array, usually Int32Array or Float32Array */ decompress(): Int32Array | Float32Array | Float64Array; /** * Wraps data in an EncodedDataSegment for future decompression. * * @returns waveform data */ asEncodedDataSegment(): EncodedDataSegment; /** * Just the header.identifier, included as codes() for compatiblility * with parsed miniseed2 data records. * * @returns string identifier */ codes(): string; /** * Parses the identifier into an FDSNSourceId. * * @returns header identifier as source id */ getSourceId(): FDSNSourceId; /** * Saves miniseed3 record into a DataView, recalculating crc. * * @param dataView DataView to save into, must be large enough to hold the record. * @returns the number of bytes written to the DataView, can be used as offset * for writting the next record. */ save(dataView: DataView): number; /** * Calculates crc by saving to a DataView, which sets the crc header to zero * and then calculates it based on the rest of the record. * * @returns crc pulled from saved miniseed3 record */ calcCrc(): number; toString(): string; } /** * Fixed header of an MSeed3 data record. */ export declare class MSeed3Header { recordIndicator: string; formatVersion: number; flags: number; nanosecond: number; year: number; dayOfYear: number; hour: number; minute: number; second: number; encoding: number; sampleRateOrPeriod: number; numSamples: number; crc: number; publicationVersion: number; identifierLength: number; extraHeadersLength: number; identifier: string; extraHeaders: json_object; dataLength: number; constructor(); /** * Parses an miniseed3 fixed header from a DataView. * * @param dataView bytes to parse * @returns parsed header object */ static createFromDataView(dataView: DataView): MSeed3Header; get start(): DateTime; get end(): DateTime; get sampleRate(): number; get samplePeriod(): number; /** * Calculates size of the fixed header including the variable * length identifier, but without the extra headers. * * @returns size in bytes of fixed header */ getSize(): number; encodingName(): string; /** * Text representation of the miniseed3 header. This is modeled after * the output of mseed3-text from the mseed3-utils package from IRIS. * * @returns textual repersentation */ toString(): string; /** * Start time in the format output by mseed3-utils from IRIS. Format is * yyyy,ooo,HH:mm:ss.SSSSSS * * @returns start time */ startFieldsInUtilFormat(): string; /** * Converts start time header fields to ISO8601 time string. This will include * factional seconds to nanosecond precision. * * @param trimMicroNano trim to microsecond precision if nanos are 000 * @returns iso start time */ getStartFieldsAsISO(trimMicroNano?: boolean): string; /** * sets start time headers. * * @param starttime start as DateTime */ setStart(starttime: DateTime): void; /** * Calculates time of the ith sample. * * @param i sample number * @returns the time */ timeOfSample(i: number): DateTime; /** * Writes to the given dataview. * * @param dataView write buffer * @param offset offset within the buffer * @param zeroCrc optionally zero out the crc field in order to recalculate * @returns new offset after this record */ save(dataView: DataView, offset?: number, zeroCrc?: boolean): number; /** * Converts header start time to DateTime * * @returns start time as DateTime */ startAsDateTime(): DateTime; } /** * Parses extra headers as json. * * @param dataView json bytes as DataView * @returns json object */ export declare function parseExtraHeaders(dataView: DataView): Record; /** * Creates a string version of a number with zero prefix padding. For example * padZeros(5, 3) is 005. * * @param val number to stringify * @param len total length of string * @returns zero padded string */ export declare function padZeros(val: number, len: number): string; /** * creates a string from utf-8 bytes in a DataView. * * @param dataView data bytes * @param offset offset to first byte to use * @param length number of bytes to convert * @returns string resulting from utf-8 conversion */ export declare function makeString(dataView: DataView, offset: number, length: number): string; /** * Checks if two miniseed3 records are (nearly) contiguous. * * @param dr1 first record * @param dr2 second record * @param sampRatio tolerence expressed as ratio of sample period, default 1.5 * @returns true if contiguous */ export declare function areContiguous(dr1: MSeed3Record, dr2: MSeed3Record, sampRatio?: number): boolean; /** * 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. * * @param contig array of miniseed3 records * @returns seismogram segment for the records */ export declare function createSeismogramSegment(contig: Array | MSeed3Record): SeismogramSegment; /** * 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. * * @param drList list of miniseed3 records to convert * @returns the seismogram */ export declare function merge(drList: Array): Seismogram; /** * merges contiguous MSeed3Record into SeismogramSegments. * * @param drList array of data records * @returns array of SeismogramSegments for contiguous data */ export declare function mergeSegments(drList: Array): Array; /** * splits a list of data records by channel identifier, returning an object * with each NSLC mapped to an array of data records. * * @param drList array of miniseed3 records * @returns map of channel id to array of miniseed3 records, possibly not contiguous */ export declare function byChannel(drList: Array): Map>; /** * splits the records by channel and creates a single * SeismogramSegment for each contiguous window from each channel. * * @param drList MSeed3Records array * @returns Array of SeismogramSegment */ export declare function seismogramSegmentPerChannel(drList: Array): Array; /** * splits the MSeed3Records by channel and creates a single * Seismogram for each channel. * * @param drList MSeed3Records array * @returns Map of code to Seismogram */ export declare function seismogramPerChannel(drList: Array): Array; /** * splits the MSeed3Records by channel and creates a single * SeismogramDisplayData for each channel. BAG extra headers * are extracted and Quake and Markers are created. * * @param drList MSeed3Records array * @returns Map of code to Seismogram */ export declare function sddPerChannel(drList: Array): Array; /** * Convert array of Miniseed2 DataRecords into an array of MSeed3Records. * * @param mseed2 array of DataRecords * @returns array of MSeed3Records */ export declare function convertMS2toMSeed3(mseed2: Array): Array; /** * Converts a single miniseed2 DataRecord into a single MSeed3Record. * * @param ms2record Miniseed2 DataRecord to convert * @returns MSeed3Record */ export declare function convertMS2Record(ms2record: DataRecord): MSeed3Record; /** * 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 (https://www.tty1.net/pycrc/). Command line used: * './pycrc.py --model=crc-32c --generate c --algorithm=table-driven' * * @param buf input data * @param initial starting value, from earlier data * @returns calculated crc32c value */ export declare function calculateCRC32C(buf: ArrayBufferLike | Uint8Array, initial?: number): number; /** * Convert crc as a number into a hex string. * * @param crc crc as a number * @returns hex representation */ export declare function crcToHexString(crc: number): string; //# sourceMappingURL=mseed3.d.mts.map