weather

package
v0.0.0-...-512d48b Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AirQualityEvent

type AirQualityEvent struct {
	TimelineHeader
	// Name of the polluting item
	//
	// Do not localize the name. That should be handled by the watch.
	//
	// For particulate matter, use "PM0.1"`, "PM5", or "PM10".
	//
	// For chemicals, use the molecular formula ("NO2", "CO2", or "O3").
	//
	// For pollen, use the genus of the plant.
	Polluter string
	// Amount of pollution in SI units
	//
	// https://ec.europa.eu/environment/air/quality/standards.htm
	// http://www.ourair.org/wp-content/uploads/2012-aaqs2.pdf
	Amount uint32
}

AirQualityEvent corresponds to EventTypeAirQuality

type CloudsEvent

type CloudsEvent struct {
	TimelineHeader
	// Cloud coverage percentage
	Amount uint8
}

CloudsEvent corresponds to EventTypeClouds

type EventType

type EventType uint8

Type of weather event

const (
	EventTypeObscuration EventType = iota
	EventTypePrecipitation
	EventTypeWind
	EventTypeTemperature
	EventTypeAirQuality
	EventTypeSpecial
	EventTypePressure
	EventTypeLocation
	EventTypeClouds
	EventTypeHumidity
)

These event types correspond to structs that can be used to add an event to the weather timeline

type HumidityEvent

type HumidityEvent struct {
	TimelineHeader
	// Relative humidity percentage
	Humidity uint8
}

HumidityEvent corresponds to EventTypeHumidity

type LocationEvent

type LocationEvent struct {
	TimelineHeader
	// Location name
	Location string
	// Altitude from sea level in meters
	Altitude int16
	// EPSG:3857 latitude (Google Maps, Openstreetmaps)
	Latitude int32
	// EPSG:3857 longitude (Google Maps, Openstreetmaps)
	Longitude int32
}

LocationEvent corresponds to EventTypeLocation

type ObscurationEvent

type ObscurationEvent struct {
	TimelineHeader
	// Type of obscuration
	Type ObscurationType
	// Visibility in meters. 65535 is unspecified.
	Amount uint16
}

ObscurationEvent corresponds to EventTypeObscuration

type ObscurationType

type ObscurationType uint8

Visibility obscuration type

const (
	ObscurationTypeNone ObscurationType = iota
	ObscurationTypeFog
	ObscurationTypeHaze
	ObscurationTypeSmoke
	ObscurationTypeAsh
	ObscurationTypeDust
	ObscurationTypeSand
	ObscurationTypeMist
	ObscurationTypePrecipitation
)

See https://git.io/JM7Yd for the meaning of each type

type PrecipitationEvent

type PrecipitationEvent struct {
	TimelineHeader
	// Type of precipitation
	Type PrecipitationType
	// Amount of rain in millimeters. 255 is unspecified.
	Amount uint8
}

PrecipitationEvent corresponds to EventTypePrecipitation

type PrecipitationType

type PrecipitationType uint8

Precipitation type

const (
	PrecipitationTypeNone PrecipitationType = iota
	PrecipitationTypeRain
	PrecipitationTypeDrizzle
	PrecipitationTypeFreezingRain
	PrecipitationTypeSleet
	PrecipitationTypeHail
	PrecipitationTypeSmallHail
	PrecipitationTypeSnow
	PrecipitationTypeSnowGrains
	PrecipitationTypeIceCrystals
	PrecipitationTypeAsh
)

See https://git.io/JM7YM for the meaning of each type

type PressureEvent

type PressureEvent struct {
	TimelineHeader
	// Air pressure in hectopascals (hPa)
	Pressure int16
}

PressureEvent corresponds to EventTypePressure

type SpecialEvent

type SpecialEvent struct {
	TimelineHeader
	// Type of special event
	Type SpecialType
}

SpecialEvent corresponds to EventTypeSpecial

type SpecialType

type SpecialType uint8

Special event type

const (
	SpecialTypeSquall SpecialType = iota
	SpecialTypeTsunami
	SpecialTypeTornado
	SpecialTypeFire
	SpecialTypeThunder
)

See https://git.io/JM7Oe for the meaning of each type

type TemperatureEvent

type TemperatureEvent struct {
	TimelineHeader
	// Temperature in celcius multiplied by 100.
	// -32768 is "no data"
	Temperature int16
	// Dew point in celcius multiplied by 100.
	// -32768 is "no data"
	DewPoint int16
}

TemperatureEvent corresponds to EventTypeTemperature

type TimelineHeader

type TimelineHeader struct {
	// UNIX timestamp with timezone offset
	Timestamp uint64
	// Seconds until the event expires
	Expires uint32
	// Type of weather event
	EventType EventType
}

TimelineHeader contains the header for a timeline envent

func NewHeader

func NewHeader(evtType EventType, expires time.Duration) TimelineHeader

NewHeader creates and populates a new timeline header and returns it

type WindEvent

type WindEvent struct {
	TimelineHeader
	// Minimum speed in meters per second
	SpeedMin uint8
	// Maximum speed in meters per second
	SpeedMax uint8
	// Unitless direction, about 1 unit per 0.71 degrees.
	DirectionMin uint8
	// Unitless direction, about 1 unit per 0.71 degrees
	DirectionMax uint8
}

WindEvent corresponds to EventTypeWind

Jump to

Keyboard shortcuts

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