1
0
Fork 0
hats/pkg/nws/structs.go

79 lines
3.2 KiB
Go
Raw Permalink Normal View History

2023-11-10 23:22:46 +00:00
package nws
import "time"
type UnitValue[T any] struct {
UnitCode string `json:"unitCode"`
Value T `json:"value"`
}
type PointProps struct {
GridId string `json:"gridId"`
GridX int `json:"gridX"`
GridY int `json:"gridY"`
Forecast string `json:"forecast"`
ForecastHourly string `json:"forecastHourly"`
ForecastGridData string `json:"forecastGridData"`
ForecastZone string `json:"forecastZone"`
TimeZone string `json:"timeZone"`
RadarStation string `json:"radarStation"`
ObservationStations string `json:"observationStations"`
}
type Point struct {
ID string `json:"id"`
Properties PointProps `json:"properties"`
2024-01-02 18:55:08 +00:00
Lat float64
Lon float64
2023-11-10 23:22:46 +00:00
}
type HourlyPeriod struct {
Number int `json:"number"`
StartTime time.Time `json:"startTime"`
Endime time.Time `json:"endTime"`
IsDayTime bool `json:"isDayTime"`
Temperature int `json:"temperature"`
ProbabilityOfPrecipitation UnitValue[int] `json:"probabilityOfPrecipitation"`
DewPoint UnitValue[float64] `json:"dewpoint"`
ShortForecast string `json:"shortForecast"`
}
type HourlyProps struct {
Updated time.Time `json:"updated"`
Units string `json:"units"`
Periods []HourlyPeriod `json:"periods"`
}
2024-01-02 18:55:08 +00:00
type DailyPeriod struct {
Number int `json:"number,omitempty"`
Name string `json:"name,omitempty"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
IsDaytime bool `json:"isDaytime,omitempty"`
Temperature int `json:"temperature,omitempty"`
TemperatureUnit string `json:"temperatureUnit,omitempty"`
TemperatureTrend string `json:"temperatureTrend,omitempty"`
ProbabilityOfPrecipitation UnitValue[int] `json:"probabilityOfPrecipitation,omitempty"`
Dewpoint UnitValue[float64] `json:"dewpoint,omitempty"`
RelativeHumidity UnitValue[int] `json:"relativeHumidity,omitempty"`
WindSpeed string `json:"windSpeed,omitempty"`
WindDirection string `json:"windDirection,omitempty"`
Icon string `json:"icon,omitempty"`
ShortForecast string `json:"shortForecast,omitempty"`
DetailedForecast string `json:"detailedForecast,omitempty"`
}
type DailyProps struct {
Updated time.Time `json:"updated"`
Units string `json:"units"`
Periods []DailyPeriod `json:"periods"`
}
2023-11-10 23:22:46 +00:00
type Observations struct {
Timestamp time.Time `json:"timestamp"`
Temperature UnitValue[float64] `json:"temperature"`
DewPoint UnitValue[float64] `json:"dewpoint"`
WindDirection UnitValue[int] `json:"windDirection"`
WindSpeed UnitValue[float64] `json:"windSpeed"`
}