weather

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenMeteoAPIUrl = "https://api.open-meteo.com/v1/forecast"

	//
	CoordinatesNotFoundErrorMessage    = "coordinates section is required to evaluate weather"
	TemperatureNotFoundErrorMessage    = "temperature section is required to evaluate weather"
	HttpUrlParsingErrorMessage         = "error configuring http request: %s"
	HttpRequestFailedErrorMessage      = "error performing http request: %s"
	HttpResponseReadFailedErrorMessage = "error reading http response's body: %s"
)

Variables

This section is empty.

Functions

func IsColdDay

func IsColdDay(ctx *v1alpha1.Context) (bool, error)

IsColdDay return true when temperature's mean for the whole day is under the threshold defined on config

Types

type HourlySpec

type HourlySpec struct {
	Time                []string  `json:"time"`
	Temperature2m       []float64 `json:"temperature_2m"`
	ApparentTemperature []float64 `json:"apparent_temperature"`
}

HourlySpec TODO

type HourlyUnitsSpec

type HourlyUnitsSpec struct {
	Time                string `json:"time"`
	Temperature2m       string `json:"temperature_2m"`
	ApparentTemperature string `json:"apparent_temperature"`
}

HourlyUnitsSpec TODO

type OpenMeteoResponseSpec

type OpenMeteoResponseSpec struct {

	// Geographical WGS84 coordinate of the location
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`

	GenerationTimeMs float64 `json:"generationtime_ms"`

	UTCOffsetSeconds float64 `json:"utc_offset_seconds"`

	Timezone             string `json:"timezone"`
	TimezoneAbbreviation string `json:"timezone_abbreviation"`

	Elevation float64 `json:"elevation"`

	HourlyUnits HourlyUnitsSpec `json:"hourly_units"`

	Hourly HourlySpec `json:"hourly"`
}

OpenMeteoResponseSpec represents the fields available to be sent to Open Meteo. DISCLAIMER: NOT all the fields are covered. Only those that are considered useful to know if it's hot Ref: https://open-meteo.com/en/docs

func GetApiData

func GetApiData(ctx *v1alpha1.Context) (response *OpenMeteoResponseSpec, err error)

GetApiData TODO

Jump to

Keyboard shortcuts

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