@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
182 lines (181 loc) • 6.12 kB
TypeScript
import { Duration } from "luxon";
/** enum for amplitude modes, RAW, ZERO, MINMAX, MEAN */
export declare enum AMPLITUDE_MODE {
Raw = "raw",// raw values, no centering
Zero = "zero",// same as Raw, but also includes zero
MinMax = "minmax",// centered on midpoint of min-max
Mean = "mean"
}
export declare class MinMaxable {
min: number;
max: number;
constructor(min: number, max: number);
get middle(): number;
get halfWidth(): number;
get fullWidth(): number;
union(omm?: MinMaxable): MinMaxable;
expandPercentage(percent: number): MinMaxable;
/**
* This as a d3 style 2 element array.
*
* @returns length 2 array of min then max
*/
asArray(): [number, number];
toString(): string;
/**
* Create MinMaxable from a d3 style two element array.
*
* @param minmax array of min then max
* @returns new MinMaxable
*/
static fromArray(minmax: number[]): MinMaxable;
static fromMiddleHalfWidth(mid: number, halfWidth: number): MinMaxable;
}
export declare class AmplitudeScalable {
minMax: MinMaxable;
constructor(minMax?: MinMaxable);
notifyAmplitudeChange(_middle: number, _halfWidth: number): void;
get middle(): number;
get halfWidth(): number;
get fullWidth(): number;
get min(): number;
get max(): number;
toString(): string;
}
export declare class TimeScalable {
alignmentTimeOffset: Duration;
duration: Duration;
constructor(alignmentTimeOffset: Duration, duration: Duration);
notifyTimeRangeChange(_alignmentTimeOffset: Duration, _duration: Duration): void;
}
/**
* Links amplitude scales across multiple seismographs, respecting doRmean.
*
* @param graphList optional list of AmplitudeScalable to link
*/
export declare class LinkedAmplitudeScale {
/**
* @private
*/
_graphSet: Set<AmplitudeScalable>;
_halfWidth: number;
_recalcTimeoutID: ReturnType<typeof setTimeout> | null;
_scaleId: number;
constructor(graphList?: Array<AmplitudeScalable>);
get halfWidth(): number;
set halfWidth(val: number);
/**
* Links new Seismograph with this amplitude scale.
*
* @param graphList Array of AmplitudeScalable to link
*/
linkAll(graphList: Array<AmplitudeScalable | {
amp_scalable: AmplitudeScalable;
}>): void;
/**
* Link new Seismograph with this amplitude scale.
*
* @param graph AmplitudeScalable to link
*/
link(graph: AmplitudeScalable | {
amp_scalable: AmplitudeScalable;
}): void;
/**
* Unlink Seismograph with this amplitude scale.
*
* @param graph AmplitudeScalable to unlink
*/
unlink(graph: AmplitudeScalable): void;
/**
* Recalculate the best amplitude scale for all Seismographs. Causes a redraw.
*
* @returns array of promise of best amp scales
*/
recalculate(): Promise<Array<AmplitudeScalable>>;
_internalNotifyAll(): Promise<Array<AmplitudeScalable>>;
notifyAll(): Promise<Array<AmplitudeScalable>>;
get graphList(): AmplitudeScalable[];
}
export declare class IndividualAmplitudeScale extends LinkedAmplitudeScale {
constructor(graphList?: Array<AmplitudeScalable>);
recalculate(): Promise<Array<AmplitudeScalable>>;
notifyAll(): Promise<Array<AmplitudeScalable>>;
}
export declare class FixedHalfWidthAmplitudeScale extends LinkedAmplitudeScale {
constructor(halfWidth: number, graphList?: Array<AmplitudeScalable>);
recalculate(): Promise<Array<AmplitudeScalable>>;
notifyAll(): Promise<Array<AmplitudeScalable>>;
}
/**
* Links time scales across multiple seismographs.
*
* @param graphList optional list of TimeScalables to link
*/
export declare class LinkedTimeScale {
/**
* @private
*/
_graphSet: Set<TimeScalable>;
_originalDuration: Duration;
_originalOffset: Duration;
_zoomedDuration: null | Duration;
_zoomedOffset: null | Duration;
_scaleId: number;
constructor(graphList?: Array<TimeScalable>, originalDuration?: Duration, originalOffset?: Duration, scaleId?: number);
/**
* Link new TimeScalable with this time scale.
*
* @param graph TimeScalable to link
*/
link(graph: TimeScalable | {
time_scalable: TimeScalable;
}): void;
/**
* Links TimeScalable with this time scale. Each
* object in the array should either be a TimeScalable
* or have a time_scalable field that is a TimeScalable.
*
* @param graphList Array of TimeScalable to link
*/
linkAll(graphList: Array<TimeScalable | {
time_scalable: TimeScalable;
}>): void;
/**
* Unlink TimeScalable with this amplitude scale.
*
* @param graph TimeScalable to unlink
*/
unlink(graph: TimeScalable): void;
zoom(startOffset: Duration, duration: Duration): void;
unzoom(): void;
get offset(): Duration;
set offset(offset: Duration);
get duration(): Duration;
set duration(duration: Duration);
get origOffset(): Duration;
get origDuration(): Duration;
/**
* Recalculate the best time scale for all Seismographs. Causes a redraw.
* @returns promise to array of all linked items
*/
recalculate(): Promise<Array<TimeScalable>>;
notifyAll(): Promise<Array<TimeScalable>>;
get graphList(): TimeScalable[];
}
/**
* Linked Time Scale that only modifies the alignment via the offset. The
* duration of the linked TimeScalable is reused.
* @param graphList [description]
* @param originalDuration [description]
* @param originalOffset [description]
* @param scaleId [description]
*/
export declare class AlignmentLinkedTimeScale extends LinkedTimeScale {
constructor(graphList?: Array<TimeScalable>, originalDuration?: Duration, originalOffset?: Duration, scaleId?: number);
/**
* Does no calculation, just causes a redraw.
* @returns promise to all linked items
*/
recalculate(): Promise<Array<TimeScalable>>;
notifyAll(): Promise<Array<TimeScalable>>;
}