Documentation ¶
Index ¶
- Constants
- Variables
- func ParseLocation(locationData string) (*loc.Point, error)
- func ParseWinds(windData string) (float64, float64, error)
- func RemoveEmpty(values []string) []string
- func SourceTypeAsString(sourceType int) (string, error)
- type Buoy
- type BuoyData
- type LocationSign
- type NauticalDate
- type Placemark
- type Source
- type XMLDoc
Constants ¶
const ( ALL = 0 INTERNATIONAL_PARTNERS = 1 IOOS_PARTNERS = 2 MARINE_METAR = 3 NDBC_METEOROLOGICAL_OCEAN = 4 NERRS = 5 NOS_CO_OPS = 6 SHIPS = 7 TAO = 8 TSUNAMI = 9 // NOAASourcesURL is the URL where all of the source data is supplied as KML NOAASourcesURL = "https://www.ndbc.noaa.gov/kml/marineobs_as_kml.php?sort=pgm" )
Variables ¶
var ( // NauticalRegex is a regular expression to find values between the parentheses NauticalRegex = regexp.MustCompile(`\((.*?)\)`) )
var ( SourceTypeMap = map[int]string{ INTERNATIONAL_PARTNERS: "International Partners", IOOS_PARTNERS: "IOOS Partners", MARINE_METAR: "Marine METAR", NDBC_METEOROLOGICAL_OCEAN: "NDBC Meteorological/Ocean", NERRS: "NERRS", NOS_CO_OPS: "NOS/CO-OPS", SHIPS: "Ships", TAO: "TAO", TSUNAMI: "Tsunami", } )
Functions ¶
func ParseLocation ¶
ParseLocation parses the latitude and longitude values out of string that can be retrieved from the KML
func ParseWinds ¶
ParseWinds converts the string wind information that can be retrieved from KML into the wind speed and gust information
func RemoveEmpty ¶
RemoveEmpty is a helper function that removes empty string values from the original list
func SourceTypeAsString ¶
SourceTypeAsString will convert the source type to a readable string. In the event that ALL is passed, then all strings are returned as a single string with a comma as a delimiter
Types ¶
type Buoy ¶
type Buoy struct { // Station is the station ID or ID of the buoy Station string `json:"station"` // Description is the string description for the Buoy // +optional Description string `json:"description,omitempty"` // Location is the geographical location of the buoy // +optional Location location.Point `json:"location,omitempty"` // Present is the current BuoyData associated with this Buoy // +optional Present *BuoyData `json:"data,omitempty"` // Past is a list of BuoyData structs that are from the Past // Deprecated: the past variable is still provided for user assistance, but // the value is considered deprecated and abandoned // +optional Past []*BuoyData `json:"past,omitempty"` // Determines whether the data stored in this stuct is considered valid // +optional Valid bool `json:"valid,omitempty"` }
Buoy represents a NOAA buoy.
func CreateBuoy ¶
CreateBuoy will provide a full workup for a specific buoy. When the buoy with matching station is not found, an error is returned.
func ParseCData ¶
ParseCData will parse the CDATA string that is pulled from the KML. On success, the returned Buoy structure should be altered as it will indicate that it was auto-filled. The Station and Description will need to be set to reflect valid Buoy information.
func (*Buoy) GetCurrentData ¶
GetCurrentData parses the current data for a buoy from the NOAA website
type BuoyData ¶
type BuoyData struct { // Year is the year the information was retrieved Year int `json:"year,omitempty"` // Month is the month the information was retrieved Month int `json:"mm,omitempty"` // Day is the day the information was retrieved Day int `json:"dd,omitempty"` // time of day that the information was retrieved Time *nt.NauticalTime `json:"time,omitempty"` // Wind Direction as a string: example `sse` WindDirection string `json:"wdir,omitempty"` // Wind Speed in knots WindSpeed float64 `json:"wspd,omitempty"` // Gust speed in knots Gust float64 `json:"gst,omitempty"` // Mean Wind Direction is the average wind direction MeanWindDirection string `json:"mwd,omitempty"` // Mean wind speed over a 10-minute period WindSpeed10Min float64 `json:"wspd10m,omitempty"` // Mean wind speed over a 20-minute period WindSpeed20Min float64 `json:"wspd20m,omitempty"` // Wave height in feet WaveHeight float64 `json:"wvht,omitempty"` // Dominant Wave Period in seconds DominantWavePeriod float64 `json:"dpd,omitempty"` // Average Wave Period in seconds AverageWavePeriod float64 `json:"apd,omitempty"` // Wind Wave Height in feet WindWaveHeight float64 `json:"wwh,omitempty"` // Wind Wave Period in seconds WindWavePeriod float64 `json:"wwp,omitempty"` // Direction of Waves due to wind WindWaveDirection string `json:"wwd,omitempty"` // Swell Height in feet SwellHeight float64 `json:"swh,omitempty"` // Swell Period in seconds SwellPeriod float64 `json:"swp,omitempty"` // Direction of Waves of the Swell SwellDirection string `json:"swd,omitempty"` // PSI Pressure float64 `json:"pres,omitempty"` // PSI PressureTendency float64 `json:"ptdy,omitempty"` // Deg F AirTemperature float64 `json:"atmp,omitempty"` // Deg F WaterTemperature float64 `json:"wtmp,omitempty"` // Deg F DewPoint float64 `json:"dewp,omitempty"` // Deg F OceanTemperature float64 `json:"otmp,omitempty"` Chill string `json:"chill,omitempty"` Heat string `json:"heat,omitempty"` // PSU Salinity float64 `json:"sal,omitempty"` PH string `json:"ph,omitempty"` // Oxygen percent in water OxygenPercent float64 `json:"o2pct,omitempty"` // Oxygen parts per million OxygenPPM float64 `json:"o2ppm,omitempty"` // Feet Depth float64 `json:"depth,omitempty"` NauticalMiles float64 `json:"nmi,omitempty"` // Nautical Miles Visibility float64 `json:"vis,omitempty"` // Feet Tide float64 `json:"tide,omitempty"` // Other features that Don't fit in other categories Steepness string `json:"steepness,omitempty"` Clcon string `json:"clcon,omitempty"` Turb string `json:"turb,omitempty"` Cond string `json:"cond,omitempty"` SRad1 string `json:"srad1,omitempty"` SWRad string `json:"swrad,omitempty"` LWRad string `json:"lwrad,omitempty"` }
BuoyData contains the scientific data associated with a Buoy
type LocationSign ¶
LocationSign contains the type (Latitude vs Longitude) and the sign/multiplier
type NauticalDate ¶
type NauticalDate struct { Month int Day int Year int Time *nt.NauticalTime }
NauticalDate is an extension of NauticalTime where the date information is also provided
func ParseTime ¶
func ParseTime(timeData string) (*NauticalDate, error)
ParseTime parses the time data out of cdata retrieved from KML data.
type Placemark ¶
type Placemark struct { // Name is the name tag in the Placemark that should match the // name of a Buoy Name string `xml:"name"` // Description is the description tag of the Placemark that should // match the description of the Buoy Description string `xml:"description"` // Placement is the location of the buoy Placement location.Point `xml:"LookAt"` }
Placemark is the xml structure for a Buoy. It is a very different format than the normal Buoy
type Source ¶
type Source struct { // Name of the Source corresponding to Source Type Name string `json:"name" xml:"name"` // Description for the Source Description string `json:"description,omitempty" xml:"description"` // Map of Buoys that are contained or associated with[in] this Source Buoys map[uint64]*Buoy `json:"buoys,omitempty"` // Placemarks are the xml version of the Buoy information. These // require additional parsing, so they are NOT interchangeable with // the Buoy Structs Placemarks []Placemark `xml:"Placemark"` }
Source represents a group of buoys. The Source also contains details about the grouping such as a description of why/how the buoys are grouped.
func FilterSourcesByType ¶
FilterSourcesByType filters out the unwanted source types
func GetBuoySources ¶
GetBuoySources will parse and create sources from the NOAA link: https://www.ndbc.noaa.gov/kml/marineobs_by_pgm.kml