weatherdata

package
v0.0.0-...-5ef28d8 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WeatherData

type WeatherData struct {
	Credit   weatherCredit     `xml:"credit>link"`
	Location weatherLocation   `xml:"location"`
	Meta     WeatherMeta       `xml:"meta"`
	Sun      sun               `xml:"sun"`
	Forecast []WeatherForecast `xml:"forecast>tabular>time"`
}

WeatherData contains actual weather data

func LoadWeatherData

func LoadWeatherData(place string, cc bool) (wd WeatherData, err error)

LoadWeatherData loads xml from yr and returns a struct

func (WeatherData) SunHours

func (wd WeatherData) SunHours() float64

SunHours represents number of hours sun is up

type WeatherForecast

type WeatherForecast struct {
	From     customTimeAttr `xml:"from,attr"`
	To       customTimeAttr `xml:"to,attr"`
	Period   int            `xml:"period,attr"`
	Pressure struct {
		Unit  string  `xml:"unit,attr"`
		Value float32 `xml:"value,attr"`
	} `xml:"pressure"`
	Precipitation struct {
		Value float32 `xml:"value,attr"`
		Min   float32 `xml:"minvalue,attr"`
		Max   float32 `xml:"maxvalue,attr"`
	} `xml:"precipitation"`
	Symbol struct {
		Name   string `xml:"name,attr"`
		Number int    `xml:"number,attr"`
	} `xml:"symbol"`
	Temperature struct {
		Unit  string `xml:"unit,attr"`
		Value int    `xml:"value,attr"`
	} `xml:"temperature"`
	WindDirection struct {
		Deg  float32 `xml:"deg,attr"`
		Code string  `xml:"code,attr"`
		Name string  `xml:"name,attr"`
	} `xml:"windDirection"`
	WindSpeed struct {
		Mps  float32 `xml:"mps,attr"`
		Name string  `xml:"name,attr"`
	} `xml:"windSpeed"`
}

WeatherForecast contains actual forecast

func (WeatherForecast) PeriodName

func (wf WeatherForecast) PeriodName() string

PeriodName returns period as text

type WeatherMeta

type WeatherMeta struct {
	LastUpdate customTime `xml:"lastupdate"`
	NextUpdate customTime `xml:"nextupdate"`
}

WeatherMeta contains metadata about the forecast

func (WeatherMeta) HoursSinceUpdate

func (wm WeatherMeta) HoursSinceUpdate() float64

HoursSinceUpdate returns hours since last update

func (WeatherMeta) HoursToNextUpdate

func (wm WeatherMeta) HoursToNextUpdate() float64

HoursToNextUpdate returns hours until next update

Jump to

Keyboard shortcuts

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