v2

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package v2 contains the type definitions for WeatherMeasurepoint v2.

All types have accessor methods to access fields which can be chained on nils. This makes it possible to easily drill down into deeply nested data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectType

func ObjectType() trv.ObjectType

Types

type Aggregated

type Aggregated struct {
	// contains filtered or unexported fields
}

func (*Aggregated) Precipitation

func (x *Aggregated) Precipitation() *PrecipitationConditionAggregated

func (*Aggregated) UnmarshalXML

func (x *Aggregated) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Aggregated) Wind

type AirCondition

type AirCondition struct {
	// contains filtered or unexported fields
}

func (*AirCondition) CloudFree

func (x *AirCondition) CloudFree() *bool

SV: Förekomst av tillräckligt klart väder för att vara av vikt för vägytans temperatur.

func (*AirCondition) Dewpoint

func (x *AirCondition) Dewpoint() *Celsius

SV: Daggpunkt, den temperatur där vatten kondenserar. Value [C]

func (*AirCondition) RelativeHumidity

func (x *AirCondition) RelativeHumidity() *Percentage

SV: Relativ luftfuktighet. Andel av den fukt som luften kan bära. Vid 100% är luften mättad. Value [%]

func (*AirCondition) Temperature

func (x *AirCondition) Temperature() *Celsius

SV: Lufttemperatur. Value [C]

func (*AirCondition) UnmarshalXML

func (x *AirCondition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*AirCondition) VisibleDistance

func (x *AirCondition) VisibleDistance() *Meters

SV: Den sträcka det finns sikt. Value [m]

type Celsius

type Celsius struct {
	// contains filtered or unexported fields
}

func (*Celsius) Origin

func (x *Celsius) Origin() *Origin

SV: Mätvärdets ursprung

func (*Celsius) SensorNames

func (x *Celsius) SensorNames() *string

SV: Sensorernas beteckning

func (*Celsius) UnmarshalXML

func (x *Celsius) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Celsius) Value

func (x *Celsius) Value() *float64

type Degrees

type Degrees struct {
	// contains filtered or unexported fields
}

func (*Degrees) Origin

func (x *Degrees) Origin() *Origin

SV: Mätvärdets ursprung

func (*Degrees) SensorNames

func (x *Degrees) SensorNames() *string

SV: Sensorernas beteckning

func (*Degrees) UnmarshalXML

func (x *Degrees) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Degrees) Value

func (x *Degrees) Value() *int

type DeicingChemical

type DeicingChemical struct {
	// contains filtered or unexported fields
}

func (*DeicingChemical) Amount

func (x *DeicingChemical) Amount() *GramPerSquareMeter

SV: Mängd salt vid mätpunkten. Value g/kvm

func (*DeicingChemical) UnmarshalXML

func (x *DeicingChemical) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Geometry

type Geometry struct {
	// contains filtered or unexported fields
}

func (*Geometry) SWEREF99TM

func (x *Geometry) SWEREF99TM() *string

SV: Geometrisk punkt som observationen avser i koordinatsystem SWEREF99TM

func (*Geometry) UnmarshalXML

func (x *Geometry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Geometry) WGS84

func (x *Geometry) WGS84() *string

SV: Geometrisk punkt som observationen avser i koordinatsystem WGS84

type GramPerSquareMeter

type GramPerSquareMeter struct {
	// contains filtered or unexported fields
}

func (*GramPerSquareMeter) Origin

func (x *GramPerSquareMeter) Origin() *Origin

SV: Mätvärdets ursprung

func (*GramPerSquareMeter) SensorNames

func (x *GramPerSquareMeter) SensorNames() *string

SV: Sensorernas beteckning

func (*GramPerSquareMeter) UnmarshalXML

func (x *GramPerSquareMeter) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*GramPerSquareMeter) Value

func (x *GramPerSquareMeter) Value() *float64

type Grip

type Grip struct {
	// contains filtered or unexported fields
}

func (*Grip) Origin

func (x *Grip) Origin() *Origin

SV: Mätvärdets ursprung

func (*Grip) SensorNames

func (x *Grip) SensorNames() *string

SV: Sensorernas beteckning

func (*Grip) UnmarshalXML

func (x *Grip) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Grip) Value

func (x *Grip) Value() *float64

type GroundCondition

type GroundCondition struct {
	// contains filtered or unexported fields
}

func (*GroundCondition) Depth

func (x *GroundCondition) Depth() *IntegerCentimeters

SV: Det djup som observationen avser och är negativt för att återspegla att det avser under markytan. Value [cm]

func (*GroundCondition) Temperature

func (x *GroundCondition) Temperature() *Celsius

SV: Temperatur (grader celsius) vid ett visst djup i marken. Value [C]

func (*GroundCondition) UnmarshalXML

func (x *GroundCondition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type IntegerCentimeters

type IntegerCentimeters struct {
	// contains filtered or unexported fields
}

func (*IntegerCentimeters) Origin

func (x *IntegerCentimeters) Origin() *Origin

SV: Mätvärdets ursprung

func (*IntegerCentimeters) SensorNames

func (x *IntegerCentimeters) SensorNames() *string

SV: Sensorernas beteckning

func (*IntegerCentimeters) UnmarshalXML

func (x *IntegerCentimeters) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*IntegerCentimeters) Value

func (x *IntegerCentimeters) Value() *int

type Meters

type Meters struct {
	// contains filtered or unexported fields
}

func (*Meters) Origin

func (x *Meters) Origin() *Origin

SV: Mätvärdets ursprung

func (*Meters) SensorNames

func (x *Meters) SensorNames() *string

SV: Sensorernas beteckning

func (*Meters) UnmarshalXML

func (x *Meters) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Meters) Value

func (x *Meters) Value() *float64

type MetersPerSecond

type MetersPerSecond struct {
	// contains filtered or unexported fields
}

func (*MetersPerSecond) Origin

func (x *MetersPerSecond) Origin() *Origin

SV: Mätvärdets ursprung

func (*MetersPerSecond) SensorNames

func (x *MetersPerSecond) SensorNames() *string

SV: Sensorernas beteckning

func (*MetersPerSecond) UnmarshalXML

func (x *MetersPerSecond) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*MetersPerSecond) Value

func (x *MetersPerSecond) Value() *float64

type Millimeters

type Millimeters struct {
	// contains filtered or unexported fields
}

func (*Millimeters) Origin

func (x *Millimeters) Origin() *Origin

SV: Mätvärdets ursprung

func (*Millimeters) SensorNames

func (x *Millimeters) SensorNames() *string

SV: Sensorernas beteckning

func (*Millimeters) UnmarshalXML

func (x *Millimeters) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Millimeters) Value

func (x *Millimeters) Value() *float64

type Observation

type Observation struct {
	// contains filtered or unexported fields
}

func (*Observation) Aggregated10minutes

func (x *Observation) Aggregated10minutes() *Aggregated

func (*Observation) Aggregated30minutes

func (x *Observation) Aggregated30minutes() *Aggregated

func (*Observation) Aggregated5minutes

func (x *Observation) Aggregated5minutes() *Aggregated

func (*Observation) Air

func (x *Observation) Air() *AirCondition

func (*Observation) DeicingChemical

func (x *Observation) DeicingChemical() *DeicingChemical

func (*Observation) ID

func (x *Observation) ID() *string

SV: Unik publiceringsidentitet för observationen.

func (*Observation) Sample

func (x *Observation) Sample() *time.Time

SV: Tidpunkt som observationen avser, inklusive tidzon för att hantera sommartid och normaltid.

func (*Observation) Subsurface

func (x *Observation) Subsurface() *SubsurfaceCondition

func (*Observation) Surface

func (x *Observation) Surface() *SurfaceCondition

func (*Observation) UnmarshalXML

func (x *Observation) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Observation) Weather

func (x *Observation) Weather() *Weather

func (*Observation) Wind

func (x *Observation) Wind() []WindCondition

type Origin added in v0.7.1

type Origin string

SV: Mätvärdets ursprung

const (
	OriginCalculated Origin = "calculated"
	OriginMeasured   Origin = "measured"
	OriginEstimated  Origin = "estimated"
)

type Percentage

type Percentage struct {
	// contains filtered or unexported fields
}

func (*Percentage) Origin

func (x *Percentage) Origin() *Origin

SV: Mätvärdets ursprung

func (*Percentage) SensorNames

func (x *Percentage) SensorNames() *string

SV: Sensorernas beteckning

func (*Percentage) UnmarshalXML

func (x *Percentage) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Percentage) Value

func (x *Percentage) Value() *float64

type PrecipTypeMeasure added in v0.7.1

type PrecipTypeMeasure string
const (
	PrecipTypeMeasureNo           PrecipTypeMeasure = "no"
	PrecipTypeMeasureRain         PrecipTypeMeasure = "rain"
	PrecipTypeMeasureFreezingRain PrecipTypeMeasure = "freezing_rain"
	PrecipTypeMeasureSnow         PrecipTypeMeasure = "snow"
	PrecipTypeMeasureSleet        PrecipTypeMeasure = "sleet"
	PrecipTypeMeasureYes          PrecipTypeMeasure = "yes"
)

type PrecipitationConditionAggregated

type PrecipitationConditionAggregated struct {
	// contains filtered or unexported fields
}

func (*PrecipitationConditionAggregated) Rain

SV: Förekomst av regn.

func (*PrecipitationConditionAggregated) RainSum

SV: Mängd regn under perioden. Value [mm]

func (*PrecipitationConditionAggregated) Snow

SV: Förekomst av snö.

func (*PrecipitationConditionAggregated) SnowSum

func (x *PrecipitationConditionAggregated) SnowSum() *Snow

SV: Mängd snö under perioden.

func (*PrecipitationConditionAggregated) TotalWaterEquivalent

func (x *PrecipitationConditionAggregated) TotalWaterEquivalent() *Millimeters

SV: Mängd vatten som nederbörden under perioden motsvarar. Value [mm]

func (*PrecipitationConditionAggregated) UnmarshalXML

type Response

type Response struct {
	XMLName xml.Name `xml:"RESPONSE"`
	Results []struct {
		Info struct {
			LastModified trv.LastModified `xml:"LASTMODIFIED"`
			LastChangeID string           `xml:"LASTCHANGEID"`
			EvalResult   []any            `xml:"EVALRESULT"`
			SSEURL       string           `xml:"SSEURL"`
		} `xml:"INFO"`
		Error *trv.APIError         `xml:"ERROR"`
		Data  []WeatherMeasurepoint `xml:"WeatherMeasurepoint"`
	} `xml:"RESULT"`
}

Response can be used to decode the response from the API.

For example:

package main

import (
	 "encoding/xml"
	 api "code.dny.dev/trafikinfo/trv/weathermeasurepoint/v2"
)

func main() {
	var res api.Response
	err := xml.Unmarshal(data, &res)
}

func (Response) ErrorMsg

func (r Response) ErrorMsg() string

Errors returns a slice of trv.Error, if any error was included in the response.

func (Response) HasErrors

func (r Response) HasErrors() bool

HasErrors returns whether any of the results includes an error.

type Snow

type Snow struct {
	// contains filtered or unexported fields
}

func (*Snow) Solid

func (x *Snow) Solid() *Millimeters

SV: Mängd snö. Value [mm]

func (*Snow) UnmarshalXML

func (x *Snow) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Snow) WaterEquivalent

func (x *Snow) WaterEquivalent() *Millimeters

SV: Mängd vatten som snön motsvarar i smält form. Value [mm]

type SubsurfaceCondition

type SubsurfaceCondition struct {
	// contains filtered or unexported fields
}

func (*SubsurfaceCondition) Ground

func (x *SubsurfaceCondition) Ground() []GroundCondition

func (*SubsurfaceCondition) UnmarshalXML

func (x *SubsurfaceCondition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type SurfaceCondition

type SurfaceCondition struct {
	// contains filtered or unexported fields
}

func (*SurfaceCondition) Grip

func (x *SurfaceCondition) Grip() *Grip

SV: Value [0-1]

func (*SurfaceCondition) Ice

func (x *SurfaceCondition) Ice() *bool

SV: Förekomst av is på vägytan.

func (*SurfaceCondition) IceDepth

func (x *SurfaceCondition) IceDepth() *Millimeters

SV: Isdjup på vägytan. Value [mm]

func (*SurfaceCondition) Snow

func (x *SurfaceCondition) Snow() *bool

SV: Förekomst av snö på vägytan.

func (*SurfaceCondition) SnowDepth

func (x *SurfaceCondition) SnowDepth() *Snow

SV: Snödjup på vägytan.

func (*SurfaceCondition) Temperature

func (x *SurfaceCondition) Temperature() *Celsius

SV: Vägytans temperatur. Value [C]

func (*SurfaceCondition) UnmarshalXML

func (x *SurfaceCondition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*SurfaceCondition) Water

func (x *SurfaceCondition) Water() *bool

SV: Förekomst av vatten på vägytan.

func (*SurfaceCondition) WaterDepth

func (x *SurfaceCondition) WaterDepth() *Millimeters

SV: Vattendjup på vägytan. Value [mm]

type Weather

type Weather struct {
	// contains filtered or unexported fields
}

func (*Weather) Precipitation

func (x *Weather) Precipitation() *PrecipTypeMeasure

SV: Vilken typ av nederbörd som detekterats

func (*Weather) UnmarshalXML

func (x *Weather) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type WeatherMeasurepoint

type WeatherMeasurepoint struct {
	// contains filtered or unexported fields
}

func (*WeatherMeasurepoint) Deleted

func (x *WeatherMeasurepoint) Deleted() *bool

SV: Anger att dataposten raderats EN: Indicates that the data record has been deleted

func (*WeatherMeasurepoint) Geometry

func (x *WeatherMeasurepoint) Geometry() *Geometry

func (*WeatherMeasurepoint) ID

func (x *WeatherMeasurepoint) ID() *string

SV: Unik identitet för en mätpunkt

func (*WeatherMeasurepoint) ModifiedTime

func (x *WeatherMeasurepoint) ModifiedTime() *time.Time

SV: Tidpunkt då dataposten ändrades i cachen EN: Time when the data item was changed in the cache

func (*WeatherMeasurepoint) Name

func (x *WeatherMeasurepoint) Name() *string

SV: Mätpunktens namn

func (*WeatherMeasurepoint) Observation

func (x *WeatherMeasurepoint) Observation() *Observation

func (*WeatherMeasurepoint) UnmarshalXML

func (x *WeatherMeasurepoint) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type WindCondition

type WindCondition struct {
	// contains filtered or unexported fields
}

func (*WindCondition) Direction

func (x *WindCondition) Direction() *Degrees

SV: Mått på vindriktning vid en viss tidpunkt. Medelvärde över tiominutersperiod t.o.m. tidpunkten. Value [grader]

func (*WindCondition) Height

func (x *WindCondition) Height() *WindSensorHeight

func (*WindCondition) Speed

func (x *WindCondition) Speed() *MetersPerSecond

SV: Mått på vindhastighet vid en viss tidpunkt. Medelvärde över tiominutersperiod t.o.m. tidpunkten. Value m/s

func (*WindCondition) UnmarshalXML

func (x *WindCondition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type WindConditionAggregated

type WindConditionAggregated struct {
	// contains filtered or unexported fields
}

func (*WindConditionAggregated) Height

func (*WindConditionAggregated) SpeedAverage

func (x *WindConditionAggregated) SpeedAverage() *MetersPerSecond

SV: Value m/s

func (*WindConditionAggregated) SpeedMax

SV: Högst uppmätt 3-sekundersmedelvärde under perioden. Value m/s

func (*WindConditionAggregated) UnmarshalXML

func (x *WindConditionAggregated) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type WindSensorHeight added in v0.7.1

type WindSensorHeight int

SV: Vindsensorns höjdplacering [m]

const (
	WindSensorHeight6  WindSensorHeight = 6
	WindSensorHeight10 WindSensorHeight = 10
)

Jump to

Keyboard shortcuts

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