openweather

package
v0.0.0-...-34d77a2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 10 Imported by: 0

README

OpenWeather

Integration with openweather's current weather data as provided by their free account.

Current weather

https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&units=metric&appid={API key}

{
   "coord":{
      "lon":10.9243,
      "lat":59.9677
   },
   "weather":[
      {
         "id":804,
         "main":"Clouds",
         "description":"overcast clouds",
         "icon":"04d"
      }
   ],
   "base":"stations",
   "main":{
      "temp":-4.52,
      "feels_like":-4.52,
      "temp_min":-6.06,
      "temp_max":-2.94,
      "pressure":991,
      "humidity":75,
      "sea_level":991,
      "grnd_level":966
   },
   "visibility":10000,
   "wind":{
      "speed":0.81,
      "deg":23,
      "gust":1.07
   },
   "clouds":{
      "all":100
   },
   "dt":1705226659,
   "sys":{
      "type":2,
      "id":46775,
      "country":"NO",
      "sunrise":1705219569,
      "sunset":1705243417
   },
   "timezone":3600,
   "id":3154802,
   "name":"Grorud",
   "cod":200
}```

## 5 day / 3h forecast

https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key}

```json
{
   "cod":"200",
   "message":0,
   "cnt":40,
   "list":[
      {
         "dt":1705233600,
         "main":{
            "temp":-3.8,
            "feels_like":-3.8,
            "temp_min":-4.69,
            "temp_max":-3.8,
            "pressure":990,
            "sea_level":990,
            "grnd_level":964,
            "humidity":82,
            "temp_kf":0.89
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04d"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":1,
            "deg":34,
            "gust":2.14
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-14 12:00:00"
      },
      {
         "dt":1705244400,
         "main":{
            "temp":-4.33,
            "feels_like":-6.71,
            "temp_min":-5.38,
            "temp_max":-4.33,
            "pressure":989,
            "sea_level":989,
            "grnd_level":962,
            "humidity":87,
            "temp_kf":1.05
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":1.51,
            "deg":17,
            "gust":4.04
         },
         "visibility":5073,
         "pop":0.44,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-14 15:00:00"
      },
      {
         "dt":1705255200,
         "main":{
            "temp":-4.2,
            "feels_like":-10.69,
            "temp_min":-4.4,
            "temp_max":-4.2,
            "pressure":987,
            "sea_level":987,
            "grnd_level":961,
            "humidity":91,
            "temp_kf":0.2
         },
         "weather":[
            {
               "id":601,
               "main":"Snow",
               "description":"snow",
               "icon":"13n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":5.84,
            "deg":33,
            "gust":11.91
         },
         "visibility":153,
         "pop":0.93,
         "snow":{
            "3h":3.52
         },
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-14 18:00:00"
      },
      {
         "dt":1705266000,
         "main":{
            "temp":-6.1,
            "feels_like":-13.1,
            "temp_min":-6.1,
            "temp_max":-6.1,
            "pressure":987,
            "sea_level":987,
            "grnd_level":963,
            "humidity":93,
            "temp_kf":0
         },
         "weather":[
            {
               "id":601,
               "main":"Snow",
               "description":"snow",
               "icon":"13n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":6.55,
            "deg":31,
            "gust":14.68
         },
         "visibility":199,
         "pop":1,
         "snow":{
            "3h":2.66
         },
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-14 21:00:00"
      },
      {
         "dt":1705276800,
         "main":{
            "temp":-6.41,
            "feels_like":-12.5,
            "temp_min":-6.41,
            "temp_max":-6.41,
            "pressure":988,
            "sea_level":988,
            "grnd_level":963,
            "humidity":79,
            "temp_kf":0
         },
         "weather":[
            {
               "id":600,
               "main":"Snow",
               "description":"light snow",
               "icon":"13n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":4.42,
            "deg":27,
            "gust":12.88
         },
         "visibility":10000,
         "pop":1,
         "snow":{
            "3h":0.55
         },
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-15 00:00:00"
      },
      {
         "dt":1705287600,
         "main":{
            "temp":-6.97,
            "feels_like":-11.84,
            "temp_min":-6.97,
            "temp_max":-6.97,
            "pressure":989,
            "sea_level":989,
            "grnd_level":964,
            "humidity":82,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":2.97,
            "deg":32,
            "gust":10.23
         },
         "visibility":10000,
         "pop":0.01,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-15 03:00:00"
      },
      {
         "dt":1705298400,
         "main":{
            "temp":-10.81,
            "feels_like":-14.8,
            "temp_min":-10.81,
            "temp_max":-10.81,
            "pressure":991,
            "sea_level":991,
            "grnd_level":966,
            "humidity":93,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":1.86,
            "deg":14,
            "gust":4.52
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-15 06:00:00"
      },
      {
         "dt":1705309200,
         "main":{
            "temp":-15.37,
            "feels_like":-19.77,
            "temp_min":-15.37,
            "temp_max":-15.37,
            "pressure":994,
            "sea_level":994,
            "grnd_level":969,
            "humidity":95,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04d"
            }
         ],
         "clouds":{
            "all":87
         },
         "wind":{
            "speed":1.71,
            "deg":349,
            "gust":2.05
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-15 09:00:00"
      },
      {
         "dt":1705320000,
         "main":{
            "temp":-10.41,
            "feels_like":-10.41,
            "temp_min":-10.41,
            "temp_max":-10.41,
            "pressure":996,
            "sea_level":996,
            "grnd_level":970,
            "humidity":91,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04d"
            }
         ],
         "clouds":{
            "all":59
         },
         "wind":{
            "speed":0.92,
            "deg":10,
            "gust":2.49
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-15 12:00:00"
      },
      {
         "dt":1705330800,
         "main":{
            "temp":-17.07,
            "feels_like":-17.07,
            "temp_min":-17.07,
            "temp_max":-17.07,
            "pressure":997,
            "sea_level":997,
            "grnd_level":971,
            "humidity":96,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":58
         },
         "wind":{
            "speed":1.06,
            "deg":343,
            "gust":0.98
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-15 15:00:00"
      },
      {
         "dt":1705341600,
         "main":{
            "temp":-20.65,
            "feels_like":-20.65,
            "temp_min":-20.65,
            "temp_max":-20.65,
            "pressure":999,
            "sea_level":999,
            "grnd_level":972,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":802,
               "main":"Clouds",
               "description":"scattered clouds",
               "icon":"03n"
            }
         ],
         "clouds":{
            "all":41
         },
         "wind":{
            "speed":0.95,
            "deg":335,
            "gust":0.84
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-15 18:00:00"
      },
      {
         "dt":1705352400,
         "main":{
            "temp":-22.96,
            "feels_like":-22.96,
            "temp_min":-22.96,
            "temp_max":-22.96,
            "pressure":1001,
            "sea_level":1001,
            "grnd_level":974,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":802,
               "main":"Clouds",
               "description":"scattered clouds",
               "icon":"03n"
            }
         ],
         "clouds":{
            "all":28
         },
         "wind":{
            "speed":1.27,
            "deg":7,
            "gust":1.13
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-15 21:00:00"
      },
      {
         "dt":1705363200,
         "main":{
            "temp":-22.23,
            "feels_like":-22.23,
            "temp_min":-22.23,
            "temp_max":-22.23,
            "pressure":1002,
            "sea_level":1002,
            "grnd_level":975,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":52
         },
         "wind":{
            "speed":1.32,
            "deg":15,
            "gust":1.13
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-16 00:00:00"
      },
      {
         "dt":1705374000,
         "main":{
            "temp":-20.95,
            "feels_like":-25.3,
            "temp_min":-20.95,
            "temp_max":-20.95,
            "pressure":1002,
            "sea_level":1002,
            "grnd_level":976,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":96
         },
         "wind":{
            "speed":1.38,
            "deg":15,
            "gust":1.19
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-16 03:00:00"
      },
      {
         "dt":1705384800,
         "main":{
            "temp":-24.36,
            "feels_like":-24.36,
            "temp_min":-24.36,
            "temp_max":-24.36,
            "pressure":1003,
            "sea_level":1003,
            "grnd_level":976,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":61
         },
         "wind":{
            "speed":1.31,
            "deg":12,
            "gust":1.18
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-16 06:00:00"
      },
      {
         "dt":1705395600,
         "main":{
            "temp":-22.22,
            "feels_like":-22.22,
            "temp_min":-22.22,
            "temp_max":-22.22,
            "pressure":1003,
            "sea_level":1003,
            "grnd_level":976,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04d"
            }
         ],
         "clouds":{
            "all":65
         },
         "wind":{
            "speed":1.19,
            "deg":35,
            "gust":1.02
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-16 09:00:00"
      },
      {
         "dt":1705406400,
         "main":{
            "temp":-16.12,
            "feels_like":-16.12,
            "temp_min":-16.12,
            "temp_max":-16.12,
            "pressure":1002,
            "sea_level":1002,
            "grnd_level":976,
            "humidity":94,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04d"
            }
         ],
         "clouds":{
            "all":82
         },
         "wind":{
            "speed":0.66,
            "deg":77,
            "gust":0.81
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-16 12:00:00"
      },
      {
         "dt":1705417200,
         "main":{
            "temp":-18.19,
            "feels_like":-18.19,
            "temp_min":-18.19,
            "temp_max":-18.19,
            "pressure":1001,
            "sea_level":1001,
            "grnd_level":975,
            "humidity":99,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":0.92,
            "deg":27,
            "gust":0.81
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-16 15:00:00"
      },
      {
         "dt":1705428000,
         "main":{
            "temp":-19.11,
            "feels_like":-19.11,
            "temp_min":-19.11,
            "temp_max":-19.11,
            "pressure":1000,
            "sea_level":1000,
            "grnd_level":974,
            "humidity":99,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":1.19,
            "deg":29,
            "gust":1.03
         },
         "visibility":7148,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-16 18:00:00"
      },
      {
         "dt":1705438800,
         "main":{
            "temp":-18.41,
            "feels_like":-22.31,
            "temp_min":-18.41,
            "temp_max":-18.41,
            "pressure":998,
            "sea_level":998,
            "grnd_level":972,
            "humidity":99,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":1.34,
            "deg":27,
            "gust":1.17
         },
         "visibility":2886,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-16 21:00:00"
      },
      {
         "dt":1705449600,
         "main":{
            "temp":-16.02,
            "feels_like":-21.84,
            "temp_min":-16.02,
            "temp_max":-16.02,
            "pressure":993,
            "sea_level":993,
            "grnd_level":967,
            "humidity":97,
            "temp_kf":0
         },
         "weather":[
            {
               "id":600,
               "main":"Snow",
               "description":"light snow",
               "icon":"13n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":2.4,
            "deg":37,
            "gust":4.68
         },
         "visibility":379,
         "pop":0.27,
         "snow":{
            "3h":0.11
         },
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-17 00:00:00"
      },
      {
         "dt":1705460400,
         "main":{
            "temp":-11.35,
            "feels_like":-18.35,
            "temp_min":-11.35,
            "temp_max":-11.35,
            "pressure":982,
            "sea_level":982,
            "grnd_level":957,
            "humidity":95,
            "temp_kf":0
         },
         "weather":[
            {
               "id":601,
               "main":"Snow",
               "description":"snow",
               "icon":"13n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":7.11,
            "deg":55,
            "gust":18.63
         },
         "visibility":99,
         "pop":1,
         "snow":{
            "3h":4.36
         },
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-17 03:00:00"
      },
      {
         "dt":1705471200,
         "main":{
            "temp":-5.15,
            "feels_like":-12.15,
            "temp_min":-5.15,
            "temp_max":-5.15,
            "pressure":972,
            "sea_level":972,
            "grnd_level":948,
            "humidity":95,
            "temp_kf":0
         },
         "weather":[
            {
               "id":601,
               "main":"Snow",
               "description":"snow",
               "icon":"13n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":7.51,
            "deg":49,
            "gust":15.34
         },
         "visibility":109,
         "pop":1,
         "snow":{
            "3h":6.41
         },
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-17 06:00:00"
      },
      {
         "dt":1705482000,
         "main":{
            "temp":-4.71,
            "feels_like":-10.41,
            "temp_min":-4.71,
            "temp_max":-4.71,
            "pressure":970,
            "sea_level":970,
            "grnd_level":946,
            "humidity":95,
            "temp_kf":0
         },
         "weather":[
            {
               "id":601,
               "main":"Snow",
               "description":"snow",
               "icon":"13d"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":4.44,
            "deg":334,
            "gust":8.73
         },
         "visibility":102,
         "pop":0.99,
         "snow":{
            "3h":8.51
         },
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-17 09:00:00"
      },
      {
         "dt":1705492800,
         "main":{
            "temp":-7.32,
            "feels_like":-14.32,
            "temp_min":-7.32,
            "temp_max":-7.32,
            "pressure":975,
            "sea_level":975,
            "grnd_level":951,
            "humidity":90,
            "temp_kf":0
         },
         "weather":[
            {
               "id":601,
               "main":"Snow",
               "description":"snow",
               "icon":"13d"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":6.61,
            "deg":325,
            "gust":13.44
         },
         "visibility":302,
         "pop":0.99,
         "snow":{
            "3h":2.85
         },
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-17 12:00:00"
      },
      {
         "dt":1705503600,
         "main":{
            "temp":-8.91,
            "feels_like":-15.91,
            "temp_min":-8.91,
            "temp_max":-8.91,
            "pressure":980,
            "sea_level":980,
            "grnd_level":955,
            "humidity":81,
            "temp_kf":0
         },
         "weather":[
            {
               "id":600,
               "main":"Snow",
               "description":"light snow",
               "icon":"13n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":5.8,
            "deg":319,
            "gust":14.54
         },
         "visibility":10000,
         "pop":0.88,
         "snow":{
            "3h":0.53
         },
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-17 15:00:00"
      },
      {
         "dt":1705514400,
         "main":{
            "temp":-7.84,
            "feels_like":-14.64,
            "temp_min":-7.84,
            "temp_max":-7.84,
            "pressure":982,
            "sea_level":982,
            "grnd_level":958,
            "humidity":81,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":100
         },
         "wind":{
            "speed":4.89,
            "deg":312,
            "gust":13.26
         },
         "visibility":10000,
         "pop":0.71,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-17 18:00:00"
      },
      {
         "dt":1705525200,
         "main":{
            "temp":-7.83,
            "feels_like":-13.87,
            "temp_min":-7.83,
            "temp_max":-7.83,
            "pressure":986,
            "sea_level":986,
            "grnd_level":961,
            "humidity":82,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":99
         },
         "wind":{
            "speed":3.96,
            "deg":323,
            "gust":11.53
         },
         "visibility":10000,
         "pop":0.17,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-17 21:00:00"
      },
      {
         "dt":1705536000,
         "main":{
            "temp":-10.13,
            "feels_like":-15.6,
            "temp_min":-10.13,
            "temp_max":-10.13,
            "pressure":989,
            "sea_level":989,
            "grnd_level":964,
            "humidity":88,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":99
         },
         "wind":{
            "speed":2.94,
            "deg":341,
            "gust":8.29
         },
         "visibility":10000,
         "pop":0.17,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-18 00:00:00"
      },
      {
         "dt":1705546800,
         "main":{
            "temp":-11.9,
            "feels_like":-18.07,
            "temp_min":-11.9,
            "temp_max":-11.9,
            "pressure":992,
            "sea_level":992,
            "grnd_level":967,
            "humidity":88,
            "temp_kf":0
         },
         "weather":[
            {
               "id":804,
               "main":"Clouds",
               "description":"overcast clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":97
         },
         "wind":{
            "speed":3.23,
            "deg":10,
            "gust":8.44
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-18 03:00:00"
      },
      {
         "dt":1705557600,
         "main":{
            "temp":-18.85,
            "feels_like":-24.63,
            "temp_min":-18.85,
            "temp_max":-18.85,
            "pressure":995,
            "sea_level":995,
            "grnd_level":969,
            "humidity":97,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":84
         },
         "wind":{
            "speed":2.11,
            "deg":358,
            "gust":3.1
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-18 06:00:00"
      },
      {
         "dt":1705568400,
         "main":{
            "temp":-19.79,
            "feels_like":-25.18,
            "temp_min":-19.79,
            "temp_max":-19.79,
            "pressure":998,
            "sea_level":998,
            "grnd_level":971,
            "humidity":95,
            "temp_kf":0
         },
         "weather":[
            {
               "id":802,
               "main":"Clouds",
               "description":"scattered clouds",
               "icon":"03d"
            }
         ],
         "clouds":{
            "all":47
         },
         "wind":{
            "speed":1.85,
            "deg":355,
            "gust":3.08
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-18 09:00:00"
      },
      {
         "dt":1705579200,
         "main":{
            "temp":-14.06,
            "feels_like":-17.62,
            "temp_min":-14.06,
            "temp_max":-14.06,
            "pressure":998,
            "sea_level":998,
            "grnd_level":972,
            "humidity":89,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04d"
            }
         ],
         "clouds":{
            "all":61
         },
         "wind":{
            "speed":1.43,
            "deg":19,
            "gust":4.06
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-18 12:00:00"
      },
      {
         "dt":1705590000,
         "main":{
            "temp":-20.86,
            "feels_like":-25.35,
            "temp_min":-20.86,
            "temp_max":-20.86,
            "pressure":999,
            "sea_level":999,
            "grnd_level":973,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":51
         },
         "wind":{
            "speed":1.43,
            "deg":3,
            "gust":1.27
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-18 15:00:00"
      },
      {
         "dt":1705600800,
         "main":{
            "temp":-24.41,
            "feels_like":-29.1,
            "temp_min":-24.41,
            "temp_max":-24.41,
            "pressure":1001,
            "sea_level":1001,
            "grnd_level":975,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":802,
               "main":"Clouds",
               "description":"scattered clouds",
               "icon":"03n"
            }
         ],
         "clouds":{
            "all":37
         },
         "wind":{
            "speed":1.34,
            "deg":357,
            "gust":1.16
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-18 18:00:00"
      },
      {
         "dt":1705611600,
         "main":{
            "temp":-26.19,
            "feels_like":-26.19,
            "temp_min":-26.19,
            "temp_max":-26.19,
            "pressure":1003,
            "sea_level":1003,
            "grnd_level":976,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":802,
               "main":"Clouds",
               "description":"scattered clouds",
               "icon":"03n"
            }
         ],
         "clouds":{
            "all":40
         },
         "wind":{
            "speed":1.18,
            "deg":4,
            "gust":1.1
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-18 21:00:00"
      },
      {
         "dt":1705622400,
         "main":{
            "temp":-27.09,
            "feels_like":-27.09,
            "temp_min":-27.09,
            "temp_max":-27.09,
            "pressure":1004,
            "sea_level":1004,
            "grnd_level":976,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":802,
               "main":"Clouds",
               "description":"scattered clouds",
               "icon":"03n"
            }
         ],
         "clouds":{
            "all":48
         },
         "wind":{
            "speed":1.33,
            "deg":11,
            "gust":1.2
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-19 00:00:00"
      },
      {
         "dt":1705633200,
         "main":{
            "temp":-27.73,
            "feels_like":-27.73,
            "temp_min":-27.73,
            "temp_max":-27.73,
            "pressure":1004,
            "sea_level":1004,
            "grnd_level":977,
            "humidity":99,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":52
         },
         "wind":{
            "speed":1.14,
            "deg":13,
            "gust":1.03
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-19 03:00:00"
      },
      {
         "dt":1705644000,
         "main":{
            "temp":-25.02,
            "feels_like":-25.02,
            "temp_min":-25.02,
            "temp_max":-25.02,
            "pressure":1004,
            "sea_level":1004,
            "grnd_level":977,
            "humidity":98,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04n"
            }
         ],
         "clouds":{
            "all":76
         },
         "wind":{
            "speed":1.21,
            "deg":14,
            "gust":1.15
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"n"
         },
         "dt_txt":"2024-01-19 06:00:00"
      },
      {
         "dt":1705654800,
         "main":{
            "temp":-25.84,
            "feels_like":-25.84,
            "temp_min":-25.84,
            "temp_max":-25.84,
            "pressure":1006,
            "sea_level":1006,
            "grnd_level":979,
            "humidity":99,
            "temp_kf":0
         },
         "weather":[
            {
               "id":803,
               "main":"Clouds",
               "description":"broken clouds",
               "icon":"04d"
            }
         ],
         "clouds":{
            "all":76
         },
         "wind":{
            "speed":1.2,
            "deg":19,
            "gust":1.19
         },
         "visibility":10000,
         "pop":0,
         "sys":{
            "pod":"d"
         },
         "dt_txt":"2024-01-19 09:00:00"
      }
   ],
   "city":{
      "id":3154802,
      "name":"Grorud",
      "coord":{
         "lat":59.9677,
         "lon":10.9243
      },
      "country":"NO",
      "population":0,
      "timezone":3600,
      "sunrise":1705219569,
      "sunset":1705243417
   }
}```

Documentation

Index

Constants

View Source
const (
	ForecastUrl  = "https://api.openweathermap.org/data/2.5/forecast"
	CurrentUrl   = "https://api.openweathermap.org/data/2.5/weather"
	UnitMetric   = "metric"
	UnitImperial = "imperial"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ForecastFactory

type ForecastFactory struct {
	// contains filtered or unexported fields
}

ForecastFactory allows you to download and work with the forecast.

func NewForecastFactory

func NewForecastFactory() *ForecastFactory

NewForecastFactory returns a new object

func (*ForecastFactory) GetCurrent

func (f *ForecastFactory) GetCurrent(ctx context.Context) (w WeatherCurrent, err error)

GetCurrent returns the current weather

func (*ForecastFactory) GetForecast

func (f *ForecastFactory) GetForecast(ctx context.Context) (w WeatherForecast, err error)

GetForecast downloads a forecast from the server

func (*ForecastFactory) WithApiKey

func (f *ForecastFactory) WithApiKey(key string) *ForecastFactory

WithApiKey defines the app_id (API key) that you will use for this request.

func (*ForecastFactory) WithCount

func (f *ForecastFactory) WithCount(c int) *ForecastFactory

WithCount limits the number of results you get back

func (*ForecastFactory) WithCustomParameter

func (f *ForecastFactory) WithCustomParameter(k, v string) *ForecastFactory

WithCustomParameter lets you add parameters that is not directly supported in the API.

func (*ForecastFactory) WithPos

func (f *ForecastFactory) WithPos(lat, lon float64) *ForecastFactory

WithPos sets the position that you want the weather forecast from.

func (*ForecastFactory) WithUnits

func (f *ForecastFactory) WithUnits(u string) *ForecastFactory

WithUnits lets you specify the unit for the result. Valid units are imperial and metric.

type WeatherCurrent

type WeatherCurrent struct {
	Coord struct {
		Lon float64 `json:"lon"`
		Lat float64 `json:"lat"`
	} `json:"coord"`
	Weather []WeatherDescription `json:"weather"`
	Base    string               `json:"base"`
	Main    struct {
		Temp        float64 `json:"temp"`
		FeelsLike   float64 `json:"feels_like"`
		TempMin     float64 `json:"temp_min"`
		TempMax     float64 `json:"temp_max"`
		Pressure    int     `json:"pressure"`
		Humidity    int     `json:"humidity"`
		SeaLevel    int     `json:"sea_level"`
		GroundLevel int     `json:"grnd_level"`
	} `json:"main"`
	Visibility int `json:"visibility"`
	Wind       struct {
		Speed float64 `json:"speed"`
		Deg   int     `json:"deg"`
		Gust  float64 `json:"gust"`
	} `json:"wind"`
	Rain struct {
		H float64 `json:"1h"`
	} `json:"rain"`
	Snow struct {
		H float64 `json:"1h"`
	} `json:"snow"`
	Clouds struct {
		All int `json:"all"`
	} `json:"clouds"`
	Dt  int64 `json:"dt"`
	Sys struct {
		Type    int    `json:"type"`
		Id      int    `json:"id"`
		Country string `json:"country"`
		Sunrise int    `json:"sunrise"`
		Sunset  int    `json:"sunset"`
	} `json:"sys"`
	Timezone int    `json:"timezone"`
	Id       int    `json:"id"`
	Name     string `json:"name"`
	Cod      int    `json:"cod"`
}

WeatherCurrent returns the current weather

type WeatherDescription

type WeatherDescription struct {
	Id          int    `json:"id"`
	Main        string `json:"main"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
}

WeatherDescription is a descriptive weather

func (WeatherDescription) IsSnow

func (w WeatherDescription) IsSnow() bool

IsSnow returns true if it is snowing

type WeatherForecast

type WeatherForecast struct {
	Cod     string        `json:"cod"`
	Message int           `json:"message"`
	Cnt     int           `json:"cnt"`
	List    []WeatherList `json:"list"`
	City    struct {
		Id    int    `json:"id"`
		Name  string `json:"name"`
		Coord struct {
			Lat float64 `json:"lat"`
			Lon float64 `json:"lon"`
		} `json:"coord"`
		Country    string `json:"country"`
		Population int    `json:"population"`
		Timezone   int    `json:"timezone"`
		Sunrise    int    `json:"sunrise"`
		Sunset     int    `json:"sunset"`
	} `json:"city"`
}

WeatherForecast is the response returned from the forecast endpoint

func (WeatherForecast) ToYr

func (w WeatherForecast) ToYr() yr.YrCompactData

type WeatherList

type WeatherList struct {
	Dt   int64 `json:"dt"`
	Main struct {
		Temp        float64 `json:"temp"`
		FeelsLike   float64 `json:"feels_like"`
		TempMin     float64 `json:"temp_min"`
		TempMax     float64 `json:"temp_max"`
		Pressure    int     `json:"pressure"`
		SeaLevel    int     `json:"sea_level"`
		GroundLevel int     `json:"grnd_level"`
		Humidity    int     `json:"humidity"`
		TempKf      float64 `json:"temp_kf"`
	} `json:"main"`
	Weather []WeatherDescription `json:"weather"`
	Clouds  struct {
		All int `json:"all"`
	} `json:"clouds"`
	Wind struct {
		Speed float64 `json:"speed"`
		Deg   int     `json:"deg"`
		Gust  float64 `json:"gust"`
	} `json:"wind"`
	Visibility int     `json:"visibility"`
	Pop        float64 `json:"pop"`
	Sys        struct {
		Pod string `json:"pod"`
	} `json:"sys"`
	DtTxt string `json:"dt_txt"`
	Snow  struct {
		H3 float64 `json:"3h,omitempty"` // 3 hour prediction
		H1 float64 `json:"1h,omitempty"` // one hour prediction
	} `json:"snow,omitempty"`
	Rain struct {
		H3 float64 `json:"3h,omitempty"` // 3 hour prediction
		H1 float64 `json:"1h,omitempty"` // one hour prediction
	} `json:"rain,omitempty"`
}

func (WeatherList) HasPrecipitation

func (w WeatherList) HasPrecipitation() bool

HasPrecipitation returns true if this instance of the weather has some kind of precipitation, either snow or rain.

Jump to

Keyboard shortcuts

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