fakeweather

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package fakeweather provides synthetic weather for offline demonstrations. With an explicit date, the same request produces the same report across runs. An omitted date uses the current UTC day. The output is not real weather.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AirQuality

type AirQuality struct {
	AQI         int             `json:"aqi"`
	Level       AirQualityLevel `json:"level"`
	PM25        int             `json:"pm2_5"`
	PM10        int             `json:"pm10"`
	Ozone       int             `json:"ozone"`
	Description string          `json:"description"`
}

type AirQualityLevel

type AirQualityLevel string

AirQualityLevel is the US AQI qualitative scale.

const (
	AirQualityGood                        AirQualityLevel = "Good"
	AirQualityModerate                    AirQualityLevel = "Moderate"
	AirQualityUnhealthyForSensitiveGroups AirQualityLevel = "Unhealthy for Sensitive Groups"
	AirQualityUnhealthy                   AirQualityLevel = "Unhealthy"
	AirQualityVeryUnhealthy               AirQualityLevel = "Very Unhealthy"
	AirQualityHazardous                   AirQualityLevel = "Hazardous"
)

type Alert

type Alert struct {
	Type        AlertType     `json:"type"`
	Severity    AlertSeverity `json:"severity"`
	Title       string        `json:"title"`
	Description string        `json:"description"`
	StartTime   int64         `json:"start_time"`
	EndTime     int64         `json:"end_time"`
}

type AlertSeverity

type AlertSeverity string
const (
	AlertSeverityModerate AlertSeverity = "moderate"
	AlertSeveritySevere   AlertSeverity = "severe"
	AlertSeverityExtreme  AlertSeverity = "extreme"
)

type AlertType

type AlertType string
const (
	AlertCold    AlertType = "cold"
	AlertHeat    AlertType = "heat"
	AlertSnow    AlertType = "snow"
	AlertStorm   AlertType = "storm"
	AlertTyphoon AlertType = "typhoon"
	AlertWind    AlertType = "wind"
)

type Astronomy

type Astronomy struct {
	Sunrise          string `json:"sunrise"`
	Sunset           string `json:"sunset"`
	Moonrise         string `json:"moonrise"`
	Moonset          string `json:"moonset"`
	MoonPhase        string `json:"moon_phase"`
	MoonIllumination int    `json:"moon_illumination"` // 0-100
}

Sun and moon times are approximate solar-local HH:MM values.

type Condition

type Condition string
const (
	ConditionBlizzard     Condition = "Blizzard"
	ConditionClear        Condition = "Clear"
	ConditionCloudy       Condition = "Cloudy"
	ConditionCold         Condition = "Cold"
	ConditionDrizzle      Condition = "Drizzle"
	ConditionDusty        Condition = "Dusty"
	ConditionFoggy        Condition = "Foggy"
	ConditionFreezing     Condition = "Freezing"
	ConditionHazy         Condition = "Hazy"
	ConditionHot          Condition = "Hot"
	ConditionHumid        Condition = "Humid"
	ConditionMild         Condition = "Mild"
	ConditionOvercast     Condition = "Overcast"
	ConditionPartlyCloudy Condition = "Partly Cloudy"
	ConditionRainy        Condition = "Rainy"
	ConditionSnowy        Condition = "Snowy"
	ConditionStormy       Condition = "Stormy"
	ConditionSunny        Condition = "Sunny"
	ConditionWindy        Condition = "Windy"
)

type Coordinates

type Coordinates struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Elevation int     `json:"elevation"` // meters
}

type HourlyForecast

type HourlyForecast struct {
	Time          int64     `json:"time"`
	Temperature   int       `json:"temperature"`
	Condition     Condition `json:"condition"`
	Precipitation float64   `json:"precipitation"`
	Humidity      int       `json:"humidity"`
	WindSpeed     float64   `json:"wind_speed"`
}

type Precipitation

type Precipitation struct {
	Type        PrecipitationType      `json:"type"`
	Probability int                    `json:"probability"` // 0-100
	Amount      float64                `json:"amount"`      // mm
	Intensity   PrecipitationIntensity `json:"intensity"`
}

type PrecipitationIntensity

type PrecipitationIntensity string
const (
	PrecipitationLight    PrecipitationIntensity = "light"
	PrecipitationModerate PrecipitationIntensity = "moderate"
	PrecipitationHeavy    PrecipitationIntensity = "heavy"
)

type PrecipitationType

type PrecipitationType string
const (
	PrecipitationRain  PrecipitationType = "rain"
	PrecipitationSleet PrecipitationType = "sleet"
	PrecipitationSnow  PrecipitationType = "snow"
)

type Request

type Request struct {
	Location string `` /* 186-byte string literal not displayed */

	Date string `` /* 160-byte string literal not displayed */

	IncludeHourly bool `json:"include_hourly,omitzero" jsonschema_description:"Include a full daily hourly forecast. Defaults to false."`

	IncludeAirQuality bool `json:"include_air_quality,omitzero" jsonschema_description:"Include AQI and pollutant concentrations. Defaults to false."`
}

type Response

type Response struct {
	Location       string           `json:"location"`
	Coordinates    Coordinates      `json:"coordinates"`
	Timestamp      TimeRange        `json:"timestamp"`
	Temperature    Temperature      `json:"temperature"`
	Condition      Condition        `json:"condition"`
	Description    string           `json:"description"`
	Humidity       int              `json:"humidity"`
	Pressure       int              `json:"pressure"`    // hPa
	Visibility     int              `json:"visibility"`  // km
	CloudCover     int              `json:"cloud_cover"` // 0-100
	DewPoint       int              `json:"dew_point"`
	Wind           Wind             `json:"wind"`
	Precipitation  *Precipitation   `json:"precipitation,omitzero"`
	AirQuality     *AirQuality      `json:"air_quality,omitzero"`
	UVIndex        UVIndex          `json:"uv_index"`
	Astronomy      Astronomy        `json:"astronomy"`
	HourlyForecast []HourlyForecast `json:"hourly_forecast,omitempty"`
	Alerts         []Alert          `json:"alerts,omitempty"`
	Source         string           `json:"source"`
	LastUpdated    int64            `json:"last_updated"` // Unix seconds at the start of the target date
}

type Temperature

type Temperature struct {
	Value     int    `json:"value"`
	Unit      string `json:"unit"`
	FeelsLike int    `json:"feels_like"`
	Min       int    `json:"min"`
	Max       int    `json:"max"`
}

type TimeRange

type TimeRange struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
}

TimeRange is a [start, end) Unix-second window covering the target date.

type Tool

type Tool struct {
	toolcontract.Func[Request, *Response]
	// contains filtered or unexported fields
}

func New

func New(writer io.Writer) *Tool

New creates an offline tool. With an explicit date, output is deterministic. The optional writer receives call activity and remains owned by the caller.

func (*Tool) Call

func (t *Tool) Call(ctx context.Context, invocation toolcontract.Invocation) (toolcontract.Result, error)

type UVIndex

type UVIndex struct {
	Value       int     `json:"value"`
	Level       UVLevel `json:"level"`
	Description string  `json:"description"`
}

UVIndex per WHO levels (0-11+).

type UVLevel

type UVLevel string

UVLevel is the WHO UV-index qualitative scale.

const (
	UVLow      UVLevel = "Low"
	UVModerate UVLevel = "Moderate"
	UVHigh     UVLevel = "High"
	UVVeryHigh UVLevel = "Very High"
	UVExtreme  UVLevel = "Extreme"
)

type Wind

type Wind struct {
	Speed     float64 `json:"speed"`
	Unit      string  `json:"unit"`
	Direction string  `json:"direction"`
	Degree    int     `json:"degree"`
	Gust      float64 `json:"gust"`
}

Jump to

Keyboard shortcuts

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