import { DateTime, Duration, Interval } from "luxon"; import { FDSNSourceId, NslcId } from "./fdsnsourceid.mjs"; import * as seedcodec from "./seedcodec.mjs"; import { DistAzOutput } from "./distaz.mjs"; import { Network, Station, Channel, InstrumentSensitivity } from "./stationxml.mjs"; import { Quake } from "./quakeml.mjs"; import { AMPLITUDE_MODE, MinMaxable } from "./scale.mjs"; import { SeismogramSegment } from "./seismogramsegment.mjs"; import type { TraveltimeJsonType, TraveltimeArrivalType } from "./traveltime.mjs"; export declare const COUNT_UNIT = "count"; export type HighLowType = { xScaleDomain: Array; xScaleRange: Array; secondsPerPixel: number; samplesPerPixel: number; highlowArray: Array; }; import type { MarkerType } from "./seismographmarker.mjs"; /** * Represents time window for a single channel that may * contain gaps or overlaps, but is otherwise more or less * continuous, or at least adjacent data from the channel. * Each segment within * the Seismogram will have the same units, channel identifiers * and sample rate, but cover different times. */ export declare class Seismogram { _segmentArray: Array; _interval: Interval; _y: null | Int32Array | Float32Array | Float64Array; constructor(segmentArray: SeismogramSegment | Array); checkAllSimilar(): void; checkSimilar(f: SeismogramSegment, s: SeismogramSegment): void; findStartEnd(): Interval; findMinMax(minMaxAccumulator?: MinMaxable): MinMaxable; /** * calculates the mean of a seismogrma. * * @returns mean value */ mean(): number; get start(): DateTime; get startTime(): DateTime; get end(): DateTime; get endTime(): DateTime; get timeRange(): Interval; get networkCode(): string | null; get stationCode(): string | null; get locationCode(): string | null; get channelCode(): string | null; /** * return FDSN source id as a string. * * @returns FDSN source id */ get sourceId(): FDSNSourceId; set sourceId(sid: FDSNSourceId); get sampleRate(): number; get samplePeriod(): number; get yUnit(): string | null; isYUnitCount(): boolean; get numPoints(): number; hasCodes(): boolean; /** * return network, station, location and channels codes as one string. * Uses this.channel if it exists, this.seismogram if not. * * @returns net.sta.loc.chan */ get nslc(): string; get nslcId(): NslcId; codes(): string; get segments(): Array; append(seismogram: SeismogramSegment | Seismogram): void; /** * Cut the seismogram. Creates a new seismogram with all datapoints * contained in the time window. * * @param timeRange start and end of cut * @returns new seismogram */ cut(timeRange: Interval): null | Seismogram; /** * Creates a new Seismogram composed of all seismogram segments that overlap the * given time window. If none do, this returns null. This is a faster but coarser * version of cut as it only removes whole segments that do not overlap the * time window. For most seismograms that consist of a single contiguous * data segment, this will do nothing. * * @param timeRange time range to trim to * @returns new seismogram if data in the window, null otherwise * @see cut */ trim(timeRange: Interval): null | Seismogram; break(duration: Duration): void; isContiguous(): boolean; /** * Merges all segments into a single array of the same type as the first * segment. No checking is done for gaps or overlaps, this is a simple * concatination. Be careful! * * @returns contatenated data */ merge(): Int32Array | Float32Array | Float64Array; /** * Gets the timeseries as an typed array if it is contiguous. * * @throws {NonContiguousData} if data is not contiguous. * @returns timeseries as array of number */ get y(): Int32Array | Float32Array | Float64Array; set y(val: Int32Array | Float32Array | Float64Array); clone(): Seismogram; cloneWithNewData(newY: Int32Array | Float32Array | Float64Array): Seismogram; /** * factory method to create a single segment Seismogram from either encoded data * or a TypedArray, along with sample rate and start time. * * @param yArray array of encoded data or typed array * @param sampleRate sample rate, samples per second of the data * @param startTime time of first sample * @param sourceId optional source id * @returns seismogram initialized with the data */ static fromContiguousData(yArray: Array | Int32Array | Float32Array | Float64Array, sampleRate: number, startTime: DateTime, sourceId?: FDSNSourceId): Seismogram; } export declare class NonContiguousData extends Error { constructor(message?: string); } export declare function ensureIsSeismogram(seisSeismogram: Seismogram | SeismogramSegment): Seismogram; export declare class SeismogramDisplayData { /** @private */ _seismogram: Seismogram | null; _id: string | null; _sourceId: FDSNSourceId | null; label: string | null; markerList: Array; traveltimeList: Array; channel: Channel | null; _instrumentSensitivity: InstrumentSensitivity | null; quakeList: Array; quakeReferenceList: Array; timeRange: Interval; alignmentTime: DateTime; doShow: boolean; _statsCache: SeismogramDisplayStats | null; constructor(timeRange: Interval); static fromSeismogram(seismogram: Seismogram): SeismogramDisplayData; /** * Create a Seismogram from the segment, then call fromSeismogram to create * the SeismogramDisplayData; * @param seisSegment segment of contiguous data * @returns new SeismogramDisplayData */ static fromSeismogramSegment(seisSegment: SeismogramSegment): SeismogramDisplayData; /** * Useful for creating fake data from an array, sample rate and start time * * @param yArray fake data * @param sampleRate samples per second * @param startTime start of data, time of first point * @param sourceId optional source id * @returns seismogramdisplaydata */ static fromContiguousData(yArray: Array | Int32Array | Float32Array | Float64Array, sampleRate: number, startTime: DateTime, sourceId?: FDSNSourceId): SeismogramDisplayData; static fromChannelAndTimeWindow(channel: Channel, timeRange: Interval): SeismogramDisplayData; static fromChannelAndTimes(channel: Channel, startTime: DateTime, endTime: DateTime): SeismogramDisplayData; static fromSourceIdAndTimes(sourceId: FDSNSourceId, startTime: DateTime, endTime: DateTime): SeismogramDisplayData; static fromCodesAndTimes(networkCode: string, stationCode: string, locationCode: string, channelCode: string, startTime: DateTime, endTime: DateTime): SeismogramDisplayData; addQuake(quake: Quake | Array): void; /** * Adds a public id for a Quake to the seismogram. For use in case where * the quake is not yet available, but wish to retain the connection. * @param publicId id of the earthquake assocated with this seismogram */ addQuakeId(publicId: string): void; addMarker(marker: MarkerType): void; addMarkers(markers: MarkerType | Array): void; getMarkers(): Array; clearMarkers(): void; addTravelTimes(ttimes: TraveltimeJsonType | TraveltimeArrivalType | Array): void; hasQuake(): boolean; get quake(): Quake | null; hasSeismogram(): this is { _seismogram: Seismogram; }; append(seismogram: SeismogramSegment | Seismogram): void; hasChannel(): this is { channel: Channel; }; hasSensitivity(): this is { _instrumentSensitivity: InstrumentSensitivity; }; /** * Allows id-ing a seismogram. Optional. * * @returns string id */ get id(): string | null; /** * Allows iding a seismogram. Optional. * * @param value string id */ set id(value: string | null); /** * return network code as a string. * Uses this.channel if it exists, this.seismogram if not. * * @returns network code */ get networkCode(): string; /** * return station code as a string. * Uses this.channel if it exists, this.seismogram if not. * * @returns station code */ get stationCode(): string; /** * return location code a a string. * Uses this.sourceId if it exists, this.seismogram if not. * * @returns location code */ get locationCode(): string; /** * return channels code as a string. * Uses this.sourceId if it exists, this.seismogram if not. * * @returns channel code */ get channelCode(): string; /** * return FDSN source id as a string. * Uses this.channel if it exists, this.seismogram if not. * * @returns FDSN source id */ get sourceId(): FDSNSourceId; /** * return network, station, location and channels codes as one string. * Uses this.channel if it exists, this.seismogram if not * * @returns net.sta.loc.chan */ get nslc(): string; get nslcId(): NslcId; /** * return network, station, location and channels codes as one string. * Uses this.channel if it exists, this.seismogram if not. * * @param sep separator, defaults to '.' * @returns nslc codes separated by sep */ codes(sep?: string): string; get startTime(): DateTime; get start(): DateTime; get endTime(): DateTime; get end(): DateTime; get numPoints(): number; associateChannel(nets: Array): void; alignStartTime(): void; alignOriginTime(): void; alignPhaseTime(phaseRegExp: RegExp | string): void; /** * Create a time window relative to the alignmentTime if set, or the start time if not. * Negative durations are allowed. * @param alignmentOffset offset duration from the alignment time * @param duration duration from the offset for the window * @returns time window as an Interval */ relativeTimeWindow(alignmentOffset: Duration, duration: Duration): Interval; get sensitivity(): InstrumentSensitivity | null; set sensitivity(value: InstrumentSensitivity | null); get min(): number; get max(): number; get mean(): number; get middle(): number; get seismogram(): Seismogram | null; set seismogram(value: Seismogram | null); get segments(): Array; calcStats(): SeismogramDisplayStats; /** * Calculates distance and azimuth for each event in quakeList. * * @returns Array of DistAzOutput, empty array if no quakes. */ get distazList(): Array; /** * Calculates distance and azimuth for the first event in quakeList. This is * a convienence method as usually there will only be one quake. * * @returns DistAzOutput, null if no quakes. */ get distaz(): null | DistAzOutput; clone(): SeismogramDisplayData; cloneWithNewSeismogram(seis: Seismogram | null): SeismogramDisplayData; /** * Cut the seismogram. Creates a new seismogramDisplayData with the cut * seismogram and the timeRange set to the new time window. * * @param timeRange start and end of cut * @returns new seismogramDisplayData */ cut(timeRange: Interval): null | SeismogramDisplayData; /** * Coarse trim the seismogram. Creates a new seismogramDisplayData with the * trimmed seismogram and the timeRange set to the new time window. * If timeRange is not given, the current time range of the * SeismogramDisplayData is used, effectively trimming data to the current * window. * * @param timeRange start and end of cut * @returns new seismogramDisplayData */ trim(timeRange?: Interval): null | SeismogramDisplayData; /** * Coarse trim the seismogram in place. The seismogram is * trimmed to the given time window. * If timeRange is not given, the current time range of the * SeismogramDisplayData is used, effectively trimming data to the current * window. * * @param timeRange start and end of cut */ trimInPlace(timeRange?: Interval): void; toString(): string; } export declare class SeismogramDisplayStats { min: number; max: number; mean: number; trendSlope: number; constructor(); get middle(): number; } export declare function findStartEnd(sddList: Array): Interval; export declare function findMaxDuration(sddList: Array): Duration; /** * Finds max duration of from one of starttime of sdd, origin time * of earthquake, or alignmentTime. * * @param type one of start, origin or align * @param sddList list of seis data * @returns max duration */ export declare function findMaxDurationOfType(type: string, sddList: Array): Duration; /** * Finds the min and max amplitude over the seismogram list, considering gain * and how to center the seismograms, either Raw, MinMax or Mean. * * @param sddList list of seismogramdisplaydata * @param doGain should gain be used * @param amplitudeMode centering style * @returns min max */ export declare function findMinMax(sddList: Array, doGain?: boolean, amplitudeMode?: AMPLITUDE_MODE): MinMaxable; export declare function findMinMaxOverTimeRange(sddList: Array, timeRange?: Interval | null, doGain?: boolean, amplitudeMode?: AMPLITUDE_MODE): MinMaxable; export declare function findMinMaxOverRelativeTimeRange(sddList: Array, alignmentOffset: Duration, duration: Duration, doGain?: boolean, amplitudeMode?: AMPLITUDE_MODE): MinMaxable; export declare function calcMinMax(sdd: SeismogramDisplayData, timeRange?: Interval | null, doGain?: boolean, amplitudeMode?: AMPLITUDE_MODE): MinMaxable | null; export declare function findStartEndOfSeismograms(data: Array, accumulator?: Interval): Interval; export declare function findMinMaxOfSeismograms(data: Array, minMaxAccumulator?: MinMaxable): MinMaxable; export declare function findMinMaxOfSDD(data: Array, minMaxAccumulator?: MinMaxable): MinMaxable; export declare function uniqueStations(seisData: Array): Array; export declare function uniqueChannels(seisData: Array): Array; export declare function uniqueLocationCodes(seisData: Array): string[]; export declare function uniqueBandCodes(seisData: Array): string[]; export declare function uniqueSourceCodes(seisData: Array): string[]; export declare function uniqueSubsourceCodes(seisData: Array): string[]; export declare function uniqueSourceIds(seisData: Array): FDSNSourceId[]; export declare function uniqueQuakes(seisData: Array): Array; //# sourceMappingURL=seismogram.d.mts.map