weather

package
v0.0.0-...-a7960c0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MOON_PHASES = [8]string{
	"🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘",
}
View Source
var MOON_PHASES_LOOKUP = map[string]int{
	"New Moon":        0,
	"Waxing Crescent": 1,
	"First Quarter":   2,
	"Waxing Gibbous":  3,
	"Full Moon":       4,
	"Waning Gibbous":  5,
	"Last Quarter":    6,
	"Waning Crescent": 7,
}
View Source
var WEATHER_SYMBOL = map[string]string{
	"Unknown":             "",
	"Cloudy":              "",
	"Fog":                 "",
	"HeavyRain":           "",
	"HeavyShowers":        "",
	"HeavySnow":           "",
	"HeavySnowShowers":    "",
	"LightRain":           "",
	"LightShowers":        "",
	"LightSleet":          "",
	"LightSleetShowers":   "",
	"LightSnow":           "",
	"LightSnowShowers":    "",
	"PartlyCloudy":        "",
	"Sunny":               "",
	"ThunderyHeavyRain":   "",
	"ThunderyShowers":     "",
	"ThunderySnowShowers": "",
	"VeryCloudy":          "",
}

weather Icons

View Source
var WEATHER_SYMBOL_WIDTH = map[string]int{
	"✨":  2,
	"☁️": 1,
	"🌫":  2,
	"🌧":  2,
	"❄️": 1,
	"🌦":  1,
	"🌨":  2,
	"⛅️": 2,
	"☀️": 1,
	"🌩":  2,
	"⛈":  1,
}

not used anymore

View Source
var WWO_CODE = map[string]string{
	"113": "Sunny",
	"116": "PartlyCloudy",
	"119": "Cloudy",
	"122": "VeryCloudy",
	"143": "Fog",
	"176": "LightShowers",
	"179": "LightSleetShowers",
	"182": "LightSleet",
	"185": "LightSleet",
	"200": "ThunderyShowers",
	"227": "LightSnow",
	"230": "HeavySnow",
	"248": "Fog",
	"260": "Fog",
	"263": "LightShowers",
	"266": "LightRain",
	"281": "LightSleet",
	"284": "LightSleet",
	"293": "LightRain",
	"296": "LightRain",
	"299": "HeavyShowers",
	"302": "HeavyRain",
	"305": "HeavyShowers",
	"308": "HeavyRain",
	"311": "LightSleet",
	"314": "LightSleet",
	"317": "LightSleet",
	"320": "LightSnow",
	"323": "LightSnowShowers",
	"326": "LightSnowShowers",
	"329": "HeavySnow",
	"332": "HeavySnow",
	"335": "HeavySnowShowers",
	"338": "HeavySnow",
	"350": "LightSleet",
	"353": "LightShowers",
	"356": "HeavyShowers",
	"359": "HeavyRain",
	"362": "LightSleetShowers",
	"365": "LightSleetShowers",
	"368": "LightSnowShowers",
	"371": "HeavySnowShowers",
	"374": "LightSleetShowers",
	"377": "LightSleet",
	"386": "ThunderyShowers",
	"389": "ThunderyHeavyRain",
	"392": "ThunderySnowShowers",
	"395": "HeavySnowShowers",
}

Functions

func Icon

func Icon(code string) string

func MoonIdx

func MoonIdx(key string) int

Types

type AreaName

type AreaName struct {
	Value string `json:"value"`
}

type Astronomy

type Astronomy struct {
	MoonIllumination string `json:"moon_illumination"`
	MoonPhase        string `json:"moon_phase"`
	Moonrise         string `json:"moonrise"`
	Moonset          string `json:"moonset"`
	Sunrise          string `json:"sunrise"`
	Sunset           string `json:"sunset"`
}

type Country

type Country struct {
	Value string `json:"value"`
}

type CurrentCondition

type CurrentCondition struct {
	FeelsLikeC       string           `json:"FeelsLikeC"`
	FeelsLikeF       string           `json:"FeelsLikeF"`
	Cloudcover       string           `json:"cloudcover"`
	Humidity         string           `json:"humidity"`
	LocalObsDateTime string           `json:"localObsDateTime"`
	ObservationTime  string           `json:"observation_time"`
	PrecipInches     string           `json:"precipInches"`
	PrecipMM         string           `json:"precipMM"`
	Pressure         string           `json:"pressure"`
	PressureInches   string           `json:"pressureInches"`
	TempC            string           `json:"temp_C"`
	TempF            string           `json:"temp_F"`
	UvIndex          string           `json:"uvIndex"`
	Visibility       string           `json:"visibility"`
	VisibilityMiles  string           `json:"visibilityMiles"`
	WeatherCode      string           `json:"weatherCode"`
	WeatherDesc      []WeatherDesc    `json:"weatherDesc"`
	WeatherIconURL   []WeatherIconURL `json:"weatherIconUrl"`
	Winddir16Point   string           `json:"winddir16Point"`
	WinddirDegree    string           `json:"winddirDegree"`
	WindspeedKmph    string           `json:"windspeedKmph"`
	WindspeedMiles   string           `json:"windspeedMiles"`
}

type EwwVariables

type EwwVariables struct {
	Location    string  `json:"location"`
	Feel        string  `json:"feelTemp"`
	Current     string  `json:"currentTemp"`
	CurrentIcon string  `json:"currentIcon"`
	CurrentDesc string  `json:"currentDesc"`
	MoonLable   string  `json:"moonLabel"`
	Moons       [8]Moon `json:"moons"`
	Hours       []Hour  `json:"hours"`
}

func NewEwwVariables

func NewEwwVariables(w WeatherForcast) EwwVariables

Only gives 3 day forcast

func (*EwwVariables) String

func (e *EwwVariables) String() string

type Hour

type Hour struct {
	Temp string `json:"temp"`
	Icon string `json:"icon"`
	Time string `json:"time"`
}

type Hourly

type Hourly struct {
	DewPointC        string           `json:"DewPointC"`
	DewPointF        string           `json:"DewPointF"`
	FeelsLikeC       string           `json:"FeelsLikeC"`
	FeelsLikeF       string           `json:"FeelsLikeF"`
	HeatIndexC       string           `json:"HeatIndexC"`
	HeatIndexF       string           `json:"HeatIndexF"`
	WindChillC       string           `json:"WindChillC"`
	WindChillF       string           `json:"WindChillF"`
	WindGustKmph     string           `json:"WindGustKmph"`
	WindGustMiles    string           `json:"WindGustMiles"`
	Chanceoffog      string           `json:"chanceoffog"`
	Chanceoffrost    string           `json:"chanceoffrost"`
	Chanceofhightemp string           `json:"chanceofhightemp"`
	Chanceofovercast string           `json:"chanceofovercast"`
	Chanceofrain     string           `json:"chanceofrain"`
	Chanceofremdry   string           `json:"chanceofremdry"`
	Chanceofsnow     string           `json:"chanceofsnow"`
	Chanceofsunshine string           `json:"chanceofsunshine"`
	Chanceofthunder  string           `json:"chanceofthunder"`
	Chanceofwindy    string           `json:"chanceofwindy"`
	Cloudcover       string           `json:"cloudcover"`
	Humidity         string           `json:"humidity"`
	PrecipInches     string           `json:"precipInches"`
	PrecipMM         string           `json:"precipMM"`
	Pressure         string           `json:"pressure"`
	PressureInches   string           `json:"pressureInches"`
	TempC            string           `json:"tempC"`
	TempF            string           `json:"tempF"`
	Time             string           `json:"time"`
	UvIndex          string           `json:"uvIndex"`
	Visibility       string           `json:"visibility"`
	VisibilityMiles  string           `json:"visibilityMiles"`
	WeatherCode      string           `json:"weatherCode"`
	WeatherDesc      []WeatherDesc    `json:"weatherDesc"`
	WeatherIconURL   []WeatherIconURL `json:"weatherIconUrl"`
	Winddir16Point   string           `json:"winddir16Point"`
	WinddirDegree    string           `json:"winddirDegree"`
	WindspeedKmph    string           `json:"windspeedKmph"`
	WindspeedMiles   string           `json:"windspeedMiles"`
}

type Moon

type Moon struct {
	Class string `json:"class"`
	Value string `json:"value"`
}

func Moons

func Moons(phase string) (moons [8]Moon)

type NearestArea

type NearestArea struct {
	AreaName   []AreaName   `json:"areaName"`
	Country    []Country    `json:"country"`
	Latitude   string       `json:"latitude"`
	Longitude  string       `json:"longitude"`
	Population string       `json:"population"`
	Region     []Region     `json:"region"`
	WeatherURL []WeatherURL `json:"weatherUrl"`
}

type Region

type Region struct {
	Value string `json:"value"`
}

type Request

type Request struct {
	Query string `json:"query"`
	Type  string `json:"type"`
}

type Weather

type Weather struct {
	Astronomy   []Astronomy `json:"astronomy"`
	AvgtempC    string      `json:"avgtempC"`
	AvgtempF    string      `json:"avgtempF"`
	Date        string      `json:"date"`
	Hourly      []Hourly    `json:"hourly"`
	MaxtempC    string      `json:"maxtempC"`
	MaxtempF    string      `json:"maxtempF"`
	MintempC    string      `json:"mintempC"`
	MintempF    string      `json:"mintempF"`
	SunHour     string      `json:"sunHour"`
	TotalSnowCm string      `json:"totalSnow_cm"`
	UvIndex     string      `json:"uvIndex"`
}

type WeatherDesc

type WeatherDesc struct {
	Value string `json:"value"`
}

type WeatherForcast

type WeatherForcast struct {
	CurrentCondition []CurrentCondition `json:"current_condition"`
	NearestArea      []NearestArea      `json:"nearest_area"`
	Request          []Request          `json:"request"`
	Weather          []Weather          `json:"weather"`
}

func GetWeatherData

func GetWeatherData() (w WeatherForcast, err error)

func (*WeatherForcast) Hours

func (w *WeatherForcast) Hours() []Hour

type WeatherIconURL

type WeatherIconURL struct {
	Value string `json:"value"`
}

type WeatherURL

type WeatherURL struct {
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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