odlinfo

package
v0.0.0-...-d8edaa1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UrlApi            = "https://odlinfo.bfs.de/json"
	UrlApiStatistics  = UrlApi + "/stat.json"
	UrlApiStationList = UrlApi + "/stamm.json"
	UrlApiStationData = UrlApi + "/{kenn}.json"
)

Variables

This section is empty.

Functions

func FetchStationData

func FetchStationData(kenn string, c *colly.Collector, cb func(StationData), ecb cfac.ErrorCallback)

func FetchStations

func FetchStations(c *colly.Collector, cb func(StationInfo), ecb cfac.ErrorCallback)

func FetchStatistics

func FetchStatistics(c *colly.Collector, cb func(Statistics), ecb cfac.ErrorCallback)

Types

type Callback

type Callback func(Statistics)

type CustomDate

type CustomDate struct {
	time.Time
}

func (*CustomDate) UnmarshalJSON

func (c *CustomDate) UnmarshalJSON(b []byte) error

type CustomTime

type CustomTime struct {
	time.Time
}

func (*CustomTime) UnmarshalJSON

func (c *CustomTime) UnmarshalJSON(b []byte) error

type Measurement

type Measurement struct {
	Time        time.Time
	Value       float64
	CheckStatus bool
	RainProp    float64
}

type ResponseStammInfo

type ResponseStammInfo map[string]StationInfo

type StationData

type StationData struct {
	Info   StationInfo        `json:"stamm"`
	Avg1h  TimeseriesExtended `json:"mw1"`
	Avg24h Timeseries         `json:"mw24"`
}

type StationInfo

type StationInfo struct {
	Ort       string  `json:"ort"`
	ID        string  `json:"kenn"`
	PLZ       int     `json:"plz,string"`
	Status    int     `json:"status"`
	KID       int     `json:"kid"`
	Altitude  int     `json:"hoehe"`
	Longitude float64 `json:"lon"`
	Latitude  float64 `json:"lat"`
	Value     float64 `json:"mw"` // in µSv/h
	IMIS      string  `json:"imis"`
}

type Statistics

type Statistics struct {
	OperationalCount int `json:"betriebsbereit"`
	MeasurementAvg   struct {
		Value float64    `json:"mw"`
		Time  CustomDate `json:"t"`
	} `json:"mwavg"`
	MeasurementMaximum struct {
		Value float64 `json:"mw"` // in µSv/h
		ID    string  `json:"kenn"`
	} `json:"mwmax"`
	MeasurementMin struct {
		Value float64 `json:"mw"` // in µSv/h
		Kenn  string  `json:"kenn"`
	} `json:"mwmin"`
}

type Timeseries

type Timeseries struct {
	Time  []CustomDate `json:"t"`
	Value []float64    `json:"mw"` // in µSv/h
}

type TimeseriesExtended

type TimeseriesExtended struct {
	Time         []CustomTime `json:"t"`
	Value        []float64    `json:"mw"` // in µSv/h
	CheckStatus  []int        `json:"ps"`
	TimeRainProp []CustomTime `json:"tr"`
	RainProp     []float64    `json:"r"`
}

Jump to

Keyboard shortcuts

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