met

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URL = "http://api.met.no/weatherapi/locationforecast/2.0/compact"
)

Variables

View Source
var CodesToIcons map[string]string = map[string]string{
	"clearsky":                           icons.Clear,
	"clearsky_day":                       icons.ClearDay,
	"clearsky_night":                     icons.ClearNight,
	"fair":                               icons.ClearDay,
	"fair_day":                           icons.ClearDay,
	"fair_night":                         icons.ClearDay,
	"cloudy":                             icons.Cloudy,
	"fog":                                icons.FogDay,
	"heavyrain":                          icons.RainDay,
	"heavyrainandthunder":                icons.Thunderstorm,
	"heavyrainshowers":                   icons.Rain,
	"heavyrainshowers_day":               icons.RainDay,
	"heavyrainshowers_night":             icons.RainNight,
	"heavysleet":                         icons.Sleet,
	"heavysleetandthunder":               icons.Thunderstorm,
	"heavysleetshowers":                  icons.Sleet,
	"heavysleetshowers_day":              icons.SleetDay,
	"heavysleetshowers_night":            icons.SleetNight,
	"heavysleetshowersandthunder":        icons.Thunderstorm,
	"heavysleetshowersandthunder_day":    icons.ThunderstormDay,
	"heavysleetshowersandthunder_night":  icons.ThunderstormNight,
	"heavysnow":                          icons.Snow,
	"heavysnowandthunder":                icons.Thunderstorm,
	"heavysnowandthunder_day":            icons.ThunderstormDay,
	"heavysnowandthunder_night":          icons.ThunderstormNight,
	"lightrain":                          icons.Rain,
	"lightrainandthunder":                icons.Thunderstorm,
	"lightrainshowers":                   icons.Rain,
	"lightrainshowers_day":               icons.RainDay,
	"lightrainshowers_night":             icons.RainNight,
	"lightrainshowersandthunder":         icons.Thunderstorm,
	"lightrainshowersandthunder_day":     icons.ThunderstormDay,
	"lightrainshowersandthunder_night":   icons.ThunderstormNight,
	"lightsleet":                         icons.Sleet,
	"lightsleetandthunder":               icons.Thunderstorm,
	"lightsleetshowers":                  icons.Sleet,
	"lightsleetshowers_day":              icons.SleetDay,
	"lightsleetshowers_night":            icons.SleetNight,
	"lightsnow":                          icons.Snow,
	"lightsnowandthunder":                icons.Thunderstorm,
	"lightsnowshowers":                   icons.Snow,
	"lightsnowshowers_day":               icons.SnowDay,
	"lightsnowshowers_night":             icons.SnowNight,
	"lightssleetshowersandthunder":       icons.Thunderstorm,
	"lightssleetshowersandthunder_day":   icons.ThunderstormDay,
	"lightssleetshowersandthunder_night": icons.ThunderstormNight,
	"lightssnowshowersandthunder":        icons.Thunderstorm,
	"lightssnowshowersandthunder_day":    icons.ThunderstormDay,
	"lightssnowshowersandthunder_nigth":  icons.ThunderstormNight,
	"partlycloudy":                       icons.PartlyCloudy,
	"partlycloudy_day":                   icons.PartlyCloudyDay,
	"partlycloudy_night":                 icons.PartlyCloudyNight,
	"rain":                               icons.Rain,
	"rainandthunder":                     icons.Thunderstorm,
	"rainshowers":                        icons.Rain,
	"rainshowers_day":                    icons.RainDay,
	"rainshowers_night":                  icons.RainNight,
	"rainshowersandthunder":              icons.Thunderstorm,
	"rainshowersandthunder_day":          icons.ThunderstormDay,
	"rainshowersandthunder_night":        icons.ThunderstormNight,
	"sleet":                              icons.Sleet,
	"sleetandthunder":                    icons.Thunderstorm,
	"sleetshowers":                       icons.Sleet,
	"sleetshowers_day":                   icons.SleetDay,
	"sleetshowers_night":                 icons.SleetNight,
	"sleetshowersandthunder":             icons.Thunderstorm,
	"sleetshowersandthunder_day":         icons.ThunderstormDay,
	"sleetshowersandthunder_night":       icons.ThunderstormNight,
	"snow":                               icons.Snow,
	"snowandthunder":                     icons.Thunderstorm,
	"snowshowers":                        icons.Snow,
	"snowshowers_day":                    icons.SnowDay,
	"snowshowers_night":                  icons.SnowNight,
	"snowshowersandthunder":              icons.Thunderstorm,
	"snowshowersandthunder_day":          icons.ThunderstormDay,
	"snowshowersandthunder_night":        icons.ThunderstormNight,
}

https://github.com/metno/weathericons/tree/main/weather

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled bool `json:"enabled,omitempty"`
}

type Met

type Met struct {
	Location  geocoder.Location
	UserAgent string
	Units     string
}

func New

func New(l geocoder.Location, userAgent string, units string) Met

func (Met) GetForecast

func (m Met) GetForecast() (forecaster.Forecast, error)

type Response

type Response struct {
	Properties struct {
		Meta struct {
			UpdatedAt time.Time `json:"updated_at"`
			Units     struct {
				AirPressureAtSeaLevel string `json:"air_pressure_at_sea_level"`
				AirTemperature        string `json:"air_temperature"`
				CloudAreaFraction     string `json:"cloud_area_fraction"`
				PrecipitationAmount   string `json:"precipitation_amount"`
				RelativeHumidity      string `json:"relative_humidity"`
				WindFromDirection     string `json:"wind_from_direction"`
				WindSpeed             string `json:"wind_speed"`
			} `json:"units"`
		} `json:"meta"`
		Timeseries []struct {
			Data struct {
				Time    string `json:"time"`
				Instant struct {
					Details struct {
						AirPressureAtSeaLevel float64 `json:"air_pressure_at_sea_level"`
						AirTemperature        float64 `json:"air_temperature"`
						CloudAreaFraction     float64 `json:"cloud_area_fraction"`
						RelativeHumidity      float64 `json:"relative_humidity"`
						WindFromDirection     float64 `json:"wind_from_direction"`
						WindSpeed             float64 `json:"wind_speed"`
					} `json:"details"`
				} `json:"instant"`
				Next1Hours struct {
					Details struct {
						PrecipitationAmount float64 `json:"precipitation_amount"`
					} `json:"details"`
					Summary struct {
						SymbolCode string `json:"symbol_code"`
					} `json:"summary"`
				} `json:"next_1_hours"`
			} `json:"data"`
		} `json:"timeseries"`
	} `json:"properties"`
}

Jump to

Keyboard shortcuts

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