Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeWaveform(wave Waveform) ([]byte, error)
- func J2KSeconds(t time.Time) float64
- func TimeFromJ2K(seconds float64) time.Time
- type Channel
- type Client
- type Command
- type Consumer
- type ErrorHooks
- type Hooks
- type Instrument
- type Product
- type ProductConsumer
- type ProductRequest
- type Provider
- type SCNL
- type Server
- type TraceBuf
- type TraceBufConsumer
- type Waveform
- type WaveformHandler
- type WaveformRequest
Constants ¶
const J2KEpoch = 946728000000
epoch used by Winston: 2000-01-01 12:00:00 UTC.
Variables ¶
var ErrNoData = errors.New("winsgo: no data")
Functions ¶
func EncodeWaveform ¶
EncodeWaveform produces the big-endian binary representation used in a Winston GETWAVERAW response and by volcano-core's Wave.toBinary().
func J2KSeconds ¶
J2KSeconds converts a time to decimal seconds since J2KEpoch.
func TimeFromJ2K ¶
TimeFromJ2K converts decimal J2K seconds to a UTC time.
Types ¶
type Channel ¶
type Channel struct {
ID int
SCNL SCNL
StartTime time.Time
EndTime time.Time
Instrument Instrument
Alias string
Unit string
LinearA float64
LinearB float64
Groups []string
Metadata map[string]string
}
Channel describes one channel advertised by MENU and GETCHANNELS.
type Consumer ¶
type Consumer interface {
Consume(context.Context, WaveformRequest, WaveformHandler) error
}
Consumer fulfills waveform requests. It may return ErrNoData without invoking the handler when no waveform overlaps the requested interval.
type ErrorHooks ¶
ErrorHooks may be implemented in addition to Hooks to observe the reason a connection handler is closing.
type Hooks ¶
type Hooks interface {
OnConnection(*Client)
OnCommand(*Client, Command)
OnData(*Client, []byte)
OnClose(*Client)
}
Hooks observes server activity. Hook methods must return quickly and must not retain or modify byte slices passed to OnData.
type Instrument ¶
type Instrument struct {
ID int
Name string
Description string
Longitude float64
Latitude float64
Height float64
TimeZone string
Metadata map[string]string
}
Instrument contains the station metadata returned by GETMETADATA.
type Product ¶
type Product int
Product identifies an optional Winston binary derived-data response.
type ProductConsumer ¶
type ProductConsumer interface {
ConsumeProduct(context.Context, ProductRequest, func([]byte) error) error
}
ProductConsumer optionally overrides server-side derivation of Winston binary products. The callback accepts the uncompressed, Winston-compatible representation.
type ProductRequest ¶
type ProductRequest struct {
WaveformRequest
Product Product
Period int
}
ProductRequest describes GETSCNLHELIRAW and GETSCNLRSAMRAW requests.
type Provider ¶
Provider supplies the channel catalog. It is deliberately separate from the waveform Consumer so metadata and waveform data may come from different systems.
type SCNL ¶
SCNL identifies a seismic channel by station, channel, network, and location.
type Server ¶
type Server struct {
Provider Provider
Consumer Consumer
MaxCommandSize int
// DisableHelicorder disables the GETSCNLHELIRAW command. Clients that send
// GETSCNLHELIRAW will receive an unsupported-command error.
DisableHelicorder bool
// contains filtered or unexported fields
}
Server implements Winston Wave Server protocol version 3.
type TraceBufConsumer ¶
type TraceBufConsumer interface {
ConsumeTraceBuf(context.Context, WaveformRequest, func(TraceBuf) error) error
}
TraceBufConsumer optionally enables GETSCNRAW and GETSCNLRAW. Raw records are not synthesized from Waveform because Winston promises to return their original form.
type Waveform ¶
type Waveform struct {
StartTime time.Time
SampleRate float64
RegistrationOffset float64
Samples []int32
// DataType defaults to "s4", the Earthworm signed 32-bit sample type.
DataType string
}
Waveform is Winston's regularly sampled, signed 32-bit waveform type.
type WaveformHandler ¶
WaveformHandler delivers a waveform to the server. A Consumer must call the handler at most once and must not call it after Consume returns.
