Documentation
¶
Overview ¶
Package emsc is the library behind the emsc command line: the HTTP client, request shaping, and the typed data models for the EMSC FDSN event web service at seismicportal.eu.
The Client sets a real User-Agent, paces requests so a busy session stays polite, and retries transient failures (429 and 5xx). Build your endpoint calls on top of it.
Index ¶
- Constants
- type Client
- func (c *Client) GetCount(ctx context.Context, minMag float64) (int, error)
- func (c *Client) GetCountAt(ctx context.Context, baseURL string, minMag float64) (int, error)
- func (c *Client) SearchEvents(ctx context.Context, minMag, maxMag float64, startTime, endTime string, ...) ([]*Event, error)
- func (c *Client) SearchEventsAt(ctx context.Context, baseURL string, minMag, maxMag float64, ...) ([]*Event, error)
- type Config
- type Domain
- type Event
- type EventCount
Constants ¶
const BaseURL = "https://www.seismicportal.eu/fdsnws/event/1"
BaseURL is the root every request is built from.
const Host = "www.seismicportal.eu"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the EMSC FDSN event web service over HTTP.
func NewClientAt ¶
NewClientAt returns a Client with a custom base URL, useful for tests.
func (*Client) GetCountAt ¶
GetCountAt is like GetCount but uses a custom base URL; useful for tests.
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Retries int
Timeout time.Duration
UserAgent string
}
Config holds client settings.
type Domain ¶
type Domain struct{}
Domain is the EMSC driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Event ¶
type Event struct {
ID string `json:"id" kit:"id"` // = unid
Time string `json:"time,omitempty"`
Magnitude float64 `json:"magnitude,omitempty"`
MagType string `json:"mag_type,omitempty"`
Depth float64 `json:"depth_km,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Region string `json:"region,omitempty"`
Auth string `json:"auth,omitempty"`
EventType string `json:"event_type,omitempty"`
SourceCatalog string `json:"source_catalog,omitempty"`
}
Event is one seismic event from the EMSC catalogue.
type EventCount ¶
type EventCount struct {
Total int `json:"total"`
}
EventCount is the output type for the count operation.