stations

package
v0.0.0-...-43c2a68 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultStationsEndpoint = "https://opendap.co-ops.nos.noaa.gov/stations/stationsXML.jsp"

DefaultStationsEndpoint is the default stations endpoint from NOAA.

View Source
const MaxStationsSearchChunkSize = 10

MaxStationsSearchChunkSize is used when searching for nearest station with goroutines

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL           string
	HTTPClient    lib.HTTPGetter
	StationsCache []Station
}

Client interacts with NOAA.

func NewClient

func NewClient() *Client

NewClient creates a new NOAAStationClient with the default URL.

func (*Client) GetNearestStation

func (s *Client) GetNearestStation(coords lib.GeoCoordinates) *StationDistance

GetNearestStation gets the nearest station to a given set of coordinates.

func (*Client) GetStations

func (s *Client) GetStations(skipCache bool) []Station

GetStations .

type GetStationResponse

type GetStationResponse struct {
	XMLName  xml.Name  `xml:"stations"`
	Stations []Station `xml:"station"`
}

GetStationResponse represents a response to retrieving the station data

type Station

type Station struct {
	XMLName      xml.Name            `xml:"station"`
	Name         string              `xml:"name,attr"`
	ID           int                 `xml:"ID,attr"`
	Metadata     StationMetadata     `xml:"metadata"`
	Capabilities []StationCapability `xml:"parameter"`
}

Station represents a station

type StationCapability

type StationCapability struct {
	XMLName  xml.Name `xml:"parameter"`
	Name     string   `xml:"name,attr"`
	SensorID string   `xml:"sensorID,attr"`
	DCP      int      `xml:"DCP,attr"`
	Status   int      `xml:"status,attr"`
}

StationCapability specifies one NOAA capability for the NOAA API.

type StationDistance

type StationDistance struct {
	Distance float64
	From     lib.GeoCoordinates
	Station  Station
}

StationDistance describes the distance from a set of coordinates to a station.

type StationLocation

type StationLocation struct {
	XMLName xml.Name `xml:"location"`
	Lat     float64  `xml:"lat"`
	Long    float64  `xml:"long"`
	State   string   `xml:"state"`
}

StationLocation contains information about the station's location.

type StationMetadata

type StationMetadata struct {
	XMLName         xml.Name        `xml:"metadata"`
	Location        StationLocation `xml:"location"`
	DateEstablished string          `xml:"date_established"`
}

StationMetadata contains metadata about a station.

Jump to

Keyboard shortcuts

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