barista.run: barista.run/modules/weather Index | Files | Directories

package weather

import "barista.run/modules/weather"

Package weather provides an i3bar module that displays weather info.

Index

Package Files

direction.go weather.go

type Condition Uses

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 Uses

type Direction int

Direction represents a compass direction stored as degrees.

func (Direction) Cardinal Uses

func (d Direction) Cardinal() string

Cardinal returns the cardinal direction.

func (Direction) Deg Uses

func (d Direction) Deg() int

Deg returns the direction in meteorological degrees.

type Module Uses

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

Module represents a bar.Module that displays weather information.

func New Uses

func New(provider Provider) *Module

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

func (*Module) Output Uses

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 Uses

func (m *Module) Refresh()

Refresh fetches updated weather information.

func (*Module) RefreshInterval Uses

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

RefreshInterval configures the polling frequency.

func (*Module) Stream Uses

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

Stream starts the module.

type Provider Uses

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

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

type Weather Uses

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 Uses

type Wind struct {
    unit.Speed
    Direction
}

Wind stores the wind speed and direction together.

Directories

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

Package weather imports 8 packages (graph) and is imported by 5 packages. Updated 2019-10-12. Refresh now. Tools for package owners.