weather

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 7 Imported by: 2 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

weather

release-candidate  Build Status

What temperature was it?

$ go install github.com/scheibo/weather
$ ./weather -latlng="37.423327,-122.078086" -time="2018-09-06 10:06:00"
PARTLY-CLOUDY-DAY
19.0°C / 60% (~19.0°C)
1.1 km/h (8.0 km/h) W (278.0°)
1.209 kg/m³ / 1018.98 mbar
UV: 3 / CC: 77%
(6:44 AM / 7:31 PM)

The generated GoDoc can be viewed at godoc.org/github.com/scheibo/weather.

Documentation

Index

Constants

View Source
const PIRATE_WEATHER = "https://api.pirateweather.net/forecast"

Variables

View Source
var ICONS = []string{
	"clear-day", "clear-night", "rain", "snow", "sleet", "wind",
	"fog", "cloudy", "partly-cloudy-day", "partly-cloudy-night",
}

Functions

func DarkSky

func DarkSky(key string) func(*options)

func Direction

func Direction(b float64) string

func TimeZone

func TimeZone(loc *time.Location) func(*options)

Types

type Client

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

func NewClient

func NewClient(opts ...func(*options)) *Client

func (*Client) At

func (c *Client) At(ll geo.LatLng, t time.Time) (*Conditions, error)

func (*Client) Current

func (c *Client) Current(ll geo.LatLng) (*Conditions, error)

func (*Client) Forecast

func (c *Client) Forecast(ll geo.LatLng) (*Forecast, error)

func (*Client) History

func (c *Client) History(ll geo.LatLng, t time.Time) (*Conditions, error)

func (*Client) Now

func (c *Client) Now(ll geo.LatLng) (*Conditions, error)

type Conditions

type Conditions struct {
	Icon                string    `json:"icon",omitempty"`
	Time                time.Time `json:"time",omitempty"`
	Temperature         float64   `json:"temperature,omitempty"`
	Humidity            float64   `json:"humidity,omitempty"`
	ApparentTemperature float64   `json:"apparentTemperature,omitempty"`
	PrecipProbability   float64   `json:"precipProbability,omitempty"`
	PrecipIntensity     float64   `json:"precipIntensity,omitempty"`
	PrecipType          string    `json:"precipType"`
	AirPressure         float64   `json:"airPressure,omitempty"`
	AirDensity          float64   `json:"airDensity,omitempty"`
	CloudCover          float64   `json:"cloudCover,omitempty"`
	UVIndex             float64   `json:"uvIndex,omitempty"`
	WindSpeed           float64   `json:"windSpeed,omitempty"`
	WindGust            float64   `json:"windGust,omitempty"`
	WindBearing         float64   `json:"windBearing,omitempty"`
	SunriseTime         time.Time `json:"sunriseTime",omitempty"`
	SunsetTime          time.Time `json:"sunsetTime",omitempty"`
}

func Average

func Average(cs []*Conditions) *Conditions

func DarkSkyToConditions

func DarkSkyToConditions(h *darksky.DataPoint, d *darksky.DataPoint, loc *time.Location) *Conditions

func (*Conditions) Precip

func (c *Conditions) Precip() string

func (*Conditions) String

func (c *Conditions) String() string

func (*Conditions) Wind

func (c *Conditions) Wind() string

type Forecast

type Forecast struct {
	Hourly []*Conditions
}

Directories

Path Synopsis
weather provides a CLI for querying what temperature it was at a particular time
weather provides a CLI for querying what temperature it was at a particular time

Jump to

Keyboard shortcuts

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