@seismo/core
Version:
This is the package for the core library of Seismo, a JavaScript library for seismic data processing and visualization. It provides utilities for handling seismic data, including FDSN web services, waveform processing, and event handling. The library is d
122 lines (121 loc) • 4.13 kB
TypeScript
import { DateTime, Interval } from "luxon";
import { MinMaxable } from "./scale";
import * as seedcodec from "../waveform/seed-codec";
import { FDSNSourceId, NslcId } from "../fdsn/source-id";
export declare const COUNT_UNIT = "count";
export type HighLowType = {
xScaleDomain: Array<Date>;
xScaleRange: Array<number>;
secondsPerPixel: number;
samplesPerPixel: number;
highlowArray: Array<number>;
};
/**
* A contiguous segment of a Seismogram.
*
* @param yArray array of Y sample values, ie the timeseries
* @param sampleRate sample rate of the seismogram, hertz
* @param startTime start time of seismogrm as a luxon DateTime in utc or a string that can be parsed
*/
export declare class SeismogramSegment {
/** Array of y values */
_y: null | Int32Array | Float32Array | Float64Array;
_compressed: null | Array<seedcodec.EncodedDataSegment>;
/**
* the sample rate in hertz
*
* @private
*/
_sampleRate: number;
/** @private */
_startTime: DateTime;
_endTime_cache: null | DateTime;
_endTime_cache_numPoints: number;
_sourceId: FDSNSourceId;
yUnit: string;
_highlow: HighLowType | undefined;
constructor(yArray: Array<seedcodec.EncodedDataSegment> | Array<number> | Int32Array | Float32Array | Float64Array, sampleRate: number, startTime: DateTime, sourceId?: FDSNSourceId);
/**
* Y data of the seismogram. Decompresses data if needed.
*
* @returns y data as typed array
*/
get y(): Int32Array | Float32Array | Float64Array;
set y(value: Int32Array | Float32Array | Float64Array);
get start(): DateTime;
set start(value: DateTime | string);
get startTime(): DateTime;
set startTime(value: DateTime | string);
get end(): DateTime;
get endTime(): DateTime;
get timeRange(): Interval;
get sampleRate(): number;
set sampleRate(value: number);
get samplePeriod(): number;
get numPoints(): number;
get networkCode(): string;
get stationCode(): string | null;
get locationCode(): string | null;
get channelCode(): string | null;
/**
* Checks if the data is encoded
*
* @returns true if encoded, false otherwise
*/
isEncoded(): boolean;
/**
* Gets encoded data, if it is.
*
* @returns array of encoded data segments
* @throws Error if data is not encoded
*/
getEncoded(): Array<seedcodec.EncodedDataSegment>;
yAtIndex(i: number): number;
/**
* Finds the min and max values of a SeismogramSegment, with an optional
* accumulator for use with gappy data.
*
* @param minMaxAccumulator optional initialized accumulator as an array
* of two numbers, min and max
* @returns min, max as arry of length two
*/
findMinMax(minMaxAccumulator?: MinMaxable): MinMaxable;
/**
* Time of the i-th sample, indexed from zero.
* If i is negative, counting from end, so
* timeOfSample(-1) is time of last data point;
*
* @param i sample index
* @returns time
*/
timeOfSample(i: number): DateTime;
indexOfTime(t: DateTime): number;
hasCodes(): boolean;
/**
* return network, station, location and channels codes as one string.
* Uses this.channel if it exists, this.seismogram if not.
*
* @returns nslc codes separated by '.'
*/
get nslc(): string;
get nslcId(): NslcId;
/**
* return network, station, location and channels codes as one string
*
* @param sep separator, defaults to '.'
* @returns nslc codes separated by sep
*/
codes(sep?: string): string;
seisId(): string;
/**
* return FDSN source id.
*
* @returns FDSN source id
*/
get sourceId(): FDSNSourceId;
set sourceId(sid: FDSNSourceId);
clone(): SeismogramSegment;
cloneWithNewData(clonedData: Array<seedcodec.EncodedDataSegment> | Int32Array | Float32Array | Float64Array, clonedStartTime?: DateTime): SeismogramSegment;
cut(timeRange: Interval): SeismogramSegment | null;
_invalidate_endTime_cache(): void;
}