sc3ml

package
v0.0.0-...-2b5b0d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sc3ml is for parsing SeisComPML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(b []byte, s *Seiscomp) error

Unmarshal unmarshals the SeisComPML in b and initialises all the objects referenced by ID in the SeisComPML e.g., PreferredOrigin, PreferredMagnitude etc.

Supported SC3ML versions are 0.7, 0.8, 0.9, 0.10, 0.11 Any other versions will result in a error.

Types

type Amplitude

type Amplitude struct {
	PublicID  string       `xml:"publicID,attr"`
	Amplitude RealQuantity `xml:"amplitude"`
	PickID    string       `xml:"pickID"`
	Azimuth   float64      // not in the SC3ML - will be mapped from arrival using PickID
	Distance  float64      // not in the SC3ML - will be mapped from arrival using PickID
}

type Arrival

type Arrival struct {
	PickID       string  `xml:"pickID"`
	Phase        string  `xml:"phase"`
	Azimuth      float64 `xml:"azimuth"`
	Distance     float64 `xml:"distance"`
	TimeResidual float64 `xml:"timeResidual"`
	Weight       float64 `xml:"weight"`
	Pick         Pick
}

type CreationInfo

type CreationInfo struct {
	AgencyID         string    `xml:"agencyID"`
	CreationTime     time.Time `xml:"creationTime"`
	ModificationTime time.Time `xml:"modificationTime"`
}

type Event

type Event struct {
	PublicID             string `xml:"publicID,attr"`
	PreferredOriginID    string `xml:"preferredOriginID"`
	PreferredMagnitudeID string `xml:"preferredMagnitudeID"`
	Type                 string `xml:"type"`
	PreferredOrigin      Origin
	PreferredMagnitude   Magnitude
	ModificationTime     time.Time    `xml:"-"` // most recent modification time for all objects in the event.  Not in the XML.
	CreationInfo         CreationInfo `xml:"creationInfo"`
}

type EventParameters

type EventParameters struct {
	Events     []Event     `xml:"event"`
	Picks      []Pick      `xml:"pick"`
	Amplitudes []Amplitude `xml:"amplitude"`
	Origins    []Origin    `xml:"origin"`
}

type IdpQuake

type IdpQuake struct {
	// contains filtered or unexported fields
}

IdpQuake can be used to implement an idempotent receiver for Quakes. Thread safe.

func (*IdpQuake) Add

func (i *IdpQuake) Add(q Quake)

Add adds Quake.

func (*IdpQuake) Seen

func (i *IdpQuake) Seen(q Quake) bool

Seen returns true if the Quake q has been previously seen via Add(). False otherwise. Quakes older than 60 minutes are evicted from i before checking for q.

type Magnitude

type Magnitude struct {
	PublicID                      string                         `xml:"publicID,attr"`
	Magnitude                     RealQuantity                   `xml:"magnitude"`
	Type                          string                         `xml:"type"`
	MethodID                      string                         `xml:"methodID"`
	StationCount                  int64                          `xml:"stationCount"`
	StationMagnitudeContributions []StationMagnitudeContribution `xml:"stationMagnitudeContribution"`
}

type Origin

type Origin struct {
	PublicID          string             `xml:"publicID,attr"`
	Time              TimeValue          `xml:"time"`
	Latitude          RealQuantity       `xml:"latitude"`
	Longitude         RealQuantity       `xml:"longitude"`
	Depth             RealQuantity       `xml:"depth"`
	DepthType         string             `xml:"depthType"`
	MethodID          string             `xml:"methodID"`
	EarthModelID      string             `xml:"earthModelID"`
	Quality           Quality            `xml:"quality"`
	EvaluationMode    string             `xml:"evaluationMode"`
	EvaluationStatus  string             `xml:"evaluationStatus"`
	Arrivals          []Arrival          `xml:"arrival"`
	StationMagnitudes []StationMagnitude `xml:"stationMagnitude"`
	Magnitudes        []Magnitude        `xml:"magnitude"`
}

type Pick

type Pick struct {
	PublicID         string     `xml:"publicID,attr"`
	Time             TimeValue  `xml:"time"`
	WaveformID       WaveformID `xml:"waveformID"`
	EvaluationMode   string     `xml:"evaluationMode"`
	EvaluationStatus string     `xml:"evaluationStatus"`
}

type Quake

type Quake struct {
	PublicID              string
	Type                  string
	AgencyID              string
	ModificationTime      time.Time
	Time                  time.Time
	Latitude              float64
	Longitude             float64
	Depth                 float64
	DepthType             string
	MethodID              string
	EarthModelID          string
	EvaluationMode        string
	EvaluationStatus      string
	UsedPhaseCount        int
	UsedStationCount      int
	StandardError         float64
	AzimuthalGap          float64
	MinimumDistance       float64
	Magnitude             float64
	MagnitudeUncertainty  float64
	MagnitudeType         string
	MagnitudeStationCount int
	Site                  string
}

Quake for earthquakes.

func FromSC3ML

func FromSC3ML(r io.Reader) (Quake, error)

func (*Quake) Alert

func (q *Quake) Alert() (bool, string)

Alert returns true if the quake should be considered for alerting, false with a reason if not.

func (*Quake) Certainty

func (q *Quake) Certainty() string

Certainty returns the CAP certainty for the quake.

func (*Quake) Manual

func (q *Quake) Manual() bool

manual returns true if the quake has been manually reviewed in some way.

func (*Quake) Publish

func (q *Quake) Publish() bool

Publish returns true if the quake should be considered for publishing.

func (*Quake) Quality

func (q *Quake) Quality() string

Quality returns a simplified quality.

func (*Quake) Status

func (q *Quake) Status() string

Status returns a simplified status.

type Quality

type Quality struct {
	UsedPhaseCount   int64   `xml:"usedPhaseCount"`
	UsedStationCount int64   `xml:"usedStationCount"`
	StandardError    float64 `xml:"standardError"`
	AzimuthalGap     float64 `xml:"azimuthalGap"`
	MinimumDistance  float64 `xml:"minimumDistance"`
}

type RealQuantity

type RealQuantity struct {
	Value       float64 `xml:"value"`
	Uncertainty float64 `xml:"uncertainty"`
}

type Seiscomp

type Seiscomp struct {
	XMLns           string          `xml:"xmlns,attr"`
	EventParameters EventParameters `xml:"EventParameters"`
}

type StationMagnitude

type StationMagnitude struct {
	PublicID    string       `xml:"publicID,attr"`
	Magnitude   RealQuantity `xml:"magnitude"`
	Type        string       `xml:"type"`
	AmplitudeID string       `xml:"amplitudeID"`
	WaveformID  WaveformID   `xml:"waveformID"`
	Amplitude   Amplitude
}

type StationMagnitudeContribution

type StationMagnitudeContribution struct {
	StationMagnitudeID string  `xml:"stationMagnitudeID"`
	Weight             float64 `xml:"weight"`
	Residual           float64 `xml:"residual"`
	StationMagnitude   StationMagnitude
}

type TimeValue

type TimeValue struct {
	Value time.Time `xml:"value"`
}

type WaveformID

type WaveformID struct {
	NetworkCode  string `xml:"networkCode,attr"`
	StationCode  string `xml:"stationCode,attr"`
	LocationCode string `xml:"locationCode,attr"`
	ChannelCode  string `xml:"channelCode,attr"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL