weather

package
Version: v0.0.0-...-c0445ee Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package weather provides an i3bar module that displays weather info.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition int

Condition represents a weather condition.

const (
	ConditionUnknown Condition = iota
	Thunderstorm
	Drizzle
	Rain
	Snow
	Sleet
	Mist
	Smoke
	Whirls
	Haze
	Fog
	Clear
	Cloudy
	PartlyCloudy
	Overcast
	Tornado
	TropicalStorm
	Hurricane
	Cold
	Hot
	Windy
	Hail
)

Possible weather conditions

type Direction

type Direction int

Direction represents a compass direction stored as degrees.

func (Direction) Cardinal

func (d Direction) Cardinal() string

Cardinal returns the cardinal direction.

func (Direction) Deg

func (d Direction) Deg() int

Deg returns the direction in meteorological degrees.

type Module

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

Module represents a bar.Module that displays weather information.

func New

func New(provider Provider) *Module

New constructs an instance of the weather module with the provided configuration.

func (*Module) Output

func (m *Module) Output(outputFunc func(Weather) bar.Output) *Module

Output configures a module to display the output of a user-defined function.

func (*Module) Refresh

func (m *Module) Refresh()

Refresh fetches updated weather information.

func (*Module) RefreshInterval

func (m *Module) RefreshInterval(interval time.Duration) *Module

RefreshInterval configures the polling frequency.

func (*Module) Stream

func (m *Module) Stream(s bar.Sink)

Stream starts the module.

type Provider

type Provider interface {
	GetWeather() (Weather, error)
}

Provider is an interface for weather providers, implemented by the various provider packages.

type Weather

type Weather struct {
	Location    string
	Condition   Condition
	Description string
	Temperature unit.Temperature
	Humidity    float64
	Pressure    unit.Pressure
	Wind        Wind
	CloudCover  float64
	Sunrise     time.Time
	Sunset      time.Time
	Updated     time.Time
	Attribution string
}

Weather represents the current weather conditions.

type Wind

type Wind struct {
	unit.Speed
	Direction
}

Wind stores the wind speed and direction together.

Directories

Path Synopsis
Package darksky provides weather using the Dark Sky API, available at https://darksky.net/.
Package darksky provides weather using the Dark Sky API, available at https://darksky.net/.
Package metar provides weather using the METAR API from the NOAA Aviation Digital Data Service, available at https://www.aviationweather.gov/.
Package metar provides weather using the METAR API from the NOAA Aviation Digital Data Service, available at https://www.aviationweather.gov/.
Package openweathermap provides weather using the OpenWeatherMap API, available at https://openweathermap.org/api.
Package openweathermap provides weather using the OpenWeatherMap API, available at https://openweathermap.org/api.

Jump to

Keyboard shortcuts

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