forecast

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: EUPL-1.2 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataBlockElement  = "doubleOrNilReasonTupleList"
	DataRecordElement = "DataRecord"
	TimePeriodElement = "TimePeriod"
)
View Source
const FMI_API_ENDPOINT = "" /* 158-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type DataBlock

type DataBlock struct {
	XMLName xml.Name `xml:"doubleOrNilReasonTupleList"`
	Content string   `xml:",innerxml"`
}

type DataField

type DataField struct {
	Name string `xml:"name,attr"`
}

type DataRecord

type DataRecord struct {
	XMLName xml.Name    `xml:"DataRecord"`
	Fields  []DataField `xml:"field"`
}

type Forecast

type Forecast struct {
	BeginTime time.Time `json:"beginTime"`
	EndTime   time.Time `json:"endTime"`
	Records   []Record  `json:"records"`
}

Forecast represents the weather forecast for the given time frame

func Place

func Place(place string) (Forecast, error)

Place consumes the string of where to fetch forecast for and returns fully parsed Forecast instance for usage.

func (Forecast) ToJSON

func (f Forecast) ToJSON() (bytes.Buffer, error)

ToJSON converts forecast data to easily consumable JSON. bytes.Buffer can be used to convert the buffer to strings or bytes, depending of usage.

type Record

type Record struct {
	DateTime time.Time `json:"dateTime"`

	Pressure                   float64 `json:"pressure"`
	GeopHeight                 float64 `json:"geopHeight"`
	Temperature                float64 `json:"temperature"`
	DewPoint                   float64 `json:"dewPoint"`
	Humidity                   float64 `json:"humidity"`
	WindDirection              float64 `json:"windDirection"`
	WindSpeedMS                float64 `json:"windSpeedMS"`
	WindVectorMS               float64 `json:"windVectorMS"`
	WindUMS                    float64 `json:"windUMS"`
	WindVMS                    float64 `json:"windVMS"`
	PrecipitationType          float64 `json:"precipitationType"`
	PrecipitationForm          float64 `json:"precipitationForm"`
	TotalCloudCover            float64 `json:"totalCloudCover"`
	PoP                        float64 `json:"PoP"`
	ProbabilityThunderstorm    float64 `json:"probabilityThunderstorm"`
	MiddleAndLowCloudCover     float64 `json:"middleAndLowCloudCover"`
	LowCloudCover              float64 `json:"lowCloudCover"`
	MediumCloudCover           float64 `json:"mediumCloudCover"`
	HighCloudCover             float64 `json:"highCloudCover"`
	RadiationLW                float64 `json:"radiationLW"`
	RadiationGlobal            float64 `json:"radiationGlobal"`
	FogIntensity               float64 `json:"fogIntensity"`
	WeatherSymbol1             float64 `json:"weatherSymbol1"`
	WeatherSymbol3             float64 `json:"weatherSymbol3"`
	Precipitation1h            float64 `json:"precipitation1h"`
	FrostProbability           float64 `json:"frostProbability"`
	SevereFrostProbability     float64 `json:"severeFrostProbability"`
	HourlyMaximumWindSpeed     float64 `json:"hourlyMaximumWindSpeed"`
	HourlyMaximumGust          float64 `json:"hourlyMaximumGust"`
	PotentialPrecipitationForm float64 `json:"potentialPrecipitationForm"`
	PotentialPrecipitationType float64 `json:"potentialPrecipitationType"`
	WeatherNumber              float64 `json:"weatherNumber"`
}

Record has individual data points related for the given time. Record contains forecast info for the whole hour.

func (Record) MarshalJSON

func (r Record) MarshalJSON() ([]byte, error)

type TimePeriod

type TimePeriod struct {
	XMLName       xml.Name  `xml:"TimePeriod"`
	BeginPosition time.Time `xml:"beginPosition"`
	EndPosition   time.Time `xml:"endPosition"`
}

func (*TimePeriod) UnmarshalXML

func (t *TimePeriod) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

Jump to

Keyboard shortcuts

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