Weather checker
Pulls the weekend forecast for a whole list of destinations at once, so planning a trip stops being an evening of filling in a spreadsheet.
This small project was inspired during weekend trip planning. I was looking where to go with my friends and ended up with 30 potential locations. One of the main factors was weather. I spent an evening filling a table with temperature and rain chance for every location and ended up with this (don't be scared, all temperatures are in °C):

It was very useful data, but it took an unacceptable amount of manual work and time to fill it. Oh, and yeah, the "sweetest" part is that in a few weeks this data became outdated and you would need to redo all the work to refill the table for every trip. For every trip. For. Every. Trip.
So I decided to simplify my life and create a small program which will grab weather for all specified locations for me. I spent some time looking for an API which I could use and found a few good options. And ended up with the following flow:
- Get place name
- Convert provided place name to latitude/longitude coordinates
- Using place coords get weather office ID
- Using weather office ID get forecast for the next days
- Remove all data which does not match the desired travel date
- PROFIT!
After some testing I realized that I can improve the logic a little bit, so I baked in a few small features to improve final data, processing speed, etc. For example I don't need to include temperature/rain chance during deep night and early morning because I will sleep (hopefully inside) during this time and weather is irrelevant. I also realized that I can reduce the number of API calls from 3 to 1 by caching some data, so I added caching using SQLite which improved speed — on average the response from the API provider was way slower than SQLite.
So the new flow will be this:
- Get place name
- Is place cached? If so, then jump to step 5, otherwise continue
- Convert provided place name to latitude/longitude coordinates
- Using place coords get weather office ID
- Using weather office ID get forecast for the next days
- Remove all data which does not match the desired travel date
- Filter output data!
- PROFIT!
Output will have place name (in the current output it's an airport identifier, I want to hook it up to a plane tickets API in the future), temperature, rain chance and sky cover percentage for the next weekend, averaged between Saturday and Sunday. The program runs on this server and refreshes the data on its own, so the table below is its real current output.
Live output
| Place | Temp | Rain | Cloud |
|---|---|---|---|
| JFK | 21.9°C | 8% | 31% |
| JFK | 21.9°C | 8% | 31% |
| IAD | 23.7°C | 11% | 23% |
| MCO | 29.1°C | 47% | 56% |
| BOS | 18.5°C | 5% | 33% |
| ATL | 29.9°C | 27% | 35% |
| LAX | 21.4°C | 20% | 49% |
| ORD | 25.8°C | 10% | 46% |
| DFW | 33.9°C | 3% | 13% |
| DEN | 27.5°C | 18% | 40% |
| SFO | 15.1°C | 2% | 13% |
| LAS | 29.2°C | 31% | 62% |
| SEA | 17.6°C | 19% | 47% |
| CLT | 27.9°C | 28% | 51% |
| MIA | 29.2°C | 54% | 51% |
| PHX | 33.6°C | 20% | 45% |
| EWR | 22.2°C | 10% | 27% |
| IAH | 31.5°C | 17% | 27% |
| FLL | 29.4°C | 53% | 50% |
| LGA | 22.2°C | 9% | 29% |
| JAX | 29.0°C | 35% | 51% |
| SAV | 29.2°C | 40% | 47% |
| RSW | 29.4°C | 48% | 54% |
| MSP | 26.2°C | 14% | 46% |
| DTW | 23.2°C | 6% | 28% |
| SLC | 23.3°C | 27% | 52% |
| PHL | 22.5°C | 8% | 29% |
| BWI | 23.5°C | 10% | 24% |
| TPA | 28.6°C | 47% | 52% |
| SAN | 24.6°C | 22% | 62% |
| MDW | 25.8°C | 10% | 42% |