ndbc

package module
v0.0.0-...-18c7326 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: GPL-3.0 Imports: 8 Imported by: 1

README

NDBC - National Data Buoy Center

This is a simple Golang wrapper for parsing data from the NDBC.

There weren't any packages that I could find that performed the functions I needed, so I wrote this one. Woefully incomplete in it's current state but PRs are welcome.

I do intend to fully flesh this out at some point in the future, but for now it solves the immediate problem I had.

Usage

Craete a new wrapper

n := ndbc.NewAPI()

Call any of the exported functions

resp, err := n.GetPictureFromBuoy(44027)
if err != nil {
    panic(err)
}

log.Println(resp)

resp2, err := n.GetLatestDataFromBuoy(44027)
if err != nil {
    panic(err)
}

log.Println(resp2)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bouy

type Bouy struct {
	ID      int    `json:"id"`
	Picture []byte `json:"picture"`

	MeteorologicalData MeteorologicalData `json:"meteorological_data"`
}

type MeteorologicalData

type MeteorologicalData struct {
	Timestamp     time.Time `json:"timestamp"`
	WindDirection string    `json:"wind_direction"`
	WindSpeed     float64   `json:"wind_speed"`
	GustSpeed     float64   `json:"gust_speed"`
}

type NDBC

type NDBC struct{}

func NewAPI

func NewAPI() *NDBC

func (*NDBC) GetLatestDataFromBuoy

func (n *NDBC) GetLatestDataFromBuoy(id int) (MeteorologicalData, error)

func (*NDBC) GetPictureFromBuoy

func (n *NDBC) GetPictureFromBuoy(id int) ([]byte, error)

Jump to

Keyboard shortcuts

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