seisplotjs-waveformplot

1.2.4

Usage

Generally either

import * as waveformplot from 'seisplotjs-waveformplot'
fdsndataselect.xxxx

or

import * as seisplotjs from 'seisplotjs'
seisplotjs.waveformplot.xxxx

Core Functionality

Core functions for using plotting seismic data

createParticleMotionBySelector

src/particleMotion.js
createParticleMotionBySelector(selector: string): void
Parameters
selector (string)
Returns
void

createPlotsBySelector

src/waveformplot.js
createPlotsBySelector(selector: string)
Parameters
selector (string)

Particle motion.

new ParticleMotion(inSvgParent: any, inSegments: Array<miniseed.model.Seismogram>, plotStartDate: moment, plotEndDate: moment)
Parameters
inSvgParent (any)
inSegments (Array<miniseed.model.Seismogram>)
plotStartDate (moment)
plotEndDate (moment)
Static Members
_lastID
Instance Members
plotId
segments
height
outerWidth
outerHeight
xLabel
xSublabel
yLabel
ySublabel
ySublabelTrans
yScaleFormat
xScale
xScaleRmean
xAxis
yScale
yScaleRmean
yAxis
svg
svgParent
checkResize()
drawParticleMotion(segA, segB)
drawAxis(svgG)
drawAxisLabels()
rescaleAxis()
calcScaleDomain()
setWidthHeight(nOuterWidth, nOuterHeight)
setTitle(value)
setXLabel(value)
setYLabel(value)
setXSublabel(value)
setYSublabel(value)

A seismogram plot, using d3. Note that you must have stroke and fill set in css like:
path.seispath { stroke: skyblue; fill: none; }
in order to have the seismogram display.

new Seismograph(inSvgParent: any, inSegments: Array<miniseed.model.Seismogram>, plotStartDate: moment, plotEndDate: moment)
Parameters
inSvgParent (any)
inSegments (Array<miniseed.model.Seismogram>)
plotStartDate (moment)
plotEndDate (moment)
Static Members
_lastID
Instance Members
plotId
beforeFirstDraw
xScaleFormat
yScaleFormat
xLabel
xSublabel
yLabel
ySublabel
ySublabelTrans
svgParent
segments
markers
markerTextOffset
markerTextAngle
width
height
outerWidth
outerHeight
segmentDrawCompressedCutoff
maxZoomPixelPerSample
scaleChangeListeners
svg
xScale
origXScale
currZoomXScale
yScale
yScaleRmean
lineFunc
zoom
xAxis
yAxis
throttleRescale
throttleResize
disableWheelZoom()
checkResize()
draw()
calcScaleAndZoom()
drawSegments(segments, svgG)
calcSecondsPerPixel(xScale)
segmentDrawLine(seg, xScale)
drawAxis(svgG)
rescaleYAxis()
drawAxisLabels()
resetZoom()
zoomed(mythis)
redrawWithXScale(xt)
drawMarkers(markers, markerG)
setWidthHeight(nOuterWidth, nOuterHeight)
throttle(func, delay)
resizeNeeded()
setPlotStart(value)
setPlotEnd(value)
setPlotStartEnd(startDate, endDate)
setWidth(value)
setHeight(value)
setMargin(value)
setTitle(value)
setXLabel(value)
setYLabel(value)
setXSublabel(value)
setYSublabel(value)
setTimeFormatter(formatter)
setAmplitudeFormatter(formatter)
clearMarkers()
getMarkers()
appendMarkers(value)
calcScaleDomain()
_internalAppend(seismogram)
append(seismogram)
trim(timeWindow)

calcClockOffset

src/util.js
calcClockOffset(serverTime: moment)
Parameters
serverTime (moment)

calcStartEndDates

src/util.js

Any two of start, end and duration can be specified, or just duration which then assumes end is now. start and end are Moment objects, duration is in seconds. clockOffset is the milliseconds that should be subtracted from the local time to get real world time, ie local - UTC or new Date().getTime() - serverDate.getTime() default is zero.

calcStartEndDates(start: moment, end: moment, duration: number, clockOffset: number)
Parameters
start (moment)
end (moment)
duration (number)
clockOffset (number)

findStartEnd

src/util.js
findStartEnd(data: (Array<miniseed.model.Seismogram> | miniseed.model.Seismogram), accumulator: TimeRangeType): TimeRangeType
Parameters
data ((Array<miniseed.model.Seismogram> | miniseed.model.Seismogram))
accumulator (TimeRangeType)
Returns
TimeRangeType

findMinMax

src/util.js
findMinMax(data: (Array<miniseed.model.Seismogram> | miniseed.model.Seismogram), minMaxAccumulator: Array<number>): Array<number>
Parameters
data ((Array<miniseed.model.Seismogram> | miniseed.model.Seismogram))
minMaxAccumulator (Array<number>)
Returns
Array<number>

Core Classes and Constants

Core classes returned from the above functions.

MarginType

Type: {top: number, right: number, bottom: number, left: number}

Properties
top (number)
right (number)
bottom (number)
left (number)

ScaleChangeListenerType

src/waveformplot.js
ScaleChangeListenerType

Type: {notifyScaleChange: function (value: any): void}

Properties
notifyScaleChange (function (value: any): void)
MarkerType

Type: {name: string, time: moment, type: string}

Properties
name (string)
time (moment)
type (string)

PlotDataType

src/util.js
PlotDataType

Type: {segments: Array<Array<miniseed.model.Seismogram>>, startDate: moment, endDate: moment, request: dataselect.DataSelectQuery, svgParent: any, responseText: string, statusCode: number}

Properties
segments (Array<Array<miniseed.model.Seismogram>>)
startDate (moment)
endDate (moment)
request (dataselect.DataSelectQuery)
svgParent (any)
responseText (string)
statusCode (number)

TimeWindow

src/util.js
TimeWindow

Type: {start: moment, end: moment}

Properties
start (moment)
end (moment)

Re-export

Re-exporting imported modules for easier reuse.

dataselect

src/util.js
dataselect

miniseed

src/util.js
miniseed
RSVP
d3
moment

Other

Stuff I forgot to put in the TOC.

Deprecated

Deprecated, do not use.

new chart(inSvgParent: any, inSegments: Array<miniseed.model.Seismogram>, plotStartDate: moment, plotEndDate: moment)

Extends Seismograph

Deprecated: use Seismograph
Parameters
inSvgParent (any)
inSegments (Array<miniseed.model.Seismogram>)
plotStartDate (moment)
plotEndDate (moment)

loadParse

src/util.js

loads and parses data into an array of miniseed records

loadParse(url: any, callback: any)
Deprecated: use seisplotjs-fdsndataselect to load data records
Parameters
url (any)
callback (any)

loadParseSplit

src/util.js
loadParseSplit(protocol: any, host: any, net: any, sta: any, loc: any, chan: any, startDate: any, endDate: any, callback: any)
Deprecated: use seisplotjs-fdsndataselect to load data records
Parameters
protocol (any)
host (any)
net (any)
sta (any)
loc (any)
chan (any)
startDate (any)
endDate (any)
callback (any)

loadParseSplitUrl

src/util.js
loadParseSplitUrl(url: any, callback: any)
Deprecated: use seisplotjs-fdsndataselect to load data records
Parameters
url (any)
callback (any)

formRequest

src/util.js
formRequest(protocol: any, host: any, net: any, sta: any, loc: any, chan: any, startDate: any, endDate: any)
Deprecated: use seisplotjs-fdsndataselect directly to create request
Parameters
protocol (any)
host (any)
net (any)
sta (any)
loc (any)
chan (any)
startDate (any)
endDate (any)

formRequestUrl

src/util.js
formRequestUrl(protocol: any, host: any, net: any, sta: any, loc: any, chan: any, startDate: any, endDate: any)
Deprecated: use seisplotjs-fdsndataselect to load data records
Parameters
protocol (any)
host (any)
net (any)
sta (any)
loc (any)
chan (any)
startDate (any)
endDate (any)

createPlotsBySelectorWithCallback

src/util.js

deprecated - use createPlotsBySelectorPromise instead.

create seismogram plots by selecting elements using the supplied css selector. Each element is expected to have attributes defined for net, sta, loc, chan and two of start, end and duration. Optionally, end will default to NOW if neither start or end are given, so only giving duration shows the most recent duration seconds from current time. Optionally, host may be given to choose an Fdsn FDSN dataselect web service for data retrieval, which defaults to service.iris.edu.

Note that css style for the selector should set both stoke to a color and fill to none in order for the seismogram to display. This can be done by:
yourselector { stroke: skyblue; fill: none; }

createPlotsBySelectorWithCallback(selector: string, callback: function (error: Error, dataRecords: Array<miniseed.DataRecord>): void)
Deprecated: use seisplotjs-fdsndataselect to load data records
Parameters
selector (string)
callback (function (error: Error, dataRecords: Array<miniseed.DataRecord>): void)

createPlotsBySelectorPromise

src/util.js

Returns an array of Promises, one per selected element.

createPlotsBySelectorPromise(selector: string): Promise<Array<PlotDataType>>
Parameters
selector (string)
Returns
Promise<Array<PlotDataType>>