{"id":241,"date":"2021-03-20T05:28:42","date_gmt":"2021-03-20T05:28:42","guid":{"rendered":"http:\/\/meatpie\/?p=241"},"modified":"2023-05-01T17:49:40","modified_gmt":"2023-05-01T17:49:40","slug":"weather-app","status":"publish","type":"post","link":"https:\/\/snersbots.co.uk\/index.php\/weather-app\/","title":{"rendered":"Weather App &#8211; API"},"content":{"rendered":"\n<p>In the week my weather app stopped working. Looked like it was getting no data. Tried connecting via wifi, on mobile data, checked we actually had internet &#8211; but nothing. Turns out their <a href=\"https:\/\/en.wikipedia.org\/wiki\/API\">API <\/a>has a <a href=\"https:\/\/blog.darksky.net\/\">new home<\/a>. Thanks for nothing Apple.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">My Weather App<\/h2>\n\n\n\n<p>In case you hadn&#8217;t realised from the name of my website, I am a little obsessed with the weather. In general I love weather but in particular I love snow. And I am a great fan of seasons. Every time you start getting a bit bored with the weather, it changes to a new set of conditions. Always exciting.<\/p>\n\n\n\n<p>But now we are due for snow, my app actually tells you how many hours till the next snow &#8211; and it has stopped working. Drop all projects. This takes priority. Turns out that Apple say they are going to support the API till the end of the year, but they have already proved that it is not going to be reliable.<\/p>\n\n\n\n<p>The original app was my first Android project. You know how it goes when you get a new phone. Other people head straight to the app store and see what they can download. In my case I headed across to <a href=\"https:\/\/www.coursera.org\">coursera<\/a>, which incidentally was my second home for about 5 years, top recommendations. I&#8217;m at <a href=\"https:\/\/www.linkedin.com\/learning\/\">LinkedIn learning<\/a> right now, because someone is paying my subscription &#8211; thanks boss!<\/p>\n\n\n\n<p>Several courses later, I had my app with everything working except the slider. No matter, there are only 5 pages to go through, you can cycle through them just as easily. My favourite bits &#8211; apart from the snow countdown of course &#8211; are the graphs. By looking at the quantity and probability side by side, you get a much better picture than the old 2 drip icon. And it was fun doing the bitmaps.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"666\" height=\"375\" src=\"http:\/\/meatpie\/wp-content\/uploads\/2021\/02\/Screenshot_20210207-060135_SnowForecast.jpg\" alt=\"Two graphs side by side, one showing Hourly Precipitation over time, and one showing Precipitation % Probability over time.\" class=\"wp-image-245\" srcset=\"https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/02\/Screenshot_20210207-060135_SnowForecast.jpg 666w, https:\/\/snersbots.co.uk\/wp-content\/uploads\/2021\/02\/Screenshot_20210207-060135_SnowForecast-300x169.jpg 300w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">The new API &#8211; OpenWeather<\/h2>\n\n\n\n<p>Lools like <a href=\"https:\/\/openweathermap.org\">OpenWeather <\/a>is the solution to the weather problems. Nope &#8211; they don&#8217;t have precipitation probability. I love my probability graph. <em>Bulleted<\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/www.visualcrossing.com\">Visual Crossing<\/a> is also good. Need to compare these two now and decide<\/p>\n\n\n\n<p><a href=\"https:\/\/www.weatherapi.com\">WeatherAPI<\/a> &#8211; this is another option. <\/p>\n\n\n\n<p><a href=\"https:\/\/www.weatherbit.io\">WeatherBit<\/a> &#8211; does have minutely, and it is really small I can probably combine two apis<\/p>\n\n\n\n<p>Next job is to assess Visual Crossing and WeatherAPI and decide which, or use both if necessary.<\/p>\n\n\n\n<p>Anyway &#8211; right now we need to take a walk &#8211; rained all night and the river was already pretty high yesterday&#8230; river is pretty epic, but nothing like the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Limpopo_River\">Limpopo <\/a>right now.<\/p>\n\n\n\n<p>WeatherAPI vs VisualCrossing<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><\/td><td><strong>WeatherAPI<\/strong><\/td><td><strong>VisualCrossing<\/strong><\/td><\/tr><tr><td>Current Weather<\/td><td>YES<\/td><td><\/td><\/tr><tr><td>Precipitation field<\/td><td>\u2603\ufe0e Total Precipitation<br>\u2603\ufe0e Will it rain<br>\u2603\ufe0e Chance of rain<\/td><td>\u2603\ufe0e Precip<br>\u2603\ufe0e Precip prob<br>\u2603\ufe0e Precip Cover<br><\/td><\/tr><tr><td>Snow fields &#8211; Daily<\/td><td>\u2603\ufe0e Will it snow<br>\u2603\ufe0e Chance of snow<\/td><td>\u2603\ufe0e Precip Type<br>\u2603\ufe0e Snow<br>\u2603\ufe0e Snow depth<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"has-text-align-center\">WeatherAPI gives a nice summary of Current weather.<br>Visual Crossing wins on the precipitation.<\/p>\n\n\n\n<div style=\"height:42px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Climacell &#8211; No good<\/h2>\n\n\n\n<p>This site has probability, so I&#8217;ll give it a go. <a href=\"https:\/\/www.climacell.co\">Climacell<\/a>. It&#8217;s the same pricing plan as all the others. Free for the first 1000 calls a day.<\/p>\n\n\n\n<p>This is more difficult to get started with, than the other APIs, but then again it seems to give you more. The documentation is not great. Here is an example call. <\/p>\n\n\n\n<p><code>https:\/\/data.climacell.co\/v4\/timelines?location=54.8%2C-0.3&amp;fields=humidity,temperature,weatherCode&amp;timesteps=1m,1h&amp;apikey=xxxxx<\/code><\/p>\n\n\n\n<p>Time example:<\/p>\n\n\n\n<p> <code>https:\/\/data.climacell.co\/v4\/timelines?location=54.9%2C-0.3&amp;startTime=2021-02-12T06%3a00%3a00%2b0000&amp;endTime=2021-02-12T07%3a00%3a00%2b0000&amp;fields=humidity,temperature,weatherCode,precipitationIntensity,precipitationProbability,precipitationType,cloudCover,windSpeed&amp;timesteps=1m,1h&amp;apikey=xxxxx<\/code><\/p>\n\n\n\n<p>I&#8217;m liking Climacell more and more. It has a lot of useful data. In fact it is really necessary to start and end time otherwise you just get way too much. It is a bit too much data for the phone.<\/p>\n\n\n\n<p>Rubbish &#8211; in the bin. I&#8217;m sorry Climacell, it will not snow at 8 degrees C. I think I need to teach you about weather basics. Back to the drawing board. It&#8217;s not just that &#8211; your weather is wildly different from DarkSky. Not happy at all with it.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><strong>Provider<\/strong><\/td><td><strong>Evaluation<\/strong><\/td><\/tr><tr><td>AccuWeather<\/td><td>Paid<\/td><\/tr><tr><td>Aeris Weather<\/td><td>Paid<\/td><\/tr><tr><td>API Weather.mg<\/td><td>No probability &#8211; actually this has everything except a free tier<\/td><\/tr><tr><td>ClearAg<\/td><td>Can&#8217;t find price but it seems to have probability<\/td><\/tr><tr><td>Climacell<\/td><td>Inaccurate data<br>Only one location<\/td><\/tr><tr><td>Google<\/td><td>Deprecated<\/td><\/tr><tr><td>Meteo Matics<\/td><td>Paid<\/td><\/tr><tr><td>National Weather Service API<\/td><td>USA only I think<\/td><\/tr><tr><td>OpenWeatherMap<\/td><td>No probability &#8211; not even precipitation<\/td><\/tr><tr><td>Stormglass<\/td><td>No probability &#8211; this is marine weather &#8211; not applicable<\/td><\/tr><tr><td>Visual Crossing<\/td><td>No minutely data<\/td><\/tr><tr><td>Weather API<\/td><td>No probability &#8211; I&#8217;m back here, does &#8216;chance of rain&#8217;<\/td><\/tr><tr><td>Weather 2020<\/td><td>Doesn&#8217;t seem to have an API<\/td><\/tr><tr><td>Weatherbit<\/td><td>Free tier &#8211; limited weather data, but they do have minutely rain and snow figures<\/td><\/tr><tr><td>World Weather Online.com<\/td><td>Paid<\/td><\/tr><tr><td>Yahoo<\/td><td>Due to be shut down<\/td><\/tr><tr><td>WeatherStack<\/td><td>No minutely. They do have probability ie Chance of Rain. Also chance of wind, sunshine, frost, snow, thunder and more &#8211; that is very nice. But only 250 API calls a month &#8211; that&#8217;s pretty hectic.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Below are my notes and they make no sense, but it&#8217;s a bit easier than trawling through my browser history trying to find that API I saw two weeks ago, but I can&#8217;t remember what it is called<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Good<\/h3>\n\n\n\n<p><code>`https:\/\/weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/weatherdata\/forecast?locations=Herndon,VA,20170&amp;aggregateHours=24&amp;unitGroup=us&amp;shortColumnNames=false&amp;contentType=csv&amp;key=xxx<\/code>`<\/p>\n\n\n\n<p>Here are some visual crossing calls:<\/p>\n\n\n\n<p><code>https:\/\/api.weather.gov\/gridpoints\/LWX\/96,70\/forecast\/hourly<\/code><\/p>\n\n\n\n<p><code>https:\/\/weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/53.92,-0.36?key=xxx<\/code><\/p>\n\n\n\n<p>Nice tool here, thank you <a href=\"https:\/\/www.weatherapi.com\/docs\/\">WeatherAPI<\/a>:<\/p>\n\n\n\n<p><code>https:\/\/www.weatherapi.com\/api-explorer.aspx<\/code><\/p>\n\n\n\n<p><code>http:\/\/api.weatherapi.com\/v1\/forecast.json?key=xxx&amp;q=53.92,-0.367&amp;days=1&amp;aqi=no&amp;alerts=no<\/code><\/p>\n\n\n\n<p><code>https:\/\/api.weatherbit.io\/v2.0\/forecast\/minutely?lat=53.92&amp;lon=-0.36&amp;key=xxx<\/code><\/p>\n\n\n\n<p>This last is real tiny. there is no probability, but you do get a minute by minute rain and snow figure &#8211; best we&#8217;ve got for minute so far<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Not so good<\/h3>\n\n\n\n<p>This works without an api key. Not sure what the gridpoints are though:<\/p>\n\n\n\n<p><code>https:\/\/api.weather.gov\/gridpoints\/LWX\/96,70\/forecast\/hourly<\/code><\/p>\n\n\n\n<p>Nice page this &#8211; just need an api key: https:\/\/api.weather.mg\/api-detail-pages\/forecast-parameter.html<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Found it! Dark Sky again<\/h2>\n\n\n\n<p>My last API disappeared on me, so I&#8217;ve had no weather app for a while.<\/p>\n\n\n\n<p>But now I&#8217;ve found Dark Sky again. It is now called <a href=\"https:\/\/developer.apple.com\/documentation\/weatherkitrestapi\">WeatherKit<\/a><\/p>\n\n\n\n<p>Need to figure out if it is free, but it is bookmarked here for when I am ready. <\/p>\n\n\n\n<p>\u2603\ufe0f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the week my weather app stopped working. Looked like it was getting no data. Tried connecting via wifi, on mobile data, checked we actually had internet &#8211; but nothing. Turns out their API has a new home. Thanks for nothing Apple.<\/p>\n","protected":false},"author":1,"featured_media":251,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,8],"tags":[23,30,32,22,31],"class_list":["post-241","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-software","tag-climacell","tag-visual-crossing","tag-weather","tag-weather-api","tag-weatherbit"],"_links":{"self":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":99,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":956,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/241\/revisions\/956"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/media\/251"}],"wp:attachment":[{"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/snersbots.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}