// models.go - Data models package main import ( "encoding/xml" ) // OWMResponse represents OpenWeatherMap API response format type OWMResponse struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` Timezone string `json:"timezone"` TimezoneOffset int `json:"timezone_offset"` Current Current `json:"current"` Hourly []Current `json:"hourly"` } // Current represents current or hourly weather data type Current struct { Dt int64 `json:"dt"` Sunrise int64 `json:"sunrise,omitempty"` Sunset int64 `json:"sunset,omitempty"` Temp float64 `json:"temp"` FeelsLike float64 `json:"feels_like"` Pressure int `json:"pressure"` Humidity int `json:"humidity"` DewPoint float64 `json:"dew_point"` Uvi float64 `json:"uvi"` Clouds int `json:"clouds"` Visibility int `json:"visibility"` WindSpeed float64 `json:"wind_speed"` WindDeg int `json:"wind_deg"` WindGust float64 `json:"wind_gust"` Weather []Weather `json:"weather"` Rain *Rain `json:"rain,omitempty"` LocalTime string `json:"local_time,omitempty"` // ISO 8601 format } // Rain represents precipitation data type Rain struct { OneH float64 `json:"1h"` } // Weather represents weather condition type Weather struct { ID int `json:"id"` Main string `json:"main"` Description string `json:"description"` Icon string `json:"icon"` } // ForecastData represents parsed FMI forecast data type ForecastData struct { Latitude float64 Longitude float64 Timezone string Timestamps []int64 Parameters []string Values [][]float64 ParamIndex map[string]int } // XML models for FMI API response type FeatureCollection struct { XMLName xml.Name `xml:"http://www.opengis.net/wfs/2.0 FeatureCollection"` Members []struct { GridSeriesObservation struct { XMLName xml.Name `xml:"GridSeriesObservation"` Namespace string `xml:"xmlns,attr"` Result struct { MultiPointCoverage struct { XMLName xml.Name `xml:"MultiPointCoverage"` Namespace string `xml:"xmlns,attr"` DomainSet struct { SimpleMultiPoint struct { XMLName xml.Name `xml:"SimpleMultiPoint"` Positions string `xml:"positions"` } `xml:"SimpleMultiPoint"` } `xml:"domainSet"` RangeSet struct { DataBlock struct { TupleList string `xml:"doubleOrNilReasonTupleList"` } `xml:"DataBlock"` } `xml:"rangeSet"` RangeType struct { DataRecord struct { Fields []struct { Name string `xml:"name,attr"` } `xml:"field"` } `xml:"DataRecord"` } `xml:"rangeType"` } `xml:"MultiPointCoverage"` } `xml:"result"` } `xml:"GridSeriesObservation"` } `xml:"member"` }