Documentation ¶
Index ¶
- type CurrentData
- type DailyWeatherSlice
- type FeelsLikeStats
- type HourlyWeatherSlice
- type Rain
- type Snow
- type TemperatureStats
- type WeatherData
- func (weather WeatherData) AverageFeelsLikeTill(referenceTime time.Time) float64
- func (weather WeatherData) AverageTemperatureTill(referenceTime time.Time) float64
- func (weather WeatherData) CumulativePrecipitationTill(referenceTime time.Time) float64
- func (weather WeatherData) String() string
- func (weather WeatherData) TemperatureAt(referenceTime time.Time) float64
- func (weather *WeatherData) WeatherAt(referenceTime time.Time) *HourlyWeatherSlice
- func (weather WeatherData) WeatherTill(referenceTime time.Time) []HourlyWeatherSlice
- type WeatherDescription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrentData ¶
type CurrentData struct { Timestamp int64 `json:"dt"` Sunrise int64 `json:"sunrise"` Sunset int64 `json:"sunset"` Temperature float64 `json:"temp"` FeelsLike float64 `json:"feels_like"` Pressure float64 `json:"pressure"` Humidity uint8 `json:"humidity"` DewPoint float64 `json:"dew_point"` UVI float64 `json:"uvi"` Clouds uint8 `json:"clouds"` Visiblity uint64 `json:"visibility"` WindSpeed float64 `json:"wind_speed"` WindDirection float64 `json:"wind_deg"` Weather []WeatherDescription `json:"weather"` Rain Rain `json:"rain"` Snow Snow `json:"snow"` ParsedTime *time.Time }
CurrentData represents the current weather conditions
type DailyWeatherSlice ¶
type DailyWeatherSlice struct { Timestamp int64 `json:"dt"` Sunrise int64 `json:"sunrise"` Sunset int64 `json:"sunset"` Temperature TemperatureStats `json:"temp"` FeelsLike FeelsLikeStats `json:"feels_like"` Pressure float64 `json:"pressure"` Humidity uint8 `json:"humidity"` DewPoint float64 `json:"dew_point"` WindSpeed float64 `json:"wind_speed"` WindDirection float64 `json:"wind_deg"` Weather []WeatherDescription `json:"weather"` Clouds uint8 `json:"clouds"` Rain float64 `json:"rain"` Snow float64 `json:"snow"` UVI float64 `json:"uvi"` ParsedTime *time.Time }
DailyWeatherSlice represents one element in the daily forecast
type FeelsLikeStats ¶
type FeelsLikeStats struct { Day float64 `json:"day"` Night float64 `json:"night"` Evening float64 `json:"eve"` Morning float64 `json:"morn"` }
FeelsLikeStats contains daily feels-like temperature statistics
type HourlyWeatherSlice ¶
type HourlyWeatherSlice struct { Timestamp int64 `json:"dt"` Temperature float64 `json:"temp"` FeelsLike float64 `json:"feels_like"` Pressure float64 `json:"pressure"` Humidity uint8 `json:"humidity"` DewPoint float64 `json:"dew_point"` Clouds uint8 `json:"clouds"` WindSpeed float64 `json:"wind_speed"` WindDirection float64 `json:"wind_deg"` Weather []WeatherDescription `json:"weather"` Rain Rain `json:"rain"` Snow Snow `json:"snow"` ParsedTime *time.Time }
HourlyWeatherSlice represents one element in the hourly forecast
type TemperatureStats ¶
type TemperatureStats struct { Day float64 `json:"day"` Min float64 `json:"min"` Max float64 `json:"max"` Night float64 `json:"night"` Evening float64 `json:"eve"` Morning float64 `json:"morn"` }
TemperatureStats contains daily temperature statistics
type WeatherData ¶
type WeatherData struct { Latitude float64 `json:"lat"` Longitude float64 `json:"lon"` Timezone string `json:"timezone"` TimezoneOffset uint16 `json:"timezone_offset"` Current CurrentData `json:"current"` HourlyWeather []HourlyWeatherSlice `json:"hourly"` DailyWeather []DailyWeatherSlice `json:"daily"` ParsedTimeZone *time.Location }
WeatherData holds the weather information returned by the OWM API
func GetWeather ¶
func GetWeather(lat float64, lon float64, APIKey string) (*WeatherData, error)
GetWeather performs an API call for the location given through lat,lon using the APIkey
func (WeatherData) AverageFeelsLikeTill ¶
func (weather WeatherData) AverageFeelsLikeTill(referenceTime time.Time) float64
AverageFeelsLikeTill returns the average feels like temperature from the beginning of the data range till referenceTime
func (WeatherData) AverageTemperatureTill ¶
func (weather WeatherData) AverageTemperatureTill(referenceTime time.Time) float64
AverageTemperatureTill returns the average temperature from the beginning of the data range till referenceTime
func (WeatherData) CumulativePrecipitationTill ¶
func (weather WeatherData) CumulativePrecipitationTill(referenceTime time.Time) float64
CumulativePrecipitationTill returns the cumulative precipitation from the beginning of the data range till referenceTime
func (WeatherData) String ¶
func (weather WeatherData) String() string
func (WeatherData) TemperatureAt ¶
func (weather WeatherData) TemperatureAt(referenceTime time.Time) float64
TemperatureAt returns the temperature for the given referenceTime
func (*WeatherData) WeatherAt ¶
func (weather *WeatherData) WeatherAt(referenceTime time.Time) *HourlyWeatherSlice
WeatherAt returns the weather closest to referenceTime
func (WeatherData) WeatherTill ¶
func (weather WeatherData) WeatherTill(referenceTime time.Time) []HourlyWeatherSlice
WeatherTill returns all weather slices from the beginning of the forecast to the given time