aemet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HttpClient *http.Client
}

func (*Client) City

func (c *Client) City(cityCode string) (*Location, error)

type DailyForecast

type DailyForecast struct {
	DateStr string `xml:"fecha,attr"`

	SkyStates []struct {
		Hour        int    `xml:"periodo,attr"`
		Description string `xml:"descripcion,attr"`
		State       string `xml:",chardata"`
	} `xml:"estado_cielo" json:"-"`
	HourlySkyState map[int]string

	Precipitations []struct {
		Hour   int     `xml:"periodo,attr"`
		Amount float32 `xml:",chardata"`
	} `xml:"precipitations" json:"-"`
	HourlyPrecipitation map[int]float32

	POPs []struct {
		Period     string `xml:"periodo,attr"`
		POPPercent int    `xml:",chardata"`
	} `xml:"prob_precipitacion" json:"-"`
	HourlyPOP map[int]int

	Temperatures []struct {
		Hour        int `xml:"periodo,attr"`
		Temperature int `xml:",chardata"`
	} `xml:"temperatura" json:"-"`
	HourlyTemperature map[int]int

	ThermalFeels []struct {
		Hour        int `xml:"periodo,attr"`
		ThermalFeel int `xml:",chardata"`
	} `xml:"sens_termica" json:"-"`
	HourlyThermalFeel map[int]int

	Humidities []struct {
		Hour            int `xml:"periodo,attr"`
		HumidityPercent int `xml:",chardata"`
	} `xml:"humedad_relativa" json:"-"`
	HourlyHumidity map[int]int
}

type Location

type Location struct {
	Name          string `xml:"nombre"`
	Region        string `xml:"provincia"`
	ElaboratedStr string `xml:"elaborado"`

	Forecasts      []DailyForecast `xml:"prediccion>dia" json:"-"`
	DailyForecasts map[string]*DailyForecast
}

func City

func City(cityCode string) (*Location, error)

func (*Location) At

func (l *Location) At(t time.Time) *ParsedForecast

func (*Location) NextHours

func (l *Location) NextHours(n int) []*ParsedForecast

type ParsedForecast

type ParsedForecast struct {
	Elaborated      time.Time
	Location        string
	DateStr         string
	Hour            int
	SkyState        string
	Precipitation   float32
	POPPercent      int
	Temperature     int
	ThermalFeel     int
	HumidityPercent int
}

func (*ParsedForecast) String

func (pf *ParsedForecast) String() string

Jump to

Keyboard shortcuts

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